2 Replies Latest reply on Sep 15, 2012 7:45 AM by ferry 77

    How to access SOAP web service with authentication, HTTP basic Authentication

    ferry 77 Level 1

      Dear All

      i use Flash Builder 4.5, flex 4..1, i am developing a flex client to soap webservices hosted over Glassfish 2 Java server, the web services is protected by HTTP Basic Authentication, everythime i run my code , the prombt for username and password show up, i need to pass user name and password through action script, i followed the flollowing (but was for http web service, not soap) but really did not work.

       

      http://stackoverflow.com/questions/490806/http-basic-authentication-with-httpservice-objec ts-in-adobe-flex-air

       

      http://forums.adobe.com/message/4262868

       

       

      private function authAndSend(service:HTTPService):void
      {
             
      var encoder:Base64Encoder = new Base64Encoder();
              encoder
      .insertNewLines = false; // see below for why you need to do this
              encoder
      .encode("someusername:somepassword");

              service
      .headers = {Authorization:"Basic " + encoder.toString()};                                               
              service
      .send();
      }

       

       

      Also i noticed in debug mode, always that WARNNING raised up

       

      Warning: Ignoring 'secure' attribute in policy file from http://fpdownload.adobe.com/pub/swz/crossdomain.xml.  The 'secure' attribute is only permitted in HTTPS and socket policy files.  See http://www.adobe.com/go/strict_policy_files for details.

       

       

       

       

      any idea ?