JBoss WS CXF cannot render multiple subcodes in a SOAP 1.2 Fault

Solution Verified - Updated -

Issue

  • In the solution "JBoss WS CXF misses Subcode in SOAP 1.2 SOAPFault" Red Hat offers workaround for a SOAP 1.2 SoapFault issue.
  • However, normally you should be able to append multiple subcodes to javax.xml.soap.SOAPFault (via method #appendFaultSubcode), but the workaround is done using org.apache.cxf.binding.soap.SoapFault which has only #setSubCode.
  • The SOAP 1.2 spec allows nested subcodes like so:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <soap:Fault>
      <soap:Code>
        <soap:Value>soap:Receiver</soap:Value>
        <soap:Subcode>
          <soap:Value xmlns:ns1="http://ws.gss.redhat.com/">ns1:Error</soap:Value>
          <soap:Subcode>
            <soap:Value xmlns:ns1="http://ws.gss.redhat.com/">ns1:Failure</soap:Value>
          </soap:Subcode>
        </soap:Subcode>
      </soap:Code>
      <soap:Reason>
        <soap:Text xml:lang="en">Error by Failure</soap:Text>
      </soap:Reason>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
  • How I can keep the behaviour and add more subcodes?

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x
    • 6.0.x
    • 6.1.0
  • JBoss WS CXF stack

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.