0 Replies Latest reply on Aug 23, 2011 1:12 AM by oegono

    HTTP service call results in two requests with different urls and headers

    oegono

      Hi,

       

      I am trying to invoke a HTTPService with basic authentication.

      There for i set the headers in my generated service class like this:

       

           /**

           * Override super.init() to provide any initialization customization if needed.

           */

          protected override function preInitializeService():void

          {

              super.preInitializeService();

       

              var encoder:Base64Encoder = new Base64Encoder();

              encoder.insertNewLines = false;

              encoder.encode("foo:bar");

              var credentials:String = encoder.toString();

             _serviceControl.headers ={Authorization:"Basic " + credentials};

       

           for each (var o:Operation in _serviceControl.operationList)

           {

                o.headers = {Authorization:"Basic " + credentials};

           }

              // Initialization customization goes here

          }

       

      When I am using on of my defined operations from the service i get two request in my backend. The first request contains the header, but the second doesn't and a login window pops up in flex. Entering the login information loads the data successfully from the server and populates a list.

      Now i dont want this popup to be shown since i added the adder manually.

       

      The two requests also differ in the urls. While the first is http://root/target, the url from the second request has an ending slash -> http://root/target/

      Trying the second url as url for the operation again results in two request on the server, but this time both have the correct header. In the flex application no

      login dialog and no loaded data is shown.

       

       

      I can not figure out where the second call is done. Can someone help me ?