使用 wsHttpBinding 在 Java 客户端中使用 WCF 服务

发布于 2024-12-01 17:16:06 字数 564 浏览 7 评论 0原文

我正在尝试让 Java 客户端与 WCF wshttpbinding WebService 进行通信。但到目前为止我还没有成功。调用要么挂起,要么我得到:“SOAPFaultException:无法处理消息。这很可能是因为操作“http://tempuri.org/ISampleService/GetServiceName”不正确,或者因为消息包含无效或过期的安全上下文令牌,或者因为绑定之间存在不匹配。如果服务由于不活动而中止通道,则安全上下文令牌将无效。为了防止服务过早中止空闲会话,请增加服务端点绑定上的接收超时。”

我的Web服务只是Visual Studio 2010默认生成的“WCF服务库模板”。

我的java客户端是在netBeans 7.0.1中生成的,并且存根是使用新的Other -->生成的网络服务 --> Web 服务客户端,我引用本地 WSDL。

我尝试添加 WebServiceFeature wsAddressing = new AddressingFeature(true);在生成的存根中,但它只是抛出上面的异常。

我看到其他人也有类似的问题;然而,我没有看到任何真正的解决方案。任何建议将不胜感激。

I'm trying to get a Java Client to communicate with a WCF wshttpbinding WebService. But I've been unsucesful so far. The call either hangs, or I get: “SOAPFaultException: The message could not be processed. This is most likely because the action 'http://tempuri.org/ISampleService/GetServiceName' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.”

My Web Service is just the default Visual Studio 2010 generated "WCF Service Library Template".

My java client is generated in netBeans 7.0.1 and stubs have been generated using new Other --> Web Services --> Web Service Client and I’m referencing a local WSDL.

I've tried adding WebServiceFeature wsAddressing = new AddressingFeature(true); in the stub generated but it just throws the exception above.

I see other people with similar problems; however, I don't see any true resolution. Any suggestions would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

关于从前 2024-12-08 17:16:06

听起来您遇到了肥皂格式问题。 java 客户端不会生成对 WCF 服务有意义的soap XML。要了解服务期望的肥皂 XML,请使用 WcfTestClient 命令行应用程序 调用该服务。此应用程序在 WinForm 应用程序中动态创建服务代理。在应用程序中,调用服务操作并单击 XML 选项卡(位于右窗格底部的“格式化”选项卡旁边)。您将看到请求和在此选项卡中响应肥皂。

接下来,为消息跟踪配置 WCF 服务,并从 java 调用它客户端查看正在发送的soap XML。现在您可以比较两个肥皂消息,看看有什么不同。 java 客户端需要配置为生成 WCF 期望的肥皂格式。

WCF 团队最近专门针对 java 发布了一些 WCF 互操作绑定。这些可能不适用于您的具体情况,但可能值得回顾。

It sounds like you have a soap formatting issue. The java client isn't generating soap XML that makes sense to the WCF service. To get an idea of what the soap XML the service is expecting use the WcfTestClient command line app to call the service. This app dynamically creates a service proxy in a WinForm app. In the app, call the service operation and click the XML tab (next to the Formatted tab at the bottom of the right pane). You'll see both the request & response soap in this tab.

Next, configure the WCF service for message tracing and call it from the java client to see the soap XML it is being sent. Now you can compare the two soap messages to see what is different. The java client will need be configured to generate the soap format the WCF is expecting.

The WCF team recently released some WCF interop bindings specifically for java. These may not apply to your specific situation but they're probably worth reviewing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文