axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Thomas (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AXIS2-5835) AxisFault(SOAPFault) Constructor with SOAP 1.2 SOAPFault incorrectly propagates FaultCode
Date Sun, 05 Feb 2017 21:02:41 GMT

    [ https://issues.apache.org/jira/browse/AXIS2-5835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15853364#comment-15853364
] 

Jeff Thomas commented on AXIS2-5835:
------------------------------------

After further analysis, the value gets cleared in the case that the MessageContext contains
no Envelope.

{code}
  // defaulting to fault code Receiver, if no message is available
  if (faultCode == null && context.getEnvelope() != null) {
    soapFaultCode = ("".equals(soapFaultCode) || (soapFaultCode == null))
      ? SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" +
        context.getEnvelope().getVersion().getReceiverFaultCode().getLocalPart()
      : soapFaultCode;
  }
{code}

If the MessageContext Envelope is not null, the receiver fault code is obtained (i.e. "soapenv:Receiver");
otherwise, the fault-code is set to the empty string.

> AxisFault(SOAPFault) Constructor with SOAP 1.2 SOAPFault incorrectly propagates FaultCode
> -----------------------------------------------------------------------------------------
>
>                 Key: AXIS2-5835
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5835
>             Project: Axis2
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.7.4
>            Reporter: Jeff Thomas
>             Fix For: 1.7.5
>
>
> 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:
> {code:xml}
> <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>
> {code}
> The result:
> {code:xml}
> <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>
> {code}
> NOTE: Here the Code/Value should be "soapenv:Receiver" but is empty.
> Possible/Probable Reason: (?)
> In private static method "MessageContextBuilder.createFaultEnvelope(MessageContext, Throwable)",

> {code:title=MessageContextBuilder.java|borderStyle=solid}
>   ...
>   else if (axisFault != null) {
>     ...
>     if (axisFault.getFaultCodeElement() != null) {
>       fault.setCode(axisFault.getFaultCodeElement());
>       soapFaultCode = axisFault.getFaultCodeElement().getText();               
>     } 
> {code}
> If the SOAPFaultCodeElement is SOAP 1.2, {code}axisFault.getFaultCodeElement().getText()
= null{code}.  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 {code}soapFaultCode = axisFault.getFaultCodeElement().getValue().getText();{code}.
> The result is that in the follow-up code-block the value text is set to an empty string.
> {code}
> if (context.isSOAP11()) {
>   ...
> } else {
>   ...
>   SOAPFaultValue value = fault.getCode().getValue();
>   ...
>   OMNamespace namespace = value.getNamespace();
>   soapFaultCode = switchNamespacePrefix(soapFaultCode, namespace);
>   value.setText(soapFaultCode);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message