Domanda

Qual è il modo più semplice per estrarre l'eccezione originale da un'eccezione restituita tramite l'implementazione di XML-RPC di Apache?

È stato utile?

Soluzione

Si scopre che ottenere l'eccezione della causa dall'eccezione Apache è quello giusto.

} catch (XmlRpcException rpce) {
    Throwable cause = rpce.getCause();
    if(cause != null) {
        if(cause instanceof ExceptionYouCanHandleException) {
            handler(cause);
        }
        else { throw(cause); }
    }
    else { throw(rpce); }
}

Altri suggerimenti

Secondo il Specifica XML-RPC restituisce l'"errore" nell'xml.

È questa l'"Eccezione" a cui ti riferisci o ti riferisci a un'eccezione Java generata durante la chiamata XML-RPC?

Esempio di guasto

HTTP/1.1 200 OK
Connection: close
Content-Length: 426
Content-Type: text/xml
Date: Fri, 17 Jul 1998 19:55:02 GMT
Server: UserLand Frontier/5.1.2-WinNT

<?xml version="1.0"?>
<methodResponse>
  <fault>
    <value>
      <struct>
      <member>
        <name>faultCode</name>
        <value><int>4</int></value>
      </member>
      <member>
        <name>faultString</name>
        <value>
          <string>Too many parameters.</string>
        </value>
      </member>
      </struct>
    </value>
  </fault>
</methodResponse> 
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top