gpt4 book ai didi

java - 线程 "main"javax.xml.ws.soap.SOAPFaultException : A required header representing a Message Addressing Property is not present 中的异常

转载 作者:行者123 更新时间:2023-11-30 11:55:12 28 4
gpt4 key购买 nike

线程“主”javax.xml.ws.soap.SOAPFaultException 中的异常:表示消息寻址属性的必需 header 不存在

我错过了什么?我以编程方式添加 wdsl-addressing:

wsbp.setOutboundHeaders( new StringHeader(WS_ADDR_VER.messageIDTag, uuid), replyTo.createHeader(WS_ADDR_VER.replyToTag));

我正在使用 jdeveloper 11g

代码:

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>

要参加什么??

最佳答案

我认为您应该添加一个 WS-Adressing header 。我想消息就是这么说的。

我不知道您用于 Web 服务调用的框架是什么,但这里有一个使用 CXF 作为框架的示例:http://cxf.apache.org/docs/ws-addressing.html .

或许可以看看这篇文章:http://log.illsley.org/2006/10/05/a-required-header-representing-a-message-addressing-property-is-not-present/ .

你可以试试这样的:

<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>

关于java - 线程 "main"javax.xml.ws.soap.SOAPFaultException : A required header representing a Message Addressing Property is not present 中的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5142705/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com