3 Replies Latest reply on Oct 26, 2010 9:27 PM by thePlatypus

    HTTPService Not Sending Parameter



      I’m entirely new to Flex/Flash programming; however, am familiar enough with OOP. I am using Flex 4 for this project.


      I’m running into a problem passing a parameter to an aspx file using HTTPService. I’ve tested the aspx file in a browser (which outputs xml data) and it works perfectly fine with results displaying as expected. The function that I’m using to call my data is used in the application tag as “creationComplete”.



      For some reason the following does not send a parameter…


      private function init():void {

                  var params:Object = {};

                  params["act"] = "GetAll";




      …instead this code sends a request to the page and gets the output I provided for sending no parameter (which is nothing; no xml). Thus a blank datagrid!



      However, after some Googling around I found other methods of adding a parameter and stumbled upon this method…


      private function init():void {

                  httpServ.url = "http://localhost/awesomedir/FreeServ.aspx" + "?" + "act=GetAll";




      This works like a charm. Absolutely perfect… I get the xml data into my datagrid.


      I’d really like to get the first approach working as well as the approach I’ve seen where params["act"] = "GetAll"; becomes params.act = “GetAll”; but I didn’t have any luck with that either. Anyone know why sending the params object would fail?

        • 1. Re: HTTPService Not Sending Parameter
          rtalton Level 4

          I think it depends on the code in your aspx page. I have no problems sending objects to .NET web services.

          Perhaps your back-end code is expecting url parameters instead of actual parameters?

          • 2. Re: HTTPService Not Sending Parameter
            Devtron Level 3

            My initial guess would be that the parameters are not spelled  correctly. Always double check that in FLEX because it will never warn  you about that. It will either work or it wont and its up to you to  figure out you mis-spelled something! (just a heads up there).


            Your code looks fine. The only difference I see with mine is that I use result events for my HTTPService objects, like this:


                    <s:HTTPService id="httpSRV" url="http://www.myURL.org:8060/BusinessStuff/WSDLName.asmx/WebServiceNameHere"/>
                    <s:CallResponder id="getHTTPSRVResult" result="getHTTPSRVResult_resultHandler(event)"/>


                     getHTTPSRVResult.token = httpSRV.send(params);



            I am unsure if it requires a token for parameters to work in that fashion. Give it try, you never know. I do not believe it will fix your problem, but it could. My guess is something is wrong with the ASPX page...


            BTW, welcome to FLEX and to this online community. I have been programming in FLEX for 3 months, so I understand your pain(s).

            1 person found this helpful
            • 3. Re: HTTPService Not Sending Parameter
              thePlatypus Level 1

              In response to rtalton:


              You were correct. My inexperience with aspx lead me to use Request.QueryString which as I demonstrated works fine for concatenating url string; however, to use the other methods I needed to utilize Request.Form(‘varName”). Information for this found from… http://msdn.microsoft.com/en-us/library/system.web.httprequest.aspx



              In response to Devtron:


              Thank you for your greeting to the forum, and I think I’ll look into your usage of the HTTPService with a CallResponder. I haven’t read through all of Adobe’s documentation “Using Flex 4” yet, so I haven’t seen the CallResponder tag used.



              Thanks both of you, for your assistance.