线程“main”中的异常javax.xml.ws.soap.SOAPFaultException:表示消息寻址属性的必需标头不存在
我错过了什么?我以编程方式添加wdsl-addressing:
wsbp.setOutboundHeaders( new StringHeader(WS_ADDR_VER.messageIDTag, uuid), replyTo.createHeader(WS_ADDR_VER.replyToTag));
我正在使用jdeveloper 11g
CODE:
asyncNarociloServisService = new AsyncNarociloServisService();
AsyncNarociloServis asyncNarociloServis = asyncNarociloServisService.getAsyncNarociloServisPort();
// Get the request context to set the outgoing addressing properties
WSBindingProvider wsbp = (WSBindingProvider)asyncNarociloServis;
WSEndpointReference replyTo = new WSEndpointReference("http://84.255.215.133:7101/TestniWS-TestniWS-context-root/AsyncNarociloServisResponseImplPort", WS_ADDR_VER);
String uuid = "uuid:" + UUID.randomUUID();
wsbp.setOutboundHeaders( new StringHeader(WS_ADDR_VER.messageIDTag, uuid), replyTo.createHeader(WS_ADDR_VER.replyToTag));
WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<definitions
name="AsyncNarociloServisService"
targetNamespace="http://www.xxx.si/narocilowsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns:tns="http://www.xxx.si/narocilowsdl"
xmlns:nar="http://www.xxx.si/narocilo"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:pov="http://www.xxx.si/povratnica"
>
<plnk:partnerLinkType name="AsyncNarociloServis">
<plnk:role name="AsyncNarociloServisProvider">
<plnk:portType name="tns:AsyncNarociloServis"/>
</plnk:role>
<plnk:role name="AsyncNarociloServisRequestor">
<plnk:portType name="tns:AsyncNarociloServisResponse"/>
</plnk:role>
</plnk:partnerLinkType>
<types>
<xsd:schema>
<xsd:import namespace="http://www.xxx.si/narocilo" schemaLocation="narocilo.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://www.xxx.si/povratnica" schemaLocation="povratnica.xsd"/>
</xsd:schema>
</types>
<message name="obdelajNarociloResponse">
<part name="parameters" element="pov:povratnica"/>
</message>
<message name="obdelajNarocilo">
<part name="parameters" element="nar:narocilo"/>
</message>
<portType name="AsyncNarociloServisResponse">
<operation name="obdelajNarociloOperationResponse">
<input message="tns:obdelajNarociloResponse"/>
</operation>
</portType>
<portType name="AsyncNarociloServis">
<operation name="obdelajNarociloOperation">
<input message="tns:obdelajNarocilo"/>
</operation>
</portType>
<binding name="AsyncNarociloServisResponsePortBinding" type="tns:AsyncNarociloServisResponse">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="obdelajNarociloOperationResponse">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
</binding>
<binding name="AsyncNarociloServisPortBinding" type="tns:AsyncNarociloServis">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="obdelajNarociloOperation">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
</binding>
<service name="AsyncNarociloServisService">
<port name="AsyncNarociloServisPort" binding="tns:AsyncNarociloServisPortBinding">
<soap:address location="http://www.xxx.si:9088/ServicesG/services/AsyncNarociloServisPort"/>
</port>
</service>
</definitions>
编辑:
请求
<S:Header>
<To xmlns="http://www.w3.org/2005/08/addressing">??</To>
<Action xmlns="http://www.w3.org/2005/08/addressing">??</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">uuid:c839d6f4-2c33-4f5b-b001-7ce9869a3aa3</MessageID>
<wsa:ReplyTo xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://84.255.215.133:7101/TestniWS-TestniWS-context-root/AsyncNarociloServisResponseImplPort</wsa:Address>
</wsa:ReplyTo>
</S:Header>
<S:Body>
该怎么做?
答案 0 :(得分:1)
我认为你应该添加一个WS-Adressing标头。 我认为这就是消息所说的内容。
我不知道您用于Web服务调用的框架是什么,但这里是一个使用CXF作为框架的示例:http://cxf.apache.org/docs/ws-addressing.html。
您可以尝试以下内容:
<Action xmlns="http://www.w3.org/2005/08/addressing">http://www.kemofarmacija.si/narocilowsdl:obdelajNarociloOperation</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:8ff3f2f0-6548-4411-8075-98af3cc23a1b</MessageID>
<To xmlns="http://www.w3.org/2005/08/addressing">http://elona2.kemofarmacija.si:9088/ServicesG/services/AsyncNarociloServisPort</To>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>