views:

941

answers:

1

We have an ASP.Net web application which calls Web Services deployed in the same virtual directory. The call returns without any problem in the development machine. But when deployed to the production server, it gives back a '400 Bad Request' error. The call was made by creating a WebRequest and setting the SoapAction header and then WebResponse.GetRepsonseStream() gets the SOAP response. Temporarily, we fixed the issue by making the call using the proxy generated.

Can anyone suggest a proper way of calling web services using WebRequest and WebResponse without encountering the 400 error?

+1  A: 

I don't understand why you are doing that way. I would add a web reference to the service WSDL and let the framework take care of the rest! In my experience with web services and ASP.NET, this is the easiest way.

Josh Stodola
The site is basically a test for the web service and we wanted to inspect the returned SOAP xml for values. Using the WebRequest/WebResponse was easier to do that.
etsuba
I would still go with the traditional ASP.NET web service implementaton. Then you can use a separate utility such as a network packet sniffer/trace to log the request/response.
Josh Stodola