Java Reference
In-Depth Information
Explicitly Enabling Addressing on the Client
Problem
You want to invoke a service that declares it uses addressing.
Solution
You don't need to do anything, as the JAX-WS runtime can determine that the WSDL advert-
ises that it uses addressing based on the presence of the <wsaw:UsingAddressing/> element
in the binding section of the wsdl:definitions .
Create an instance of javax.xml.ws.AddressingFeature , using true as a constructor para-
meter. Then pass this feature instance to the port accessor method on the service stub you got
from wsimport (or its equivalent). The code to do so looks like this:
new MyImplService().getMyImplPort(
new javax.xml.ws.AddressingFeature(true)
);
Discussion
The JAX-WS 2.1 specification indicates that clients must explicitly enable addressing in order
to use addressing in a web service that declares support for it. For each invocation, the client
must also explicitly set BindingProvider.SOAPACTION_URI_PROPERTY .
NOTE
If you attempt to invoke a service that specifies that addressing is required and you have not enabled
addressing on the client, you'll get an error message such as this in the SOAP response's Fault
<faultstring> element: “A required header representing a Message Addressing Property is not
present.” You may also get an error that you can read off of a response header that looks like this:
<S:Header>
<FaultDetail xmlns="http://www.w3.org/2005/08/addressing">
<ProblemHeaderQName>
{http://www.w3.org/2005/08/addressing}Action
</ProblemHeaderQName>
</FaultDetail>
</S:Header>
Search WWH ::




Custom Search