Jul 1, 2003
Server did not recognize the value of HTTP Header SOAPAction
Seeing as nowhere on the internet can I find an explanation of this error I thought I’d share the fruits of my long search for this bug.
It means (at least in my case) that you are accessing a web service with SOAP and passing a SOAPAction parameter in the HTTP request that does not match what the service is expecting.
I got in a pickle because we moved a web service from one server to another and thus I changed the “namespace” (don’t get confused between web service namespaces and .net namespaces) in the calling C# file to match the new server. But the server doesn’t care about the actual web reality of http://yournamespace.com/blah it only cares that you send it what you have said you are expecting on the server. It doesn’t care if there’s actually anything there or not.
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.
And that only took about 4 hours to work out!
If you’re having a similar problem but can’t work what I’m saying here, feel free to mail me on bakert+web@gmail.com – I wouldn’t wish my four hours on anyone!
Thank you so much for sharing this tip! As a beginner web developer this cryptic error kept me going in circles for much more than 4 hours and they were terrible, indeed! Once I synchronized the server names (replaced everywhere localhost with the actual machine name), my app was up and running.
Good work fella, it helped me also. To bestow an old Irish blessing – May you be in heaven half-an-hour before the devil knows you’re dead!
Hope this won’t confuse anyone:
The namespace can be set to either a URL or a URN. To avoid this sort of confusion, I’d suggest using a URN for the namespace rather than a URL.
Here are a couple of examples to show what I mean:
1) Using a URL for the namespace:
———————————
[WebService(Namespace = "http://foo.com/mywebservice")]
public class MyWebService : System.Web.Services.WebService
2) Using a URN for the namespace:
———————————
[WebService(Namespace = "urn:foo:mywebservice")]
public class MyWebService : System.Web.Services.WebService
The namespace is a name that uniquely identifies your web service. You can use a URL for this unique name but the problem is that it looks like an address. If you change the location of your web service it’s tempting to change the namespace, because it looks like an address.
On the other hand, if you use a URN for the namespace, it doesn’t look like an address. It looks like what it is – a name. So if the location of the web service changes there won’t be a temptation to change the namespace.
To be honest, I have no idea why Microsoft used URLs in their example code. It just confuses people. I’ve noticed that they have started to use URNs more recently.
I also experienced this when specifying that I wanted my WS calls to return System.Collections.Generic.List when System.Array was expected.
Worked fine once I decided not to be an idiot.
Thank you so much for sharing this tip(s)! It saved me hours of debugging and hopefully the rest of my hair. ;D
thank you. thank you. thank you.
this was driving me absolutely bonkers. you have given me my life back.
Thanks so much for this!!! Was hunting quite a bit for the solution before I found your post. It was just perfect. Highly appreciate your effort in putting this up.
[...] If the above does not pertain to you, make sure you haven’t messed up the Web Service Namespace. [...]
God bless you!
I also got this error because I stupidly had the Url property of my web service pointing to the wrong .asmx file (I just copied it from another web service object).
Thanks for all the ideas to help diagnose this one.
Thanks for pointing me in this direction.
In your project, right click on App_WebReferences > Update Web/Service References…
Then copy your updated files to the server.
Thanks!
Scott