camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yuncil <>
Subject create SOAP-Fault with exception message included
Date Tue, 20 May 2014 14:57:39 GMT

in my camel-route i want to send a soap-fault as response in case of
exception. My Problem is i don't know how to create a SOAP-Fault using the
SOAPJaxbDataFormat. Currently i use this code:

private class ExceptionResponse implements Processor {

        public void process(Exchange exchange) throws Exception {

        //Jaxbclass with 3 elements
        MyResponse response = new MyResponse();

            try {

                Throwable caused =
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
                SoapJaxbDataFormat soap = new
                OutputStream out = new ByteArrayOutputStream();
                soap.marshal(exchange, response, out);
      "SOAP-MSG: " + out.toString());
            catch (Exception e) {
                logger.error("Fehler beim Erstellen der SOAP-Nachricht", e);
            exchange.getOut().setBody(response, MyResponse.class);

Unfortenetly i get a java.lang.NullPointerException here:
soap.marshal(exchange, response, out);

I also don't know how to set the fault-element in a SOAP-Response. 

Anyone an idea? Thanks in advance

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message