Axis2, SOAP 1.2 SOAP Fault and the Subcode element issue
--------------------------------------------------------
Key: AXIS2-4216
URL: https://issues.apache.org/jira/browse/AXIS2-4216
Project: Axis 2.0 (Axis2)
Issue Type: Bug
Components: kernel
Affects Versions: nightly
Reporter: Dobri Kitipov
Fix For: nightly
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
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.