开发者

soap response error

I am doing soap request/response application. While building soap response, I am getting "Server did not recognize the value of HTTP Header SOAPAction".

What does that mean? And how to solve this?

Here is the code.

NSString *soapMessage = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
                         "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
                         "<soap:Body>\n"
                         "<SignOn xmlns=\"http://10.12.50.99/CUTechWebservices/CuTechWebService.asmx\">\n"
                         "<DeviceID>4A6B740C-0B5B-5F8C-8694-1EC0196C1C67</DeviceID>\n"
                         "<User开发者_StackOverflow中文版ID>10827</UserID>\n"
                         "<CrID>6</CrID>\n"
                         "<UserPin>777777!</UserPin>\n"
                         "</SignOn>\n"
                         "</soap:Body>\n"
                         "</soap:Envelope>\n"];    
NSLog(@"%@",soapMessage);

//Soap request.
NSURL *url = [NSURL URLWithString:@"https://mobile.areafinancial.com/cutechservice/cutechwebservice.asmx"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d",[soapMessage length]];
[theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue:@"http://10.12.50.99/CUTechWebservices/CuTechWebService.asmx" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];


In SOAP 1.2 SOAPAction header was replaced with "optional" action attribute of Content-Type header field.

Try it with following header:

Content-Type: application/soap+xml; charset=utf-8; action="https://mobile.areafinancial.com/cutechservice/cutechwebservice.asmx?op=SignOn"

without the SOAPAction: header field.

See also http://www.coderanch.com/t/224524/Web-Services/java/SOAPAction-header


Try to remove below line and see what you get. This header you passed in request. You should pass same header as in the web service.

[theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜