HTTPService get with parameters

I was trying to put together a simple HTTPService Get service and most of the tutorials online did not work for me, as most of them are get calls without parameters and I needed to pass 2 to 3 arguments with my get call. Below is sample code for my get call.

<mx:HTTPService id="GetMyListing"
        url="{hostname}/rs/client/listing"
        result="handleResult(event)"  method="GET"
        fault="handleFault(event)"
        resultFormat="e4x" showBusyCursor="true"  >
        </mx:HTTPService>

private function getListings():void
{
   var params:Object = new Object;
   params["Input"] = txtInput.text;
   params["Index"] = new String(cmbSample.selectedIndex);
   GetMyListing.send(params);
}

How does this work
When the HTTPService executes it will convert the above call to

http://localhost/rs/client/listing?Input=sometxt&Index=sometxt

This way am not having to do a post call just to send two parameters.

Leave a Reply