private boolean appendHandlerName(MessageContext msgContext, String direction)
{
try
{
// Get the payload as Source
LogicalMessageContext logicalContext = (LogicalMessageContext)msgContext;
JAXBContext jaxb = JAXBContext.newInstance(Echo.class.getPackage().getName());
Object payload = logicalContext.getMessage().getPayload(jaxb);
JAXBElement jaxbElement = null;
if (payload instanceof JAXBElement)
{
jaxbElement = (JAXBElement)payload;
payload = jaxbElement.getValue();
}
if (payload instanceof Echo)
{
Echo echo = (Echo)payload;
String value = echo.getString1();
echo.setString1(value + ":" + direction + ":LogicalJAXBHandler");
}
else if (payload instanceof EchoResponse)
{
EchoResponse echo = (EchoResponse)payload;
String value = echo.getResult();
echo.setResult(value + ":" + direction + ":LogicalJAXBHandler");
}
else
{
throw new WebServiceException("Invalid payload type: " + payload);
}
if (jaxbElement != null)
{
jaxbElement.setValue(payload);
payload = jaxbElement;
}
// Set the updated payload
logicalContext.getMessage().setPayload(payload, jaxb);
return true;
}
catch (RuntimeException rte)
{