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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content