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

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.

解决方案

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值