[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] connect failed, but xmlrpc faultcode = 0

Cyrille Giquello wrote:


I've got a problem with error and xmlrpc.
When connect() failed because of some reason, the response is a well formatted fault, but the faultCode==0.
What do you think about this ?
It is not compatible with some xmlrpc library that I'm trying but perhaps it is correct with the xmlrpc specification ??

When our XmlRpc server implementation has problems it throws an XmlBlasterException.
The used XmlRpc framework calls xmlBlasterException.toString() which produces the
<value> you have noted below.
I don't think we can influence the <int>0</int> like this.
From reading the spec it seems to be perfectly legal to send a fault code of 0.
The rule is simple: if there is a <fault> tag then we have a problem.

Here is an excerpt from http://www.xmlrpc.org/spec

Can the <fault> struct contain other members than <faultCode> and <faultString>? Is there a global list of faultCodes? (so they can be mapped to distinct exceptions for languages like Python and Java)?

A <fault> struct *may not* contain members other than those specified. This is true for all other structures. We believe the specification is flexible enough so that all reasonable data-transfer needs can be accomodated within the specified structures. If you believe strongly that this is not true, please post a message on the discussion group.

There is no global list of fault codes. It is up to the server implementer, or higher-level standards to specify fault codes.

If you desire the faultCode you can add the following lines to our remote method invocation implementations like:

public String connect(String qos_literal) throws org.apache.xmlrpc.XmlRpcException
try {
... // existing code

  catch (XmlBlasterException e) {
     throw new org.apache.xmlrpc.XmlRpcException(2500, e.getMessage());

We could add some mapping for our ErrorCodes.java to ints like

     internal.*    -> 1000
     resource.*  -> 2000
     communication.*  -> 3000
     user.* -> 9000



here is the dump of the received response :

<?xml version="1.0" encoding="ISO-8859-1"?>
<value>java.lang.Exception: errorCode=user.configuration.maxSession message=#exported Max sessions = 10 exhausted, login denied.</value>