1 Reply Latest reply on May 9, 2013 1:10 PM by Peter Farland

    capture full httpservice url?

    madhooper Level 1

      is there a simple way to capture the full url (parameters included) when a httpservice is sent?  I'd like to put the url in a variable for later use.

        • 1. Re: capture full httpservice url?
          Peter Farland Level 3

          You could look at the url and body properties on the corresponding HTTPRequestMessage and reconstruct the URL (assuming method="GET"). You can get this message from either the asynchronous completion token returned from calling httpService.send(), or via an InvokeEvent's message property by registering an invoke="invokeHandler(event)" listener on <mx:HTTPService>.


          If you're not using a server side gateway / proxy, the client-side mx.messaging.channels.DirectHTTPChannel is the class that manages the HTTP request. It sets up the query parameters to append to the url in its mx_internal::createURLRequest() method around line 234:


                      var urlVariables:URLVariables = new URLVariables();

                      var body:Object = httpMsg.body;

                      for (var p:String in body)

                          urlVariables[p] = httpMsg.body[p];


                      params = urlVariables.toString();