Handling HTTP response codes in SOAP proxies



Continuing with the last post on authentication issues with wsdl.exe-generated SOAP proxies, you may need to handle HTTP status codes to provide custom exceptions.  To do this, the SoapHttpClientProtocol class (actually its parent HttpWebClientProtocol) provides a pair of GetWebResponse() methods for derived classes to override.  One method is for synchronous calls and the other for asynchronous.

The following code shows how to generate a custom exception for the HTTP 401 Unauthorized code.

Buck Hodges

Follow Buck   


No Comments.