It's been a little while between posts, so I thought I'd share a tip about using
Fiddler to debug .NET SOAP Web Service Clients.
Once you install Fiddler it sets itself up as a proxy on port
8888. You then use the Fiddler UI to inspect sessions made from
your application to the IIS hosting the web service. Fiddler lets
you inspect the raw HTTP traffic that is exchanged in a SOAP call, and
you can even modify an old session and resubmit it with modified
data! Great for debugging.
Below is a sample (VB.Net 2003) adapted for readability from an actual
project I'm working on. The point of the sample is setting Proxy
property of the web service reference to a WebProxy object.
Dim NewUser As RemoteWebHost.User
Dim UserServices As RemoteWebHost.DatabaseSync
' Adding this line lets Fiddler track the HTTP Sessions.
UserServices.Proxy = New WebProxy("http://127.0.0.1/", 8888)
With NewUser
.UserName = "fred"
' [...]
End With
Try
UserServices.UserAdd(NewUser, Nothing)
Catch ex As SoapHeaderException
' [...]
Catch ex As SoapException
' [...]
Catch ex As Exception
' [...]
End Try