In some cases the user needs to specify the WS-Addressing headers explicitly. If the user sets any message information headers himself, WSO2 SOA Enablement Server will not overwrite them. The WSO2 SOA Enablement Server for Java implementation of WS-Addressing is accessible through the class org.systinet.wasp.addressing.AddressingHeaders. The user may set addressing headers via this API and then put them into the call context (please see Call Context). For instance, the user is allowed to add his own reference properties to the wsa:FaultTo element. However when he does so, WSO2 SOA Enablement Server for Java does not fill the wsa:FaultTo subelement of wsa:Address. Instead, the user is now responsible for setting the exact address (the URL where the async callback service is published) when creating the wsa:FaultTo header, such as:
addressingHeaders.faultTo = new EndpointReference(address);
See the WS-Addressing specification for more information.
Example 246 shows how to create addressing headers by hand for anonymous invocation, which is the simplest use case. It is possible to use AddressingHeaders with non-anonymous invocation as well.
Example 246. Anonymous Invocation With Handwritten Addressing Headers
EndpointReference to = new EndpointReference(serviceClient); AddressingHeaders addrOut = (AddressingHeaders) callContextData.getCallContext.ADDRESSING_HEADERS_OUTPUT); if (addrOut == null) addrOut = new AddressingHeaders(to); addrOut.messageID = AddressingHeaders.generateUniqueMessageID(); // following line is not needed in ONE-WAY invocation addrOut.replyTo = new EndpointReference(EndpointReference.ANONYMOUS); callContextData.put(CallContext.ADDRESSING_HEADERS_OUTPUT, addrOut);
![]() | Note |
---|---|
For information on how to use WS-Addressing with older versions of WSO2 SOA Enablement Server for Java, please see the WS-Addressing section in Backward Compatibility. |