2 Replies Latest reply on May 8, 2008 11:48 AM by Mush15

    How to Add request object parameters programmatically

    Level 1
      Hi all,

      I need a little help inspiration.

      I am trying to send an HTTPService with parameters programmatically.
      The request gets sent and the request object seems to have applied the parameters but PHP doesnt receive them.

      What am I doing wrong:

      Here's my service code

      var service:HTTPService = new HTTPService();

      //service.contentType = 'application/xml'
      service.resultFormat = 'e4x';
      service.request.uname = event.uname;
      service.request.pword = event.pword;
      //service.destination = 'DefaultHTTP';
      service.url = 'URL removed';

      service.method = "POST";
      service.addEventListener("result",handle_loginResult);
      service.addEventListener("fault",handle_loginfault);
      service.send();
        • 1. Re: How to Add request object parameters programmatically
          atta707 Level 2
          pass the request attribute/value map to the send() method.


          var service:HTTPService = new HTTPService();

          //service.contentType = 'application/xml'
          service.resultFormat = 'e4x';
          //service.destination = 'DefaultHTTP';
          service.url = 'URL removed';

          service.method = "POST";
          service.addEventListener("result",handle_loginResult);
          service.addEventListener("fault",handle_loginfault);

          var o:Object = new Object();
          o.uname = event.uname;
          o.pword = event.pword;
          service.send(o);
          • 2. Re: How to Add request object parameters programmatically
            Level 1
            Atta Thanks,

            Your suggestion works though I ended up going a different route (I wrote it before seeing your post)


            var service:HTTPService = new HTTPService();

            //service.contentType = "application/xml";
            service.resultFormat = 'e4x';
            service.request.uname = <uname>{event.uname}</uname>;
            service.request.pword = <pword>{event.pword}</pword>;
            //service.destination = 'DefaultHTTP';
            service.url = 'url.removed';

            service.method = "POST";
            service.addEventListener("result",handle_loginResult);
            service.addEventListener("fault",handle_loginfault);
            service.send();