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

Axis2, SOAP 1.2 SOAP Fault and the Subcode element issue

    XMLWordPrintableJSON

Details

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

    Description

      Hi everybody,

      What I have observed is that the Axis2 interpretation of subcodes is not compliant with the SOAP 1.2 spec (ref. http://www.w3.org/TR/soap12-part1/#faultsubcodeelement).

      Currently, if we look into the org.apache.axis2.util.MessageContextBuilder createFaultEnvelope(MessageContext context, Throwable e) method we will see that when List faultSubCodes is iterated the subcode is set to the Code with the following lines:

      SOAPFactory sf = (SOAPFactory)envelope.getOMFactory();
      SOAPFaultSubCode soapFaultSubCode = sf.createSOAPFaultSubCode(fault.getCode());
      SOAPFaultValue saopFaultValue = sf.createSOAPFaultValue(fault.getCode());
      saopFaultValue.setText(faultSubCodeQName);
      soapFaultSubCode.setValue(saopFaultValue);
      fault.getCode().setSubCode(soapFaultSubCode);

      In fact only the first subcode should be added to the fault.getCode() (, or <soapenv:Code>) then every next one should be added to the preceding subcode (,or <soapenv:Subcode> - in other words its parent one subcode).
      I did a fix locally and it works for me. Without the fix every next subcode replaces the previous one appended to the <soapenv:Code>. At the end the last one wins and it is set as the single one subcode to the <soapenv:Code> element.

      Here is a sample of a SOAP 1.2 Fault with two subcodes using the fix. Without the fix the second subcode will replace the one appended to the <soapenv:Code> which is not correct:

      <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
      <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
      <wsa:RelatesTo>urn:uuid:1E5867D19D085C6BCB1231847612132</wsa:RelatesTo>
      </soapenv:Header>
      <soapenv:Body>
      <soapenv:Fault xmlns:axis2ns2="http://www.w3.org/2003/05/soap-envelope">
      <soapenv:Code>
      <soapenv:Value>axis2ns2:Sender</soapenv:Value>
      <soapenv:Subcode>
      <soapenv:Value xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">wsse:MyException</soapenv:Value>
      <soapenv:Subcode>
      <soapenv:Value xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">wsse:InvalidSecurity</soapenv:Value>
      </soapenv:Subcode>
      </soapenv:Subcode>
      </soapenv:Code>
      <soapenv:Reason>
      <soapenv:Text xml:lang="en-US">Cannot load password callback class: com.softwareag.wsstack.pwcb.PasswordPWCBHandler</soapenv:Text>
      </soapenv:Reason>
      <soapenv:Detail/>
      </soapenv:Fault>
      </soapenv:Body>
      </soapenv:Envelope>

      Thank you,
      Dobri

      Attachments

        1. MessageContextBuilder_patch1.patch
          2 kB
          Dobri Emilov Kitipov

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dobri Dobri Emilov Kitipov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: