I have written a C++ Web Service using gSOAP which will send useful error
messages in the form of SOAP faults. I have a client generated using AXIS
WSDL2Java and I would like to be able to print out the information given in
a SOAP fault, if one occurs.

I have tried accessing this information when an AxisFault is thrown after
calling the service, as so:

try {
//Call to the service
..
} catch(org.apache.axis.AxisFault re) {
   org.w3c.dom.Element[] elements = re.getFaultDetails();
   for(int i=0;i<elements.length;i++)
    System.out.println(elements[i]);
  }

But this doesn't seem to give me the correct output.

I have also tried using the MessageContext class to get the SOAP Message as
follows:

//Call to service
...
} catch(org.apache.axis.AxisFault re) {
    MessageContext mc = MessageContext.getCurrentContext();
    Message m = mc.getResponseMessage();
    System.out.println(m);
}

But getReponseMessage() returns null.

What am I doing wrong? How can I get information from a SOAP fault such as
the faultCode and detail?


Thanks in advance for your help,


Charanpal

Reply via email to