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 ja...@petrobras.com.br on 2003/09/30 13:45:47 UTC
How to map EJB exception tree to AxisFaults
Greetings.
In order to have a service exposed both as an EJB and a web service, I have
succesfully deployes a stateless session bean through Axis. The methods
were mapped correctly, although I will probably have to write a WSDL by
hand -- parameter names were not exported, and there seems to be no way to
export usefull anotations to the WSDL file.
However, I am stuck with a problem I forgot to consider initially. Whenever
I write the service as a simple class, I am able to create AxisFaults (or
an object from some subclass) manually to provide the client with usefull
error codes and messages. In the EJB scenario, how can I map the bean
exception hierarchy to an equivalent SOAPFault tree? All I get by default
are wrapped RemoteExceptions, always inside a Server.userException, which
are almost impossible to distinguish in the client. Something like this:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.rmi.RemoteException: EJB Exception:; nested exception
is:
java.rmi.RemoteException: Cliente não cadastrado
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: AxisFault...
[and the stack trace goes on and on for about more 80 lines]
It doesn't seem reasonable to use AxisFault derivates in the EJB (or does
it)? Will I need to write a response chain handler to somehow change the
wrapped exception into an appropriate AxisFault? Is there any other way to
get this mapping straight without having to write a façade class and deploy
this façade as the service, calling the bean in the back? I was avoiding
exactly this in the first place, trying to have just one code.
I would be thankful for any income from someone which came across a similar
problem in the past.
Cheers.
=============================================
Marcelo Jaccoud Amaral
Petrobras - IT - e-business development
mailto:jaccoud [at] petrobras.com.br
=============================================
There are only 10 kinds of people in the world: those who understand binary
and those who don't.