I'm not sure if this was intentional, but in the code you've given, the XML needs to be assigned as a string. It lacks the wrapping quotes. Again, I'm not sure if you've done this just to illustrate a point.
And I suggest you use the proxy, If you're not using the proxy, HTTPService uses a flash.net.URLLoader to make the request directly so you're limited to what the player supports.
Also you have 2 'import' keywords in : import import mx.rpc.http.HTTPService;
And you need not instantiate the httpservice object twice. Below is the code that I think would work :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
public function sendXML():void
var myXML:XML = "<ns:account xmlns:ns=\"http://.....\"> <ns:name>test</ns:name> " +
var httpService:HTTPService = new HTTPService();
httpService.url = "http://localhost/restfulservice";
httpService.useProxy = true;
httpService.method = "PUT"; //also tried POST
<!-- calling sendXML by clicking on the button below -->
In the last line you can do
var obj:Object = new Object();
httpService.send( obj );
On the server side get the data from the object and convert the string to XML
Thanks for your replies.As you suggested I used blazeDS proxy and able to send the XML to the restful webservice which I have done this way
var xml:XML = getXMLForNewAccount();
and configured the destintation "carrierAccountsService" in proxy-config file.But I have one more problem
Tried to do the DELETE operation same way which accepts three parameters(id,name and comment) as given below
//Alert.show("params passed are:"+ del_id.text +":"+"currentUser:"+ del_stopComments.text);
Alert.show(params.id); //printing the ID before sending request
But when I checked the logs on the server side DELETE request is invoked but the parameters are being passed as NULL.Can some one help me on this?
I am getting bad request error