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


Reply via email to