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 SP...@scottsdaleins.com on 2008/12/11 17:49:30 UTC

axis2 - creating a customer exception

I have created a custom exception and it is being throw by the web 
service. The exception has two fields and getter and setter methods for 
those fields. Those fields are being set by the service before it throws 
the customer exception.  On the client side, the only exception I am able 
to catch is  AxisFault exception. In that class, I cannot seem to find the 
custom exception I threw, or the fields I set on the custom exception. 

Background: 
I am creating the web service from POJO's and a services.xml file. The 
WSDL is auto generated when I deploy the web service to axis2 inside of 
Tomcat.  Therefore, I have no control over the content of the WSDL. 
I am also using Axis2 to create the client. I am using the wsdl2java 
utility the auto generates the Stub class from the WSDL.  I have googled 
this issue and by all accounts it seems that catching an AxisFault 
exception is what the client should do if using Axis2 to autogenerate the 
stubs from the WSDL. But how do i access the custom exception I threw and 
access the fields I set on the custom exception?   

RE: axis2 - creating a customer exception

Posted by Pär Malmqvist <pa...@hotmail.com>.
I have reported a similar issue a year ago.
https://issues.apache.org/jira/browse/AXIS2-3412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Is anyone trying to solve the JIRA?
Is it a tough one to fix or just lack of time and other priorities?

Regards
Pär Malmqvist






To: axis-user@ws.apache.org
CC: sparaga@scottsdaleins.com
Subject: axis2 - creating a customer exception
From: SPARAGA@scottsdaleins.com
Date: Thu, 11 Dec 2008 09:49:30 -0700





I have created a custom exception and it is being throw by the web service.
The exception has two fields and getter and setter methods for those fields.
Those fields are being set by the service before it throws the customer
exception.  On the client side, the only exception I am able to catch
is  AxisFault exception. In that class, I cannot seem to find the
custom exception I threw, or the fields I set on the custom exception.




Background: 

I am creating the web service from POJO's and a services.xml file. The
WSDL is auto generated when I deploy the web service to axis2 inside of
Tomcat.  Therefore, I have no control over the content of the WSDL.


I am also using Axis2 to create the client. I am using the wsdl2java utility
the auto generates the Stub class from the WSDL.  I have googled this
issue and by all accounts it seems that catching an AxisFault exception
is what the client should do if using Axis2 to autogenerate the stubs from
the WSDL. But how do i access the custom exception I threw and access the
fields I set on the custom exception?   
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline

Re: axis2 - creating a customer exception

Posted by Deepal Jayasinghe <de...@opensource.lk>.

Andrea Spinelli wrote:
> SPARAGA@scottsdaleins.com ha scritto:
>>
>>
>> I have created a custom exception and it is being throw by the web
>> service. The exception has two fields and getter and setter methods
>> for those fields. Those fields are being set by the service before it
>> throws the customer exception.  On the client side, the only
>> exception I am able to catch is  AxisFault exception. In that class,
>> I cannot seem to find the custom exception I threw, or the fields I
>> set on the custom exception.
>>
>> Background:
>> I am creating the web service from POJO's and a services.xml file.
>> The WSDL is auto generated when I deploy the web service to axis2
>> inside of Tomcat.  Therefore, I have no control over the content of
>> the WSDL.
>> I am also using Axis2 to create the client. I am using the wsdl2java
>> utility the auto generates the Stub class from the WSDL.  I have
>> googled this issue and by all accounts it seems that catching an
>> AxisFault exception is what the client should do if using Axis2 to
>> autogenerate the stubs from the WSDL. But how do i access the custom
>> exception I threw and access the fields I set on the custom exception?   
> I would like to point out that in axis1, in the same situation, the
> exception was re-generated at the client side without problems.
>
> As an example, if I have a class
> class A {
>   public b() throws C {
>    ...
>   }
> }
>
> and
> class C extends Exception {
>   public String getFoo() ...
>   public int getBar() ...
>   
> and I use it as the service provider class, i.e. in services.xml I say
>
>     <parameter name="ServiceClass"> A </parameter>
> ... then in the wsdl I should see (without namespaces)
>
>    <operation name="b">
>       <fault message="C" name="C" />
>    </operation>
>
> and if b raises the exception C the output is something like
>
>   <Fault>
>     <faultcode>soapenv:Server.userException</faultcode>
>     <faultstring>...</faultstring>
>     <detail>
>        <C>
>         <foo>foovalue</foo>
>         <bar>42</bar>
>       </C>
>     </detail>
>  ...
> This is what's happening in Axis1.
>
> In axis2 all I get is
>
> <soapenv:Reason 
>    xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
>      <soapenv:Text xml:lang="en-US">
>           ... the error message 
>      </soapenv:Text>
> </soapenv:Reason>
>
>   
> why ???
>
> I see this is a well-known issue
>   https://issues.apache.org/jira/browse/AXIS2-3412
>
> and that the assignee is Deepal. Any news?
>
> If nothing has happened yet, I can try to develop a patch (maybe using
> code from axis1),
That would be great, due to my busy schedule I did not have time to
looking to that issue. If you can submit a path, then that would really
helpful.

Thank you!
Deepal
> but someone in the development team should show some interest.
>
> Hi
> Andrea
>
> -- 
> dott. Andrea Spinelli - IMTeam
> e-mail: andrea dot spinelli at imteam dot it
> phone: +39-035-636029
> fax: +39-035-638129
> www: http://www.imteam.it/
> IANA enterprise number: 1.3.6.1.4.1.30916
>
>   

-- 
Thank you!


http://blogs.deepal.org