Re: Accessing faultstring in Axis2 client

Jack Sprat <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <[email protected]>
There is a method in the Exception class named #getFaultMessage.  This returns blank, which is correct since there is no text in the exception.  It would be very easy if this was the answer.
 
I need to get the faultstring.  The faultstring is outside the exception.  See the XML snippet below.
 
I'm working on a different way of sending the request and capturing the response.  There is a lot more coding involved but appears to be the only way to get the faultstring element.
 
Thanks,
J

 


On Thursday, June 5, 2014 2:37 AM, satyapriya sahoo <[email protected]> wrote:
 

Jack,
  
Hope bellow points will help you to solve your Problem.
You can process in 3 ways.


1) IN your client code you need an catch block for AxisFault and U need to retrieve the message from that exception 
try{
  //Client code 
}catch(AxisFault af){
   if(af!=null){
         String faultMsg =  af.getMessage();
         System.out.println("FaultString :: "+faultMsg  ); 
  }
}

2) If it is coming as a string, then you can do some String operation.

3) You can also take the help of dom parser or sax parse to retrieve the specific value, because it is coming as a xml format.


Thanks,
Satya
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.