Getting Error message after Invoking Web service in case of a HTTP 400 response code

Just written a web service (WEB-API) that returns a 400 error message on bad request.

Together with the response, the server sends an error message like this:

<?xml version="1.0"?>
  <Message>The request is invalid.</Message>
    <serviceRequest.Id>The Id field is required.</serviceRequest.Id>

And I use the flash flex for the UI and use the following event handlers to receive the response.

httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=400 responseURL=null]
status: 400
[HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=400 responseURL=null]

This retrieves the status code = 400 but how to receive the accompanying xml from the web service ?

Any pointers are welcome.


Best practice is to always return status OK (200). Flash is a bit dumb on this and mixing headers with content always makes troubles. Nevertheless if you've embedded it to HTML it also depends on the browser.

So best here would be to return a simple OK status with your error inside, and to just check the data on your Event.COMPLETE handler. If you have error, then it's an error. Just skip the status thing - it will save you time, efforts and sleepless nights :)

Need Your Help

How to call a Win32 API with elevated priviledges on Windows 7

c# .net .net-authorization

We have just discovered that code that calls the Win32 SetDateTime function needs to run in elevated mode in Windows 7, i.e. even when logged in as an administrator, one still has to choose to run ...

cocos2d sprite current postion

iphone objective-c cocoa cocos2d-iphone

Hi I have class that contains CCsprite and Im using that class in the gamelayer to walk around. I wanted to get current position of the Node so I called,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.