Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5835

AxisFault(SOAPFault) Constructor with SOAP 1.2 SOAPFault incorrectly propagates FaultCode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.7.4
    • None
    • kernel
    • None

    Description

      If the AxisFault constuctor is used with a SOAP 1.2 SOAPFault representation (containing SOAP12FaultCodeImpl), the fault-code is incorrectly propagated to the new fault MessageContext.

      Original SOAPFault:

      <soapenv:Fault xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
        <soapenv:Code>
          <soapenv:Value>soapenv:Receiver</soapenv:Value>
          <soapenv:SubCode>
            <soapenv:Value xmlns:test="http://www.test.com">test:SOME_CODE</soapenv:Value>
          </soapenv:SubCode>
        </soapenv:Code>
        <soapenv:Reason>
          <soapenv:Text xml:lang="en-US">Exception occurred.</soapenv:Text>
        </soapenv:Reason>
        <soapenv:Detail/>
      </soapenv:Fault>
      

      The result:

      <soapenv:Fault xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
        <soapenv:Code>
          <soapenv:Value/>
          <soapenv:SubCode>
            <soapenv:Value xmlns:test="http://www.test.com">test:SOME_CODE</soapenv:Value>
          </soapenv:SubCode>
        </soapenv:Code>
        <soapenv:Reason>
          <soapenv:Text xml:lang="en-US">Exception occurred.</soapenv:Text>
        </soapenv:Reason>
        <soapenv:Detail/>
      </soapenv:Fault>
      

      NOTE: Here the Code/Value should be "soapenv:Receiver" but is empty.

      Possible/Probable Reason:

      In private static method "MessageContextBuilder.createFaultEnvelope(MessageContext, Throwable)",

      MessageContextBuilder.java
        ...
        else if (axisFault != null) {
          ...
          if (axisFault.getFaultCodeElement() != null) {
            fault.setCode(axisFault.getFaultCodeElement());
            soapFaultCode = axisFault.getFaultCodeElement().getText();               
          } 
      

      If the SOAPFaultCodeElement is SOAP 1.2,

      axisFault.getFaultCodeElement().getText() = null

      . I believe here a check needs to be done on the SOAPFaultCode if SOAP 1.1 or 1.2 and in the event of 1.2 it should be

      soapFaultCode = axisFault.getFaultCodeElement().getValue().getText();

      .

      The result is that in the follow-up code-block the value text is set to an empty string.

      if (context.isSOAP11()) {
        ...
      } else {
        ...
        SOAPFaultValue value = fault.getCode().getValue();
        ...
        OMNamespace namespace = value.getNamespace();
        soapFaultCode = switchNamespacePrefix(soapFaultCode, namespace);
        value.setText(soapFaultCode);
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            JWT007 Jeff Thomas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: