axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <dava...@gmail.com>
Subject Re: Question on user exception handling on autogenerated clients
Date Tue, 14 Dec 2004 19:47:21 GMT
pls check the test/wsdl/faults example.

-- dims


On Tue, 14 Dec 2004 10:12:20 -0800, Michael Merz <mmerz@bea.com> wrote:
> Bcc: beehive-dev@incubator.apache.org
> 
> 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();
>             }
>         }
>     }
> 
> 


-- 
Davanum Srinivas - http://webservices.apache.org/~dims/

Mime
View raw message