views:

39

answers:

1

I had a problem getting a VB.NET web service client to receive the response object from a Java web service. In the process of posting this question someone from another department volunteered some code written for a similar situation. I couldn't find this anywhere on the net so I'm completing my question to help others out.

Dim myService As New theService.TheService()
Dim objCurrentPrice As New myService.CurrentPrice

myService.Credentials = New NetworkCredential("webuser", "123pass")

objCurrentPrice = myService.getCurrentPrice("10211012343")
MessageBox.Show(objCurrentPrice.Description)

This failed at:

objCurrentPrice = myService.getCurrentPrice("10211012343")

With the inner exception stating the connection was aborted by the remote host.

Here is the code with the additional line that my co-worker gave:

Dim myService As New theService.TheService()
Dim objCurrentPrice As New myService.CurrentPrice

myService.Credentials = New NetworkCredential("webuser", "123pass")
ServicePointManager.Expect100Continue = False

objCurrentPrice = myService.getCurrentPrice("10211012343")
MessageBox.Show(objCurrentPrice.Description)

Which fixed the interoperability problem. The web service is Apache CXF with some Spring elements mixed in.

A: 

Modify this static variable like this:

ServicePointManager.Expect100Continue = False
andematt