Hi, Michael.
Handling service-specific exception is implemented in Axis.
In the generated code,
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {new java.lang.Integer(in0)});
if (_resp instanceof java.rmi.RemoteException) { throw (java.rmi.RemoteException)_resp; } else {
AFAIK, _call.invoke() returns RemoteException (AxisFault) for propagated soap fault (server-side exception).
But Axis's implementation lacks of JAX-RPC 1.1 compatibility.
The generated exception classes are derived classes of AxisFault and require default constructor and setters which are not required in JAX-RPC 1.1.
I guess this causes some problem.
If you use JAX-RPC 1.1 compliant exception classes (which have not default constructor and setter methods) in the client side, the deserialization of SOAP Fault message would fail.
I will add other comments in JIRA BEEHIVE-133.
/Jongjin
From: "Michael Merz" <[EMAIL PROTECTED]> Reply-To: "Beehive Developers" <[email protected]> To: <[email protected]> CC: <[EMAIL PROTECTED]> Subject: Question on user exception handling on autogenerated clients Date: Tue, 14 Dec 2004 10:12:20 -0800
Bcc: [email protected]
I'm autogenerating my clients using the wsdl2java ant task. It's working really well.
One question regarding exception handling, though: When the server throws a custom exception (subclass of java.lang.Exception), how does the autogenerated client propagate the results in the response to the caller? I had a look at the generated code and couldn't find any hooks (see below). Is this not yet implemented? Thanks much.
Cheers,
-michael
public int throwFooException(int in0) throws java.rmi.RemoteException, org.apache.beehive.wsm.test.rpclit.FooException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.setOperation(_operations[0]); _call.setUseSOAPAction(true); _call.setSOAPActionURI(""); _call.setEncodingStyle(null); _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS ); _call.setOperationName(new javax.xml.namespace.QName("http://rpclit.test.wsm.beehive.apache.org", "throwFooException"));
setRequestHeaders(_call); setAttachments(_call); java.lang.Object _resp = _call.invoke(new java.lang.Object[] {new java.lang.Integer(in0)});
if (_resp instanceof java.rmi.RemoteException) { throw (java.rmi.RemoteException)_resp; } else { extractAttachments(_call); try { return ((java.lang.Integer) _resp).intValue(); } catch (java.lang.Exception _exception) { return ((java.lang.Integer) org.apache.axis.utils.JavaUtils.convert(_resp, int.class)).intValue(); } } }
