开发者

SOAP Xml issue in iPhone

Methods which take no parameter give correct result as expected. Whereas methods of webservice requiring few parameter returns no relevant result instead show Message.

Im using following code:

NSString *post =[[NSString alloc] initWithFormat:@"param1=%@&param2=%@&param3=%@&param4=%@&pageSize=%@&pageNo=%@",@"",@"81",@"1",@"",@"40",@"1"];

NSURL *url = [NSURL URLWithString:@"www.someurlxyz.com"];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];

soapMsg = [soapMsg stringByAppendingString:post];

NSLog(@"value of soap is %@",soapMsg);
NSString *msgLength = [NSString stringWithFormat:@"%d", [s开发者_开发百科oapMsg length]];
//postData =[postData stringByAppendingString:];

[req addValue:@"text/xml; charset=utf-8"  forHTTPHeaderField:@"Content-Type"];
[req addValue:@"http://www.someurlxyz.com/Search/Methodname?"  forHTTPHeaderField:@"SOAPAction"];
[req addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[req setHTTPMethod:@"POST"];
[req setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
[post release];

Message (which is getting returned is following). Server did not recognize the value of HTTP Header SOAPAction: http://www.someurlxyz.com/Search/Methodname?


Might be a problem with the namespaces or you might be calling a wrong method. Use some third party client like SoapUI to check your webservice, and check whether you creating exact string in your request in iPhone app.


What is the server expecting here?

It looks like you are sending param1=&param2=81&param3=1&param4=&pageSize=40&pageNo=1

Which doesn't look like an actual soap message or even XML.

You don't specify what soapMsg is originally but you're appending the string above to it.

Maybe you intended to format the original soapMgs string?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜