When I try your code and check it with Charles
(http://www.charlesproxy.com) the method is GET and the URL is
http://my.url/service?params=%5Bobject%20Object%5D&method=getMessage&pre\
feredMainTextPartTypes=%5Bobject%20Object%5D

I have no idea how you would get the data in this situation as Flex
sends [object Object] as the parameters. If I were you I would add a
function to serialize the data before it is sent:

             private function sendTheData():void
             {
                 var theURL:String = "http://my.url/service?";;
                 for(var key:Object in params)
                 {
                     theURL += key.toString() + "=" +
params[key].toString() + "&";
                 }
                 jsonRequest2.url = theURL;
                 jsonRequest2.send();
             }

As an aside, if you need to send both GET and POST parameters, set the
service to POST and add the GET parameters to the url property of the
HTTPService.

To send objects I would recommend using RemoteObjects.


--- In flexcoders@yahoogroups.com, "Reto M. Kiefer" <[EMAIL PROTECTED]>
wrote:
>
> Dear all,
>
> I need to call an HTTPService with POST method but I need to transfer
> some GET parameters too. The tricky part ist, that the GET parameters
> are transmitted as arrays.
>
> Can anyone help me in order to build the correct HTTPService?
>
> Currently I am using this code but this one sends everything as POST
> params to the service:
>
>  <mx:HTTPService
>   method="GET"
>   id="jsonRequest2"
>   resultFormat="text"
>   showBusyCursor="true"
>   result="handleResult(event)"
>   url="http://my.url/service";
>   >
>    <mx:request>
>     <method>getMessage</method>
>     <params>{params}</params> <!-- Should be GET -->
>     <preferedMainTextPartTypes>{mainTypes}</preferedMainTextPartTypes>
> <!-- Should be GET -->
>    </mx:request>
>
>  </mx:HTTPService>
>
> The params are built in this way:
>
>  [Bindable]
>  private var params:Object = {folder:"INBOX.Drafts",
> getHeaderFields:1, mainTextPartProcessing:"html", uid:1592};
>  [Bindable]
>  private var mainTypes:Object = {0:"html", 1:"plain"};
>
> Any help highly appreciated!
>
> Thanks in advance
>
> Reto
>

Reply via email to