I solved a few problems that others may encounter, so here goes:
1. Throwing Exceptions. Well - declaring a @WebMethod to throw an Exception or some
user-defined Exception, extending Exception would cause the
"org.jboss.ws.WSException" described in the first post. I got JBoss 4.0.4.GA to
get past this by declaring "throws Throwable" instead. It works nicely.
2. Actually throwing a useful Exception. Im using a C# console application as test client
since this project will have a
ASP.NET / C# frontend. Error management needed to be
handled using some kind of customized Exceptions since I use arbitrary objects as return
types (various business objects). I took a quick shot at using a generic
"MyResponse" class but that did not work out for various reasons. Ok, back to
throwing "normal" Exceptions. This could be done, but every time, the C# client
would only be able to access the "message" part of any exception, not giving me
enough flexibility. I continued with various kinds of SOAP-like exceptions: SOAPException,
SOAPFaultException from javax.xml.ws, SOAPFaultException javax.xml.rpc and so on, manually
setting the Detail node, Actor, Code and similar stuff.
Nevertheless - each time the C# would only show the message. Accessing the Detail node
would give the C# eq. of NullPointerException.
During all this time I noticed a "strange" thing in my JBoss server.log - a
stacktrace was being printed for each Exception I threw - an EJBException - but I was not
responsible for that stacktrace!
Suddenly I realized something - since the JSR-181 endpoint also is a stateless session EJB
the fine SOAPException Im throwing might get wrapped by the EJB framework. Well - I turned
off container managed transactions using:
@TransactionManagement( value=TransactionManagementType.BEAN)
Now it works as a charm! I can easily access the various parts of the SOAPException in the
C# app.
Well - hopefully this little essay can be helpful to someone.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966020#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...