How can I unmarshal and handle a SOAP fault in Camel?

Solution Verified - Updated -

Issue

In Camel, how can I catch a SOAP fault and inspect the fault to determine how to handle the error? For instance, if I receive a SOAP fault with the following format, how would I handle the fault and also examine the message's returned FAIL code ?

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <soap:Body>
          <soap:Fault>
             <faultcode>soap:Server</faultcode>
             <faultstring>an expected failure occurred</faultstring>
             <detail>
                <ns2:MessageException xmlns:ns2="http://message.ws.mycxf.examples.redhat.com/">
                   <code>FAIL</code>
                </ns2:MessageException>
             </detail>
          </soap:Fault>
       </soap:Body>
    </soap:Envelope>

Environment

  • Red Hat JBoss Fuse
    • 6.2.x
  • Camel
    • 2.15.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.