[This came up a while ago, but I thought I'd promote the link I found that solved my woes.]
The situation: I’m trying to interact with a REST API, via Flex and AIR. Now, I know that the HTTPService class exists in Flex to make it really quick and easy to send and recieve data, but the downside of the HTTPService class is that it assumes a little top much. It assumes for example, that any data you’re trying to send comes in a name/value pair – which my data doesn’t. The REST webservice I’m using requires raw XML data, but the HTTPService class doesn’t do that.
The solution? Well, there’s only one – don’t use the HTTPService class, and code everything yourself. Thankfully, this link I found tells you exactly how to do that, along with examples.
http://tacfug.org/blog/index.cfm/2007/3/26/Flex–Posting-XML-without-using-mxhttpservice-
You can try post raw xml as text by.
var request:HTTPService = new HTTPService();
request.method = “post”;
request.resultFormat = “text”;
request.contentType = “text/xml”;
request.request = xml.toString();
request.send();
Also work with json by setting.
request.contentType = “application/json”;
request.request = JSON.encode(data);
Thanks Wai – that looks like a good solution too.
We use HTTPService for some of our XML POSTs to our RESTful web service. It seems to work fine for us.
somevalue
anothervalue
Oops, it ate my code:
http://pastie.org/520067
Just wanted to say hello all. This is my first post.
I came to learn a lot here.
Hello.
My PC worked slowly, many errors. Help me, please to fix buggs on my computer.
I used Windows XP.
With best regards,
trertance