Apache CXF 2.7.7 WS-Addressing失败

时间:2013-10-10 18:45:24

标签: java cxf soap-client

我正在尝试使用首先生成的CXF WSDL客户端来调用SOAP UI中的模拟服务。我使用的WSDL的策略定义为:

  <wsp:Policy wsu:Id="addressing-policy" wsdl:required="true">
        <wsam:Addressing>
            <wsp:Policy>
                <wsam:AnonymousResponse/>
                <wsam:MessageId/>
            </wsp:Policy>
        </wsam:Addressing>
    </wsp:Policy>

当我调用我的客户端时,我在SOAP UI中看到了ws-Addressing标题,如:

   <soap:Header>
      <Action xmlns="http://www.w3.org/2005/08/addressing">http://www.cablelabs.com/namespaces/safi/wsdl/cip/opUpdateNotice/msgUpdateNotice</Action>
      <MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:61e13403-0270-40c8-800a-618007f1a2e4</MessageID>
      <To xmlns="http://www.w3.org/2005/08/addressing">http://localhost:8088/mockbdCIP-UPDATE-SOAP12HTTP</To>
      <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
         <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
      </ReplyTo>
   </soap:Header>

在SOAP UI中,我看到响应发送为:

   <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsa:Action>http://www.cablelabs.com/namespaces/safi/wsdl/cip/opUpdateNotice/msgUpdateResponse</wsa:Action>
      <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:635f6d1c-fdb6-423b-9713-e1afe0bbd26e</wsa:RelatesTo>
      <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
      <wsa:MessageID>uuid:a0e5dde0-f02d-42d4-9bda-51fa7b5506a4</wsa:MessageID>
   </soap:Header>
在控制台中我看到CXF抛出以下异常:

  

引起:org.apache.cxf.ws.policy.PolicyException:这些政策   替代品不能满足:   {http://www.w3.org/2007/05/addressing/metadata} AnonymousResponse   {http://www.w3.org/2007/05/addressing/metadata} MessageId at   org.apache.cxf.ws.policy.AssertionInfoMap.checkEffectivePolicy(AssertionInfoMap.java:179)   〜[cxf-rt-ws-policy-2.7.7.jar:2.7.7] at   org.apache.cxf.ws.policy.PolicyVerificationInInterceptor.handle(PolicyVerificationInInterceptor.java:101)   〜[cxf-rt-ws-policy-2.7.7.jar:2.7.7] at   org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:44)   〜[cxf-rt-ws-policy-2.7.7.jar:2.7.7] at   org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:835)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.transport.http.HTTPConduit $ WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1606)   〜[cxf-rt-transports-http-2.7.7.jar:2.7.7] at   org.apache.cxf.transport.http.HTTPConduit $ WrappedOutputStream.handleResponse(HTTPConduit.java:1502)   〜[cxf-rt-transports-http-2.7.7.jar:2.7.7] at   org.apache.cxf.transport.http.HTTPConduit $ WrappedOutputStream.close(HTTPConduit.java:1309)   〜[cxf-rt-transports-http-2.7.7.jar:2.7.7] at   org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:627)   〜[cxf-rt-transports-http-2.7.7.jar:2.7.7] at   org.apache.cxf.interceptor.MessageSenderInterceptor $ MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:565)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:474)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:377)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:330)   〜[cxf-api-2.7.7.jar:2.7.7] at   org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)   〜[cxf-rt-frontend-simple-2.7.7.jar:2.7.7] at   org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)   〜[cxf-rt-frontend-jaxws-2.7.7.jar:2.7.7] ...省略了42个常见帧

任何人都有关于如何解决这个问题的想法?

0 个答案:

没有答案