org.jboss.test.ws.jaxws.samples.dar.generated.reply.DarResponse darResponse = ReplyConverter.convertResponse(response);
String replyTo = asyncRequest.getReplyTo().toURL().toString();
log.info("Response will be sent to: " + replyTo);
QName serviceName = new QName("http://org.jboss.ws/samples/dar", "DarReplyService");
Service service = Service.create(new URL(replyTo + "?wsdl"), serviceName);
DarReplyEndpoint endpoint = (DarReplyEndpoint)service.getPort(DarReplyEndpoint.class);
//setup addressing configuration and properties
((StubExt)endpoint).setConfigName("Standard WSAddressing Client");
((BindingProvider)endpoint).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, replyTo);
AddressingProperties requestProps = AddressingClientUtil.createOneWayProps(WSA_ACTION, replyTo);
requestProps.setMessageID(AddressingClientUtil.createMessageID());
Relationship[] relationships = new Relationship[1];
relationships[0] = new RelationshipImpl(asyncRequest.getMessageId());
requestProps.setRelatesTo(relationships);
((BindingProvider)endpoint).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, requestProps);
endpoint.receive(darResponse);
log.info("Response sent.");
} catch (Exception e) {
e.printStackTrace();
}
}