2

我正在尝试使用 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 在 org.apache.cxf.ws.policy.AssertionInfoMap.checkEffectivePolicy(AssertionInfoMap.java:179) ~[cxf-rt-ws-policy-2.7.7.jar:2.7.7] 在 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] 在 org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) ~[cxf-api- 2.7.7.jar:2.7.7] 在 org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:835) ~[cxf-api-2.7.7.jar:2.7.7] 在 org.apache。 cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1606) ~[cxf-rt-transports-http-2.7.7.jar:2.7.7] 在 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] 在 org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[ cxf-api-2.7.7.jar:2.7.7] 在 org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:627) ~[cxf-rt-transports-http-2.7.7.jar :2.7.7] 在 org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ~[cxf-api-2.7.7.jar:2.7.7] 在 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] 在 org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:377) ~[cxf-api-2.7.7.jar:2.7.7] 在 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] 在 org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) ~[cxf-rt-frontend-jaxws-2.7.7 .jar:2.7.7] ...省略了42个常用框架7.jar:2.7.7] 在 org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:330) ~[cxf-api-2.7.7.jar:2.7.7] 在 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个常用框架7.jar:2.7.7] 在 org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:330) ~[cxf-api-2.7.7.jar:2.7.7] 在 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个常用框架

有人对如何解决这个问题有想法吗?

4

0 回答 0