我是iPhone开发的新手,想要得到答案以发送带有用户名,密码和公司id的soap头请求,..
我找了很多教程,但是没有一个对我有帮助。
Thanks in Advance.
Soap Code为:
<soap:Header>
<AuthenticationData xmlns="http://www.harikishan.com/"> //www.harikishan.com used as an example of website to which i need to send request
<CompanyId>string</CompanyId>
<UserName>string</UserName>
<Password>string</Password>
</AuthenticationData>
</soap:Header>
一般情况下,您需要构造XML有效负载,确保对插入的任何字符串进行XML编码,并使用NSURLRequest
将其发送到服务器。然后,您可以接收响应并适当地处理
你需要用你的soap body创建一个nnstring
为公司id,用户名,密码创建三个字符串
NSString * soapBody = [NSString stringWithFormat @"<soap:Header>"
"<AuthenticationData xmlns="http://www.harikishan.com/">
"<CompanyId>%@</CompanyId>"
"<UserName>%@</UserName>"
"<Password>%@</Password>"
"</AuthenticationData>"
"</soap:Header>", companyID, userName, password];
然后加上NSMutableURLRequest * request