[email protected] 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),
but someone in the development team should show some interest.
Hi
Andrea
--
dott. Andrea Spinelli - IMTeam
e-mail: [email protected]
phone: +39-035-636029
fax: +39-035-638129
www: http://www.imteam.it/
IANA enterprise number: 1.3.6.1.4.1.30916