I should call a web service in my C# application. When I add a service reference in Visual Studio to consume the service, in an exception situation I get this message:
An HTTP Content-Type header is required for SOAP messaging and none was found.
But, when I add a web reference the message is more rich and easy to understand the problem. The final part of this message is a business error message generated by the service. I was provided an invalid authentication token parameter for that service so this error message is returned:
Client found response content type of '', but expected 'text/xml'.
The request failed with the error message:
--
WEB SERVICE ERROR : UNAUTHENTICATED_ACCESS
I was preferred to use "service reference" approach but now I am in doubt. Is there a way to improve this kind of exceptions or to log raw response using "service reference"?