Hi all, I am new to CXF, I need to handle the Timeout exception. I decreased the timeout to 2 seconds and I am trying to handle the timeout exception.
First I was getting the fault message as below <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Could not send Message.</faultstring> </soap:Fault> </soap:Body> </soap:Envelope> I would need to add detail to it and I have added as below. <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Could not send Message.</faultstring> <detail> <ns3:ServiceException xmlns:ns3="http://XXX/XXX"> <messageId>SVC0001</messageId> <text>Server has timedout</text> <variables>ERR_0006</variables> </ns3:ServiceException> </detail> </soap:Fault> </soap:Body> </soap:Envelope> The above one I manipulated using the FaultOutInterceptor Element elementNs3 = fault.getOrCreateDetail().getOwnerDocument().createElementNS("http://XXX/XXX", "ns3:ServiceException"); Element messageElement = fault.getDetail().getOwnerDocument().createElement("messageId"); messageElement.setTextContent("SVC0001"); Element textElement = fault.getDetail().getOwnerDocument().createElement("text"); textElement.setTextContent("Server has timedout"); Element variableElement = fault.getDetail().getOwnerDocument().createElement("variables"); variableElement.setTextContent("ERR_0006"); fault.getDetail().appendChild(elementNs3).appendChild(messageElement); fault.getDetail().appendChild(elementNs3).appendChild(textElement); fault.getDetail().appendChild(elementNs3).appendChild(variableElement); But I need to add ns2 also in the xml as below (in bold) please can you help me how to do that, or please can you let me know what is the standard way to handle the Timeout exception I don't want to make the 0 (Zero) I need to handle the exception and throw some meaningful message. Please can anyone help me. <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Could not send Message.</faultstring> <detail> <ns3:ServiceException xmlns:ns3="http://XXX/XXX" <b>xmlns=ns2="http://YYY/YYY"*> <messageId>SVC0001</messageId> <text>Server has timedout</text> <variables>ERR_0006</variables> </ns3:ServiceException> </detail> </soap:Fault> </soap:Body> </soap:Envelope> Thanks Brady... -- View this message in context: http://cxf.547215.n5.nabble.com/Fw-Cannot-catch-the-CXF-exception-tp5141485p5735811.html Sent from the cxf-user mailing list archive at Nabble.com.
