0 Replies Latest reply on Dec 18, 2010 6:38 AM by MacLeod7222

    Passing header params from HttpService to REST webService Question

    MacLeod7222

      I have a HTTPService that calls a REST webService. The webService expects a couple header params and I'm not sure if I'm passing them correctly. The code snippet below shows how I'm setting the header params. I'm also attaching my crossdomain.xml file. Can someone tell me if I'm setting the header params correctly?

       

      thanks

       

       

       

      HTTPService

       

      <mx:HTTPService id="service" url="https://someURL"
             method="POST" resultFormat="text" result="onResult(event)" fault="onFault(event)">     
      </mx:HTTPService>

       

      Function that sets header params

       

      private function setRequestHeader():void {                              
          service.headers["Authorization"] = "VIP " + myKey;
          service.headers["Content-Type"] = "application/json";
      }

       

      CrossDomain.xml file

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE cross-domain-policy SYSTEM
      "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
      <cross-domain-policy>
          <site-control permitted-cross-domain-policies="master-only"/>
          <allow-access-from domain="*"/>
          <allow-http-request-headers-from domain="*" headers="Authorization, Content-Type"/>
      </cross-domain-policy>