1

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" "<UserID>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]]; 

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

I tried this. but this time i am getting error "Unable to handle request. The action 'mobile.areafinancial.com/cutechservice/…' was not recognized."
Try http://10.12.50.99/CUTechWebservices/CuTechWebService.asmx/SignOn as the action. I just found out it by downloading mobile.areafinancial.com/cutechservice/… and searching for a soapAction string.
@peter that is what I actually did. And its working perfectly. Thanks for your help
0

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"]; 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.