Re: Error reporting other than a fault
John Wilson <[email protected]> Wed, 21 May 2008 15:49:27 +0100
| Newsgroups | gmane.text.xml.rpc.specification |
|---|---|
| Message-ID | <[email protected]> |
On 21 May 2008, at 15:41, Bill Moseley wrote:
> I'm curious how to handle more complex error situations than the
> XML-RPC fault will support. Should I just create and document
> additional response payload elements?
>
> I have an application that has a web interface. I'm now adding
> XML-RPC web service as a second way to access the application.
>
> For serious errors I return a XML-RPC fault code and string. I
> realized a response can have only one fault and no other payload
> (params). An example is an invalid method name.
>
> But, often I need to return multiple errors. For example, a request
> might include a number of input parameters (I use a struct for this)
> and the application validates the parameters. So a login method might
> have a username and a password and the application might need to
> report that the username was too short and the password didn't meet
> the requirements.
>
> So, currently in the response payload I'm returning a "status" that
> indicates success or failure, and upon failure I include an "errors"
> struct that has the parameter names as the keys and a list of one or
> more errors messages associated with that input parameter as the
> value.
>
> So, I'm returning an error but it's not an XML-RPC fault.
>
> Is this an appropriate solution or can you recommend a better
> approach?
That seems exactly the right thing to do.
Please resist trying to "extend" or "improve" the basic XML-RPC
protocol. This just limits the usability of your application.
John Wilson
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xml-rpc/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/xml-rpc/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/