axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TMG <...@nc.rr.com>
Subject Re: Question on user exception handling on autogenerated clients
Date Tue, 14 Dec 2004 19:58:19 GMT
Michael,

The server services throw a RemoteException, that's what you "catch" in 
the client.  If a handler, either before or after the service is called, 
throws an exception, it is usually an AxisFault.

Tom Gordon

Michael Merz 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();
>            }
>        }
>    }
>
>
>  
>


Mime
View raw message