Inconsistent Web Service behavior: 400 Bad Request - Invalid Verb RRS feed

  • Question

  • User1550844844 posted

    Hi there,

    I've been tyring to figure this out for a while, but to no avail. I hope someone here can help me:

    I have an IIS 6 server set up with W2K3 Server as follows:

    / root server dir
        /services (root web services)
        /subsite1 (Virtual Directory + Application)
            /services (web services for subsite1)

    So I have web services exposed in two different levels, one set under /services, and another set under /subsite1/services. I had to use this layout because the root site and subsite1 are very different web applications and cannot co-exsit peacefully. Both of the applications use the same ASP.Net version, etc.

    On the client side, I use the exact same code to create the SOAP requests, which uses SOAP 1.2 for the request format. The problem is that the SOAP requests succeeds for the services in /subsite1/services, but the server returns HTTP 400 - Bad Request "Invalid verb" for the services under /services.

    As I mentioned, requests for both set of services are created using the same function on the client and with the correct substitution of URL path and action verb. I even verified the wire data and it is IDENTICAL the usage description displayed in the .asmx page help.

    I'm sure this is either a configuration or setup issue somewhere because the service works in one part and not the other. Anyone care to shed some light on this?

    Thanks in advance!
    - K.

    Thursday, March 12, 2009 10:16 AM


  • User1550844844 posted

    OK, I figured it out. It's one of those things that is so obvious when you get it, but if you are a newbie like myself, you can spend a lot of time trying to figure it out. I did some extensive Googling and didn't find this documented using simple keywords, so I thought to save others time in the future, I would spend some time to document it.

    So the "Invalid Verb" error is definitely a misnomer. What really happened for me was a mismatch in Namespace. Yup, it's that simple. My root web services and subsite1 web services used a slightly different namespace - one with a "www." prefix for the domain, and the other without.

    So apparently, when the request namespace does not exactly match the Namespace defined in the web service, the server somehow expects an Action Verb in the Content-Type header. If the action verb is missing, you get the 400. Of course, the relation between Namespace and Action Verb is not obvious in any way (I didn't come across this in a few IETF and RFC documents I looked at), but once I changed the Namespace to match what the server expects, everything just works!

    Hopefully this might be of help to someone in the future.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 12, 2009 4:11 PM