System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction:

33,832

Solution 1

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

Solution 2

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.

Solution 3

Sharing my experience, because this may help someone out there.

Example to explain the case:

Actual method:

[WebMethod]
public string Bar(){
}

You renamed it to Foo

[WebMethod]
public string Foo(){
}

Wrongly called method:

objectName.Bar();

Correct call:

objectName.Foo();

A name conflict (because of renaming of web method) between actual web method and the called method can cause the issue.

Share:
33,832
User2012384
Author by

User2012384

Any fool can write code that a computer can understand. Good programmers write code that humans can understand. General questions lead to general answers, specific questions lead to specific answers. If you want to receive a good answer, please learn how to ask a good question Hello all I'm an system analyst in Hong Kong, somewhere in Asia

Updated on July 09, 2022

Comments

  • User2012384
    User2012384 almost 2 years

    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?