我的网络服务在其WSDL中定义了一个 WS 寻址策略
<wsp:Policy wss:Id="WSAddressing_policy"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsam:Addressing>
<wsp:policy/>
</wsam:Addressing>
</wsp:Policy>
... 和
<wsdl:binding name="OutboundBinding" type="tns:OutboundPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsp:PolicyReference URI="#WSAddressing_policy"/>
<!-- Verify Availability -->
<wsdl:operation name="VerifyAvailability">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="VerifyAvailabilityRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="VerifyAvailabilityResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
我对策略使用CXFs自动拦截器:
<cxf:bus>
<cxf:features>
<p:policies ignoreUnknownAssertions="true"/>
<cxf:logging/>
</cxf:features>
</cxf:bus>
现在我无法使用 SOAP UI 创建对此 Web 服务的有效请求 - 无论我尝试哪种 WS-A 设置,我总是得到以下响应:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode xmlns:ns1="http://www.w3.org/2005/08/addressing">ns1:MessageAddressingHeaderRequired</faultcode>
<faultstring>A required header representing a Message Addressing Property is not present</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
我究竟做错了什么?
更新
我也无法使用 CXF 客户端本身创建有效请求。如果我将 WSDL 从
<wsp:Policy wss:Id="WSAddressing_policy">
<wsam:Addressing>
<wsp:policy/>
</wsam:Addressing>
</wsp:Policy>
至
<wsp:Policy wss:Id="WSAddressing_policy">
<wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="false" />
</wsp:Policy>