【问题标题】:VB.NET web service client accessing Java web service - connection abortedVB.NET Web 服务客户端访问 Java Web 服务 - 连接中止
【发布时间】:2011-11-21 23:18:33
【问题描述】:

我在让 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 元素。

【问题讨论】:

    标签: java vb.net web-services interop cxf


    【解决方案1】:

    像这样修改这个静态变量:

    ServicePointManager.Expect100Continue = False
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-04
      • 1970-01-01
      • 2010-11-09
      • 2010-09-17
      • 2012-11-13
      • 1970-01-01
      • 2012-09-17
      • 2010-12-19
      相关资源
      最近更新 更多