public static void sendAsyncResponse(final SoapUtil soapFragrance,
final XmlElement responseMessage, final WsaMessageInformationHeaders requestWsaHeaders,
final boolean fault, ApplicationGlobalContext configuration) throws GfacException {
XmlDocument responseEnvelope = soapFragrance.wrapBodyContent(responseMessage);
WsaMessageInformationHeaders responseWsaHeaders = new WsaMessageInformationHeaders(
responseEnvelope);
// if the response message is a fault message, send it to
// faultTo instead of replyTo
if (!fault) {
responseWsaHeaders.explodeEndpointReference(requestWsaHeaders.getReplyTo());
} else {
if (requestWsaHeaders.getFaultTo() != null) {
responseWsaHeaders.explodeEndpointReference(requestWsaHeaders.getFaultTo());
} else {
responseWsaHeaders.explodeEndpointReference(requestWsaHeaders.getReplyTo());
}
}
URI messageId = requestWsaHeaders.getMessageId();
if (messageId != null) {
responseWsaHeaders.addRelatesTo(new WsaRelatesTo(requestWsaHeaders.getMessageId()));
}
String targetAddress = requestWsaHeaders.getReplyTo().getAddress().toString();
if(targetAddress.startsWith("https")){
logger.info("Using http url "+ targetAddress);
responseWsaHeaders.setAction(requestWsaHeaders.getAction());
HttpDynamicInfosetInvoker invoker = CredentialsUtils.createSecureInvoker(configuration);
invoker.setLocation(targetAddress);
invoker.invokeXml(responseEnvelope);
}else{
WsaInvoker invoker = new WsaInvoker();