Error reporting other than a fault
Bill Moseley <[email protected]> Wed, 21 May 2008 07:41:02 -0700
| Newsgroups | gmane.text.xml.rpc.specification |
|---|---|
| Message-ID | <[email protected]> |
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? There's other errors that are not related to a specific input parameter. For example if the login method fails with "Failed to log in". I could return this as an XML-RPC fault string, but it's possible that the application can generate an additional more detailed message along with the generic (e.g. "Your account has expired"). For this I have a "messages" array in the response. (Note that messages can be included on success, too.) Thanks for any suggestions and comments you may have. -- Bill Moseley [email protected] ------------------------------------ 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/