如何使用AXis 1.4创建Java客户端以使用wsHttpBinding来使用WCF服务

时间:2010-07-21 12:19:17

标签: java wcf client axis

我已经使用轴1.4创建了一个用于使用WCF服务的Java客户端。如果我使用basicHttpBinding比一切正常,但如果我使用wsHttpBinding比我得到以下错误: -

Did not understand "MustUnderstand" header(s):{http://www.w3.org/2005/08/addressing}Action
AxisFault
 faultCode: {http://www.w3.org/2003/05/soap-envelope}MustUnderstand
 faultSubcode: 
 faultString: Did not understand "MustUnderstand" header(s):{http://www.w3.org/2005/08/addressing}Action
 faultActor: 
 faultNode: 
 faultDetail: 
    {http://xml.apache.org/axis/}stackTrace:
    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at org.tempuri.WSHttpBinding_IService1Stub.getData(WSHttpBinding_IService1Stub.java:171)
    at Mytes.main(Mytes.java:14)

    {http://xml.apache.org/axis/}hostname:2207A-H7-SITA

Did not understand "MustUnderstand" header(s):{http://www.w3.org/2005/08/addressing}Action
    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at org.tempuri.WSHttpBinding_IService1Stub.getData(WSHttpBinding_IService1Stub.java:171)
    at Mytes.main(Mytes.java:14)

请告诉我如何解决此错误。感谢。

2 个答案:

答案 0 :(得分:3)

当您使用Axis为WCF服务生成代理时,它会生成自动设置MustUnderstand的{​​{1}}标头的存根

下面的代码将MustUnderstand标志重置为false。对于被调用的方法。我今天遇到了类似的问题,并且可以使用此处发布的代码解析

http://www.w3.org/2005/08/addressing

我发现MustUnderstand veru上的this post很有帮助。

答案 1 :(得分:-2)

BasicHttpBinding或webHttpBinidng(REST服务)是与非Microsoft技术交互的唯一选择。 BasicHttpBinding只是绑定,它支持Basic Profile 1.1的互操作性。

请查看以下链接,看看他们是否可以帮助您了解基本和ws出价。

http://www.devproconnections.com/article/net-framework2/choosing-the-right-web-service-binding.aspx

http://geekswithblogs.net/claeyskurt/archive/2008/04/22/121508.aspx