You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by hervbarr <he...@gmail.com> on 2010/12/14 14:27:00 UTC

Throwing Soap Fault in POJO mode

Hi, 
I have looked to the following documentation :
http://camel.apache.org/cxf.html#CXF-HowtothrowaSOAPFaultfromCamel


I have tried as the documentation says and it works :
from("cxf:bean:myEndpoint")
.setFaultBody(constant(new SoapFault("My Error message",
org.apache.cxf.interceptor.Fault.FAULT_CODE_SERVER)));

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>ERROR message Loading</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

but i have tried the following code:

@Override
    public void configure() throws Exception {
        
        from("cxf:bean:myEndpoint").doTry()
            .process(new Processor() {
            
            @Override
            public void process(Exchange exchange) throws Exception {
                    throw new Exception();
                }
        }).doCatch(Exception.class)
            .setFaultBody(constant(new SoapFault("ERROR message Loading",
org.apache.cxf.interceptor.Fault.FAULT_CODE_SERVER)))
            .end();
    }

In this case, i receive an empty response as it was ok :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body/>
</soap:Envelope>

I would know how to throw these faults in pojo mode (also how can i had my
own details)?

Thanks For Answers



-- 
View this message in context: http://camel.465427.n5.nabble.com/Throwing-Soap-Fault-in-POJO-mode-tp3304556p3304556.html
Sent from the Camel - Users mailing list archive at Nabble.com.