An exception flows when I was trying to call a method on web service:
System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://localhost:53460/3Development/MyWebService.asmx/GetBasePath.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
The web service's namespace:
[WebService(Namespace = "http://internaltest.temp.us/MyWebService.asmx")]
I did some research and found out that this exception flows because the web service's namespace referenced in the project was different from the server web service's namespace, but I've tried removing web reference and add it again in the project, but the result was still the same.
My situation was similar to the below article:
http://bluebones.net/2003/07/server-did-not-recognize-http-header-soapaction/
From Article:
So basically the web service was moved from http://foo.com/servicename to http://bar.com/servicename but the “namespace” of the web service stayed as http://foo.com/servicename because no one changed it.
The problem is:
How to change the namespace of the web reference?
SOAPAction. The SOAPAction header is a transport protocol header (either HTTP or JMS). It is transmitted with SOAP messages, and provides information about the intention of the web service request, to the service. The WSDL interface for a web service defines the SOAPAction header value used for each operation.
No. The SOAPAction HTTP header is required by SOAP 1.1 and therefore by the WSA. It can be blank or have a value, but the HTTP header has to be there. Also, take a look at the service's WSDL, and if it includes "soapAction" then the client must meet the API's specification.
wsimport.exe put the soap action in the "Content-Type" http header, the the service says the Action header is missing in the SOAP message. The WSDL specifies the Action as an attribute of the <operation ..> element inside the <binding ..>
In addition to removing and adding web-reference, you could try regenerating proxies using wsdl.exe as suggested here, with the namespace again. Hope it helps
I also got same exception when calling a webservice. In my client code, I was using wrong the Namespace to refer to the WebService. So, whenever I was refered to the WebService, I used fully qualified names like: Namespace.WebService, which solved the issue for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With