VB.NET Web 服务客户端访问 Java Web 服务 - 连接中止
我在让 VB.NET Web 服务客户端接收来自 Java Web 服务的响应对象时遇到问题。在发布这个问题的过程中,另一个部门的某人自愿提供了一些为类似情况编写的代码。我在网上找不到这个问题,所以我正在完成我的问题以帮助其他人。
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)
失败于:
objCurrentPrice = myService.getCurrentPrice("10211012343")
内部异常表明连接被远程主机中止。
这是我的同事提供的带有附加行的代码:
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)
它解决了互操作性问题。 Web 服务是 Apache CXF,其中混合了一些 Spring 元素。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样修改这个静态变量:
Modify this static variable like this: