Frage

I have an old .NET 2.0 app connecting to the asmx web service. I need to debug the web service, but when I run it locally, I always receive 400 - Bad Request response. Trace for the web service gave me a little more details - the exception which was thrown is Root element is missing. Then I tried to catch the traffic with Fiddler - but apparently it can't catch it even when app has forced proxy to localhost:8888. So I used the idea from here to log the soap message. But result was supprising - soap messages logged for this very service was blank. For other web services this method works.

Any ideas what may cause this behavior, or how can I trace it? The only idea I have now is to confirm that the soap message is blank with WireShark...

War es hilfreich?

Lösung 2

Today I got a minute to take a look at the problem again and I found something interesting. In web.config file for the web service there was declared paths for directories used by the web service and one of the paths did not exist. It was not used by the methods which returned 400 bad request response, but after fixing the directory path to the one that exists the bad request problem has disappeared. Thanks for your help on this!

Andere Tipps

You get the 400 - Bad Request error because the request cannot be parsed. It cant be parsed because it is an empty message, hence the Root element is missing error occurs when the XML parser wants to read your message. Verify that the message you send to the service is not empty.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top