Re: Accessing faultstring in Axis2 client

satyapriya sahoo <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <CAEp0eHMnf_5URdxoW6P-8ChKqTJe3nNQcDeR2LEhCwVnLZ8RGw@mail.gmail.com>
What version of Axis2 you are using.  What ever code I have given is the
working code only. I am using axis2-1.5.1. The axis fault belongs to bellow
package
org.apache.axis2.AxisFault

Thanks,
Satya




On Fri, Jun 6, 2014 at 7:59 PM, Jack Sprat <[email protected]>
wrote:

> Andreas,
>
> Thanks very much for the reply.  I don't see any methods in the stub class
> to get the message context.  There are many "toOM" methods that convert an
> object to an OMElement object.
>
> I am using XMLBeans binding.
>
> Thanks,
> J
>
>
> On Friday, June 6, 2014 8:10 AM, Andreas Veithen <
> [email protected]> wrote:
> IIRC, the stub has a method to access the (last) message context. From
> there you should be able to get to the response message and extract
> the SOAP fault.
>
> Andreas
>
>
>
>
> On Thu, Jun 5, 2014 at 2:43 PM, Jack Sprat
> <[email protected]> wrote:
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
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.