I'd suggest using some sort of generalized wrapper around your xml
response that your client can inspect to determine if there was an
error on the server side or not.
As a basic example, create a base xml structure that contains three
children: errorCode, errorText, and data. If everything on the server
side goes smoothly and as expected, the errorCode parameter would be
set to zero, the errorText a blank string, and the data parameter
would contain the actual data your client is expecting.
On the other hand, if things go haywire and your PHP code successfully
handles the error, errorCode would be set to some number greater then
zero that indicates an id for that error, errorText would be a brief
description of what went wrong, and data would be null.
The client would get this response via the HTTPService, inspect it
using e4x, and then take the appropriate action depending on the info
provided by the wrapper: i.e. pass on the data if things went as
expected, or handle the error in some way if things went wrong.
An example of a successful request:
<serverResponse>
<errorCode>0</errorCode>
<errorText></errorText>
<data>
<user>
<id>5</id>
<name>Bob Loblaw</name>
<email>[EMAIL PROTECTED]</email>
</user>
</data>
</serverResponse>
Example of a failed request:
<serverResponse>
<errorCode>1</errorCode>
<errorText>No user was found for user id 5.</errorText>
<data></data>
</serverResponse>
Hope this helps!
--- In [email protected], "Jason B" <[EMAIL PROTECTED]> wrote:
>
> ok maybe i missed something?
> i now know this can trigger a fault but how do you handle it if a user
> wants to just send back something other then the binded info?
> like say i am requesting all data for a form but that user doesnt
> exist? How will i tell this to the user? I thought i had to use a
> fault ...No?
>
>
> --- In [email protected], "Tracy Spratt" <tspratt@> wrote:
> >
> > Have your data leave off a closing tag.
> >
> > Tracy
> >
> >
> >
> > ________________________________
> >
> > From: [email protected]
[mailto:[EMAIL PROTECTED] On
> > Behalf Of Jason B
> > Sent: Monday, April 28, 2008 11:19 AM
> > To: [email protected]
> > Subject: [flexcoders] Re: how do you return an XML fault from
> > HTTPService?
> >
> >
> >
> > sorry but im not using Soap im just using HTTPService and on php side
> > returning my own made xml data as the book instructs?
> > yea i do need to test this to verify how a fault will look in flex?
> >
> > How is this not a flex question?
> >
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
> > , "valdhor" <stevedepp@> wrote:
> > >
> > > Not really a Flex question but what are you trying to do? Is
this just
> > > for testing purposes to see what your Flex app will do with a
> > > SoapFault? If so, the easiest way is to invoke a method that
does not
> > > exist.
> > >
> > >
> > > --- In [email protected]
> > <mailto:flexcoders%40yahoogroups.com> , "Jason B" <nospam@> wrote:
> > > >
> > > > how do you return an XML fault from HTTPService?
> > > >
> > > > while i got it working just cannot figure out the xml that
would be
> > > > returned to trigger this?
> > > > no examples for this exist under google
> > > >
> > >
> >
>