andematt
andematt

Reputation: 403

VB.NET web service client accessing Java web service - connection aborted

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.

Upvotes: 0

Views: 1193

Answers (1)

andematt
andematt

Reputation: 403

Modify this static variable like this:

ServicePointManager.Expect100Continue = False

Upvotes: 1

Related Questions