ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexis Midon" <mi...@intalio.com>
Subject Re: binding http errors to REST faults
Date Thu, 04 Sep 2008 20:25:40 GMT
Hi Chris,

Here what ODE does, if the status code is one of those listed in here [1]
(500, 501, etc):

1. check if the operation has at least one fault in its abstract part, and
one fault binding
2. check if the Content-type header describes an xml document [2]
3. check that the body is not empty

If one of these checks fails, a failure will be returned. (In your case,
your operation does not meet requirement #1)

If so far everything is fine, the HTTP response body is parsed into an xml
document. The next step is to find out which fault should be thrown.
The fault is infered from the qname of the response root element, i.e the
fault having a message part matching the root element.
This matching process is exactly the same as for a soap service. Rest & Soap
services share the corresponding code [3].

This whole process is in HttpMethodConverter#parseFault [4]

To recap everything:
i. your wsdl must define a fault for your operation and the corresponding
binding (see [1] to know how to do that)
ii.  there is no way to map a fault to a given status code.

I agree that this should be described in the documentation. todo++ ;)

I hope this answer helps.


[1] http://ode.apache.org/user-guide.html#UserGuide-FaultSupport
[2] org.apache.ode.utils.http.HttpUtils#isXml

[3] org.apache.ode.utils.wsdl.WsdlUtils#inferFault

[4] org.apache.ode.axis2.httpbinding.HttpMethodConverter#parseFault


On Wed, Sep 3, 2008 at 6:16 PM, Chris Taylor <saursoor@yahoo.com> wrote:

> My REST service returns an http 500 status error under certain conditions.
> ODE (version 1.2) fails with the following:
> "Operation has no fault. This 500 error will be considered as a failure."
> I see in the REST binding documentation that:
> "ODE checks that a fault is declared in the WSDL for the current operation
> and that the response body contains the expected XML element then reply with
> a fault ; else reply with a failure."
> but how is this done?  is any fault defined in the REST binding/operation
> sufficient?  if not, or if there's more than one fault defined, how are they
> bound to these http status responses?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message