private void handleResponseOrFault(MessageContext msgContext, boolean isFault)
{
SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
SOAPAddressingProperties inProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
SOAPAddressingProperties outProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
if (outProps == null)
{
// create new response properties
outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION);
}
outProps.initializeAsReply(inProps, isFault);
try
{
// supply the response action
OperationMetaData opMetaData = ((CommonMessageContext)msgContext).getOperationMetaData();
if (!isFault && !opMetaData.isOneWay())
{
AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
if (addrExt != null)
{
outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction()));
}
else
{
log.warn("Unable to resolve replyAction for " + opMetaData.getQName());
}
}
else if (isFault)
{
outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction()));
}
}
catch (URISyntaxException e)
{
log.error("Error setting response action", e);
}
outProps.writeHeaders(soapMessage);
}