You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jack Sprat <re...@yahoo.com.INVALID> on 2014/06/04 15:18:42 UTC
Accessing faultstring in Axis2 client
I have a simple question - how do I access the SOAP faultcode and faultstring in an Axis2 client?
The client code calls the web service operation and returns the response or throws an exception:
try {
stub.getPublication(pub, auth);
}
catch (WebServiceException wse) {
wse.printStackTrace();
}
I need to get the text in the <faultstring> element. How do I do that?
Many thanks.
J
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
Andreas,
Thanks for pointing me in the right direction. Below is what worked for me.
SOAPFault fl = cl.getLastOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE ).getEnvelope().getBody().getFault();
String faultstring = fl.getReason().getText();
Thanks,
J
On Friday, June 6, 2014 11:58 AM, Andreas Veithen <an...@gmail.com> wrote:
In that case, you can use the _getServiceClient() method to get the
ServiceClient. From there you will be able to get to the last
OperationContext and from there to the MessageContext with the
response.
Andreas
On Fri, Jun 6, 2014 at 3:55 PM, Jack Sprat
<re...@yahoo.com.invalid> wrote:
>
> Yes, it does extend the org.apache.axis2.client.Stub class.
>
>
>
> On Friday, June 6, 2014 10:36 AM, Andreas Veithen <an...@gmail.com> wrote:
>
>
> Does it have a _getServiceClient() method (i.e. does it extend
> org.apache.axis2.client.Stub)?
>
> Andreas
>
> On Fri, Jun 6, 2014 at 3:29 PM, Jack Sprat
> <re...@yahoo.com.invalid> 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 <an...@gmail.com> 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
>> <re...@yahoo.com.invalid> 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
>>> <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by Andreas Veithen <an...@gmail.com>.
In that case, you can use the _getServiceClient() method to get the
ServiceClient. From there you will be able to get to the last
OperationContext and from there to the MessageContext with the
response.
Andreas
On Fri, Jun 6, 2014 at 3:55 PM, Jack Sprat
<re...@yahoo.com.invalid> wrote:
>
> Yes, it does extend the org.apache.axis2.client.Stub class.
>
>
>
> On Friday, June 6, 2014 10:36 AM, Andreas Veithen <an...@gmail.com> wrote:
>
>
> Does it have a _getServiceClient() method (i.e. does it extend
> org.apache.axis2.client.Stub)?
>
> Andreas
>
> On Fri, Jun 6, 2014 at 3:29 PM, Jack Sprat
> <re...@yahoo.com.invalid> 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 <an...@gmail.com> 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
>> <re...@yahoo.com.invalid> 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
>>> <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
Andreas,
How do I get the SOAP fault using the ServiceClient?
Thanks,
Todd
On Friday, June 6, 2014 10:56 AM, Jack Sprat <re...@yahoo.com.INVALID> wrote:
Yes, it does extend the org.apache.axis2.client.Stub class.
On Friday, June 6, 2014 10:36 AM, Andreas Veithen <an...@gmail.com> wrote:
Does it have a _getServiceClient() method (i.e. does it extend
org.apache.axis2.client.Stub)?
Andreas
On Fri, Jun 6, 2014 at 3:29 PM, Jack Sprat
<re...@yahoo.com.invalid> 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 <an...@gmail.com> 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
> <re...@yahoo.com.invalid> 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
>> <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
Yes, it does extend the org.apache.axis2.client.Stub class.
On Friday, June 6, 2014 10:36 AM, Andreas Veithen <an...@gmail.com> wrote:
Does it have a _getServiceClient() method (i.e. does it extend
org.apache.axis2.client.Stub)?
Andreas
On Fri, Jun 6, 2014 at 3:29 PM, Jack Sprat
<re...@yahoo.com.invalid> 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 <an...@gmail.com> 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
> <re...@yahoo.com.invalid> 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
>> <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by Andreas Veithen <an...@gmail.com>.
Does it have a _getServiceClient() method (i.e. does it extend
org.apache.axis2.client.Stub)?
Andreas
On Fri, Jun 6, 2014 at 3:29 PM, Jack Sprat
<re...@yahoo.com.invalid> 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 <an...@gmail.com> 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
> <re...@yahoo.com.invalid> 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
>> <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
I am using Axis2 version 1.6.1.
I am not using the ServiceClient class. I was able to get to the fault by manually constructing a SOAPEnvelope object but this is not ideal.
Thanks,
J
On Friday, June 6, 2014 10:35 AM, satyapriya sahoo <sa...@gmail.com> wrote:
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 <re...@yahoo.com.invalid> 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 <an...@gmail.com> 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
><re...@yahoo.com.invalid> 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
>> <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
>For additional commands, e-mail: java-user-help@axis.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>For additional commands, e-mail: java-user-help@axis.apache.org
>
>
Re: Accessing faultstring in Axis2 client
Posted by satyapriya sahoo <sa...@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 <re...@yahoo.com.invalid>
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 <
> andreas.veithen@gmail.com> 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
> <re...@yahoo.com.invalid> 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
> > <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
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 <an...@gmail.com> 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
<re...@yahoo.com.invalid> 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
> <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by Andreas Veithen <an...@gmail.com>.
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
<re...@yahoo.com.invalid> 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
> <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
Thanks for the reply but, again, the AxisFault is not available here. Here is the code snippet again.
try{
stub.getPublication(pub, auth);
} catch(PublicationException pe) {
// AxisFault is not available here!
}
Thanks,
J
On Friday, June 6, 2014 6:30 AM, satyapriya sahoo <sa...@gmail.com> wrote:
I think the bellow code will help you.
try{
//Client code
}catch(AxisFault af){
if(af!=null){
RemoteException re = af;
Throwable th = re.detail;
String faultMsg = th.toString();
System.out.println("FaultString :: "+faultMsg );
}
}
I know this is not easy, may bellow methods help to solve your problem
af.getFaultAction()
af.getFaultRole()
af.getMessage()
af.getReason()
Thanks,
Satya
On Thu, Jun 5, 2014 at 7:13 PM, Jack Sprat <re...@yahoo.com.invalid> 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 <sa...@gmail.com> 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: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Accessing faultstring in Axis2 client
Posted by satyapriya sahoo <sa...@gmail.com>.
I think the bellow code will help you.
try{
//Client code
}catch(AxisFault af){
if(af!=null){
* RemoteException re = af;*
* Throwable th = re.detail;*
* String faultMsg = th.toString();*
System.out.println("FaultString :: "+faultMsg );
}
}
I know this is not easy, may bellow methods help to solve your problem
af.getFaultAction()
af.getFaultRole()
af.getMessage()
af.getReason()
Thanks,
Satya
On Thu, Jun 5, 2014 at 7:13 PM, Jack Sprat <re...@yahoo.com.invalid>
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 <
> sahoo.satyapriya@gmail.com> 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
>
>
>
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
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 <sa...@gmail.com> 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
Re: Accessing faultstring in Axis2 client
Posted by satyapriya sahoo <sa...@gmail.com>.
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
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
If only it where that easy. :) This is the question - how do I get access to the fault itself? The client code makes the request and returns a successful response (Publication object) or an exception. The exception is in the <detail> element of the SOAP fault. I need to get the faultstring. Below is what the fault looks like.
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>This is the error message I need to get.</faultstring>
<detail>
<PubException xmlns="http:tempuri.org" />
</detail>
</soap:Fault>
Thanks,
J
On Wednesday, June 4, 2014 3:42 PM, Martin Gainty <mg...@hotmail.com> wrote:
//assume you have access to soapFault
String text = soapFault.getFaultString();
M-
________________________________
Date: Wed, 4 Jun 2014 11:34:10 -0700
From: rexclaimer2@yahoo.com.INVALID
Subject: Re: Accessing faultstring in Axis2 client
To: java-user@axis.apache.org
The AxisFault class is not available here. If so, it would be trivial. Only the defined response OR an exception is returned (see code below). Is there any way to get the faultstring?
Thanks,
J
On Wednesday, June 4, 2014 11:19 AM, Martin Gainty <mg...@hotmail.com> wrote:
AxisFault.java
/**
* Dump the fault info to the log at debug level.
*/
public void dump() {
log.debug(dumpToString());
}
/**
* turn the fault and details into a string, with XML escaping.
* subclassers: for security (cross-site-scripting) reasons,
* escape everything that could contain caller-supplied data.
* @return stringified fault details
*/
public String dumpToString()
> Date: Wed, 4 Jun 2014 06:18:42 -0700
> From: rexclaimer2@yahoo.com.INVALID
> Subject: Accessing faultstring in Axis2 client
> To: java-user@axis.apache.org
>
> I have a simple question - how do I access the SOAP faultcode and faultstring in an Axis2 client?
>
> The client code calls the web service operation and returns the response or throws an exception:
>
> try {
> stub.getPublication(pub, auth);
> }
> catch (WebServiceException wse) {
> wse.printStackTrace();
> }
>
> I need to get the text in the
<faultstring> element. How do I do that?
>
> Many thanks.
> J
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
RE: Accessing faultstring in Axis2 client
Posted by Martin Gainty <mg...@hotmail.com>.
//assume you have access to soapFault
String text = soapFault.getFaultString();
M-
Date: Wed, 4 Jun 2014 11:34:10 -0700
From: rexclaimer2@yahoo.com.INVALID
Subject: Re: Accessing faultstring in Axis2 client
To: java-user@axis.apache.org
The AxisFault class is not available here. If so, it would be trivial. Only the defined response OR an exception is returned (see code below). Is there any way to get the faultstring? Thanks,J
On Wednesday, June 4, 2014 11:19 AM, Martin Gainty <mg...@hotmail.com> wrote:
AxisFault.java/** * Dump the fault info to the log at debug level. */ public void dump() { log.debug(dumpToString()); } /** * turn the fault and details into a string, with XML escaping. * subclassers: for security (cross-site-scripting) reasons, * escape everything that could contain caller-supplied data. * @return stringified fault details */ public String dumpToString()> Date: Wed, 4 Jun 2014 06:18:42 -0700> From: rexclaimer2@yahoo.com.INVALID> Subject: Accessing faultstring in Axis2 client> To: java-user@axis.apache.org> > I have a simple question - how do I access the SOAP faultcode and faultstring in an Axis2 client?> > The client code calls the web service operation and returns the response or throws an exception:> > try {> stub.getPublication(pub, auth);> }> catch (WebServiceException wse) {> wse.printStackTrace();> }> > I need to get the text in the
<faultstring> element. How do I do that?> > Many thanks.> J>
Re: Accessing faultstring in Axis2 client
Posted by Jack Sprat <re...@yahoo.com.INVALID>.
The AxisFault class is not available here. If so, it would be trivial. Only the defined response OR an exception is returned (see code below). Is there any way to get the faultstring?
Thanks,
J
On Wednesday, June 4, 2014 11:19 AM, Martin Gainty <mg...@hotmail.com> wrote:
AxisFault.java
/**
* Dump the fault info to the log at debug level.
*/
public void dump() {
log.debug(dumpToString());
}
/**
* turn the fault and details into a string, with XML escaping.
* subclassers: for security (cross-site-scripting) reasons,
* escape everything that could contain caller-supplied data.
* @return stringified fault details
*/
public String dumpToString()
> Date: Wed, 4 Jun 2014 06:18:42 -0700
> From: rexclaimer2@yahoo.com.INVALID
> Subject: Accessing faultstring in Axis2 client
> To: java-user@axis.apache.org
>
> I have a simple question - how do I access the SOAP faultcode and faultstring in an Axis2 client?
>
> The client code calls the web service operation and returns the response or throws an exception:
>
> try {
> stub.getPublication(pub, auth);
> }
> catch (WebServiceException wse) {
> wse.printStackTrace();
> }
>
> I need to get the text in the <faultstring> element. How do I do that?
>
> Many thanks.
> J
>
RE: Accessing faultstring in Axis2 client
Posted by Martin Gainty <mg...@hotmail.com>.
AxisFault.java
/**
* Dump the fault info to the log at debug level.
*/
public void dump() {
log.debug(dumpToString());
}
/**
* turn the fault and details into a string, with XML escaping.
* subclassers: for security (cross-site-scripting) reasons,
* escape everything that could contain caller-supplied data.
* @return stringified fault details
*/
public String dumpToString()
> Date: Wed, 4 Jun 2014 06:18:42 -0700
> From: rexclaimer2@yahoo.com.INVALID
> Subject: Accessing faultstring in Axis2 client
> To: java-user@axis.apache.org
>
> I have a simple question - how do I access the SOAP faultcode and faultstring in an Axis2 client?
>
> The client code calls the web service operation and returns the response or throws an exception:
>
> try {
> stub.getPublication(pub, auth);
> }
> catch (WebServiceException wse) {
> wse.printStackTrace();
> }
>
> I need to get the text in the <faultstring> element. How do I do that?
>
> Many thanks.
> J
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>