Hi All,

We are using CXF 2.2.3 with Camel 2.0.0 for exposing an end-point on Tomcat
6.0. A requirement is that if incoming request does not have a parameter,
soap fault needs to be thrown.

As the Fault and Out Consolidation has happened in Camel 2.0.0, I am
creating a soap fault and setting it in the Out stream of Exchange inside a
processor.

SOAPMessage msg = null;
            try {
                MessageFactory factory =
MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
                msg = factory.createMessage();
                SOAPBody body = msg.getSOAPBody();
                QName qName = SOAPConstants.SOAP_SENDER_FAULT;
                               
                SOAPFault soapFault = body.addFault(qName, "Test Code");
                Detail detail = soapFault.addDetail();
                detail.setValue("Test Description");
                
                exchange.getOut().setFault(true);
               
exchange.getOut().setHeader(org.apache.cxf.message.Message.RESPONSE_CODE,
new Integer(500));
                exchange.getOut().setBody(body);

            } catch (SOAPException e) {
                e.printStackTrace();
            }

After doing this, I am not getting any exception but the soap fault is also
not getting thrown, instead a Soap Envelope with empty Body is coming as
output.

Any ideas on what could be going wrong in the above?

Thanks,
Himanshu
-- 
View this message in context: 
http://old.nabble.com/Unable-to-throw-Soap-Fault-tp28010828p28010828.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to