You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Jean Philippe DUMAS <je...@reyrey.com> on 2010/02/04 17:35:22 UTC

axiom 1.2.8 - bug concerning SoapFault element population

Hello,

Working recently on a webservice, i have to deal with a reponse Soap 
message that contain SoapFault element
Here is the Soap Fault part of the message :

<e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/"><Header 
xmlns="http://schemas.xmlsoap.org/soap/envelope/">......
<e:Body>
<e:Fault>
<e:faultcode>Client</e:faultcode>
<e:faultstring>Processing Error</e:faultstring>
<e:detail>Error detail message .... </ErrorDetail></e:detail>
</e:Fault>
</e:Body>
</e:Envelope>

With axis 1.5.1 (using axiom 1.2.8), axis generated stub was not able to 
populate  the soapFaultElement correctly.
After more research, I found that it was due to the Qname prefix (e: in 
my example) that axiom was not able to take into account.

Here is a short change I made to the code to resolve it.

class : axiom-impl / 
org.apache.axiom.soap.impl.llom.soap11.SOAP11FaultImpl.java

 public SOAPFaultCode getCode() {
        //return (SOAPFaultCode) 
getFirstChildWithName(SOAP11Constants.QNAME_FAULT_CODE);
        return (SOAPFaultCode)getFirstChildWithName(new             
QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME,getQName().getPrefix()));
    }

    public SOAPFaultReason getReason() {
        //return (SOAPFaultReason) 
getFirstChildWithName(SOAP11Constants.QNAME_FAULT_REASON);
        return (SOAPFaultReason)getFirstChildWithName(new 
QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME,getQName().getPrefix()));
    }


    public SOAPFaultRole getRole() {
        //return (SOAPFaultRole) 
getFirstChildWithName(SOAP11Constants.QNAME_FAULT_ROLE);
        return (SOAPFaultRole)getFirstChildWithName(new 
QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME,getQName().getPrefix()));
    }

    public SOAPFaultDetail getDetail() {
        //return (SOAPFaultDetail) 
getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
        return (SOAPFaultDetail)getFirstChildWithName(new 
QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,getQName().getPrefix()));
    }


To take into account also SOAP V1.2, this change will have to be 
inserted in the corresponding SOAP 1.2 implementation class.
Watch out about a possible regression. I haven't found any but ... I a m 
not an official contributor to the project.

Hope my work will help you to improve Axiom .

Regards

Jean Philippe DUMAS



Re: axiom 1.2.8 - bug concerning SoapFault element population

Posted by Andreas Veithen <an...@gmail.com>.
Jean Phillippe,

Axis2 is not able to the extract the fault information in this case
because the SOAP fault is invalid: the element children of the Fault
element must be unqualified [1].

Andreas

[1] http://www.ws-i.org/Profiles/BasicProfile-1.1.html#R1001

On Thu, Feb 4, 2010 at 17:35, Jean Philippe DUMAS
<je...@reyrey.com> wrote:
> Hello,
>
> Working recently on a webservice, i have to deal with a reponse Soap message
> that contain SoapFault element
> Here is the Soap Fault part of the message :
>
> <e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/"><Header
> xmlns="http://schemas.xmlsoap.org/soap/envelope/">......
> <e:Body>
> <e:Fault>
> <e:faultcode>Client</e:faultcode>
> <e:faultstring>Processing Error</e:faultstring>
> <e:detail>Error detail message .... </ErrorDetail></e:detail>
> </e:Fault>
> </e:Body>
> </e:Envelope>
>
> With axis 1.5.1 (using axiom 1.2.8), axis generated stub was not able to
> populate  the soapFaultElement correctly.
> After more research, I found that it was due to the Qname prefix (e: in my
> example) that axiom was not able to take into account.
>
> Here is a short change I made to the code to resolve it.
>
> class : axiom-impl /
> org.apache.axiom.soap.impl.llom.soap11.SOAP11FaultImpl.java
>
> public SOAPFaultCode getCode() {
>       //return (SOAPFaultCode)
> getFirstChildWithName(SOAP11Constants.QNAME_FAULT_CODE);
>       return (SOAPFaultCode)getFirstChildWithName(new
> QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME,getQName().getPrefix()));
>   }
>
>   public SOAPFaultReason getReason() {
>       //return (SOAPFaultReason)
> getFirstChildWithName(SOAP11Constants.QNAME_FAULT_REASON);
>       return (SOAPFaultReason)getFirstChildWithName(new
> QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME,getQName().getPrefix()));
>   }
>
>
>   public SOAPFaultRole getRole() {
>       //return (SOAPFaultRole)
> getFirstChildWithName(SOAP11Constants.QNAME_FAULT_ROLE);
>       return (SOAPFaultRole)getFirstChildWithName(new
> QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME,getQName().getPrefix()));
>   }
>
>   public SOAPFaultDetail getDetail() {
>       //return (SOAPFaultDetail)
> getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
>       return (SOAPFaultDetail)getFirstChildWithName(new
> QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,getQName().getPrefix()));
>   }
>
>
> To take into account also SOAP V1.2, this change will have to be inserted in
> the corresponding SOAP 1.2 implementation class.
> Watch out about a possible regression. I haven't found any but ... I a m not
> an official contributor to the project.
>
> Hope my work will help you to improve Axiom .
>
> Regards
>
> Jean Philippe DUMAS
>
>
>