{
// TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
ParticipantService service = getParticipantService();
ParticipantPortType port = service.getPort(ParticipantPortType.class);
BindingProvider bindingProvider = (BindingProvider)port;
AttributedURI toUri = addressingProperties.getTo();
List<Handler> customHandlerChain = new ArrayList<Handler>();
/*
* we have to add the JaxWS WSAddressingClientHandler because we cannot specify the WSAddressing feature
*/
customHandlerChain.add(new WSAddressingClientHandler());
/*
* we need to add the coordination context handler in the case where we are passing a
* coordination context via a header element
*/
customHandlerChain.add(new CoordinationContextHandler());
bindingProvider.getBinding().setHandlerChain(customHandlerChain);
Map<String, Object> requestContext = bindingProvider.getRequestContext();
requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addressingProperties);
// jbossws should do this for us . . .
requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addressingProperties);
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, toUri.getURI().toString());
try {
addressingProperties.setAction(builder.newURI(action));
} catch (URISyntaxException use) {
// TODO log this error
}