ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Mattler <christoph.matt...@imail.de>
Subject AW: Server side exceptions
Date Thu, 30 Oct 2003 18:06:16 GMT
I solved this problem for me by using my own exception derived from
XmlRpcException.

public class XmlRpcServerException extends XmlRpcException
{
	public XmlRpcServerException(int code, String message)
	{
		super(code, message);
	}

	public String toString()
	{
		if (getCause() != null)
			return getMessage() + " => " + getCause().toString();
		else
			return super.toString();
	}
}

As you can see in XmlRpcResponseProcessor in the method processException()

        // Retrieve XmlRpcException error code(if possible).
        int code = x instanceof XmlRpcException ?
               ((XmlRpcException) x).code : 0;

you can set your own fault codes by throwing Exceptions derived from
XmlRpcException.



-----Ursprungliche Nachricht-----
Von: Tanya Brethour [mailto:brethour@ncsa.uiuc.edu]
Gesendet: Donnerstag, 30. Oktober 2003 17:20
An: xmlrpc-user@ws.apache.org
Betreff: RE: Server side exceptions



> >> And why not re-generating exception by parsing the message exception ?
>
> >Because it almost seems like a hack. I just thought there was probably a
> >more proper way to do it. But maybe there isn't :)
>
> Yes... Exceptions are a java mechanism and xmlrpc must be interoperant
(with
> fault
> codes).

So, how exactly do I specify the fault codes? I use the server to generate
the methodReponse bodies... and there doesn't seem to be a way to control
the fault code part.


Thanks,
Tanya


Mime
View raw message