Skip to content


ASP.NET returns HTTP status code 200 even if XML in a POST request is malformed

I observed a weird behaviour on one of our ASMX web services (which use WSE3.0 extensions). Even if the client would send the malformed packet, the IIS serving this request would return HTTP status code 200. What was weird is that the request would never hit the application (method it was destined to). It was very strange. The XML wasn’t well-formed, much less valid. I googled around, but found no answer to this.

To make things even worse, I could not reproduce that kind of behaviour on other “test” web service implementations. I would get 400 Bad request from the server if tried to do anything funny with the XML being sent in.

It all made sense the moment, I looked at the generated proxy. I noticed OneWay=true on the generated proxy — the WSDL contract from which the server-side proxy was generated specified OneWay messaging. When I removed it, message validation was back in place. Lesson learned: take a look at the service contract — the implementation may be doing what it is supposed to do.

Posted in software.