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=%@¶m2=%@¶m3=%@¶m4=%@&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=¶m2=81¶m3=1¶m4=&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?
精彩评论