Jan 28th, 2013, 05:00 PM
Exception handling outside a ws-gateway
I have a ws inbound-gateway that receives a message, places it on a message channel.
marshaller="xmlBeansMarshaller" unmarshaller="xmlBeansMarshaller" />
That message is picked up by a service activator and handed to a pojo for processing. When the pojo is finished processing it places the response on the "modifyKeysOutputChannel" channel which send the reply back to the caller.
My question is how to send a proper SOAPFault back when the processing fails. Currently I am doing the following in the pojo:
SOAPFault soapFault = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PRO TOCOL).createFault();
soapFault.setFaultString("Internal server runtime exception");
QName name = new QName("SOAP-ENV:Fault");
Message<SOAPFaultException> errorMessage = null;
SOAPFaultException sfe = new SOAPFaultException(soapFault);
errorMessage = MessageBuilder.withPayload(sfe).build();
This does get a SOAPFault back to the caller but the "detail" tag is missing.
So I have 2 questions:
1. Am I taking the correct approach?
2. Why does the "Detail" tag get stripped from the SOAPFault returned back to the caller?