0 Replies Latest reply on May 5, 2009 2:41 PM by dsryan

    HTTPService call in AIR app any different than Flex??

    dsryan

      Well, i didnt get any help on a prevous question and haven't fixed my issue as of yet but maybe I can add a few things that i just found out and maybe that'll jar some replies that could help me, so i have an app that uses HTTPService to call to a restful web service and works fine in flex running inside the browser. So i wanted to make an AIR app out of it and i hit the issue below where it looks like the reply is success (200) but the ResultEvent.result is empty, not there! But i do notice that ResultEvent.message is there and contains an empty body and headers that just has "DSStatusCode 200"....so the api docs seem to say this is BlazeDS only type stuff, so is there something i'm missing in as far as setting up a simple httpservice call in AIR as opposed to Flex, because i'm not using BlazeDS on the server or anywhere.

       

      any help or pointers greatly appreciated,

      Dennis

       

      Original Question>>>>

       

      I'm converting a working flex 3 app to an AIR application but a call to a remote service returns with an empty body and I can't figure out why exactly, i thought it had to do with crossdomain policy file issues but the call does go to the server and the server responds correctly but the TraceTarget from my AIR app has an empty body. Like i said, it works fine running in my browser as a flex app. My sandbox type is 'application' which i think is full access. Below is the TraceTarget log from running my app using adl:

       

      Error: [strict] Ignoring policy file at http://localhost:4567/crossdomain.xml due to incorrect syntax.  See http://www.adobe.com/go/strict_policy_files to fix this problem.
      warning: unconverted Bindable metadata in class 'com.adobe.flex.extras.controls.springgraph::Item'
      useHttpService> url: /haml/sc method: GET handler: function Function() {}
      Security.sandboxType>  application
      '84490259-A5A7-BD3E-9BD3-FE1A63291A68' producer set destination to 'DefaultHTTP'.
      'direct_http_channel' channel endpoint set to http:
      '84490259-A5A7-BD3E-9BD3-FE1A63291A68' producer sending message 'E74F7D5F-2A4C-23C5-7AC5-FE1A633C28A9'
      'direct_http_channel' channel sending message:
      (mx.messaging.messages::HTTPRequestMessage)#0
        body = (Object)#1
        clientId = (null)
        contentType = "application/x-www-form-urlencoded"
        destination = "DefaultHTTP"
        headers = (Object)#2
        httpHeaders = (Object)#3
        messageId = "E74F7D5F-2A4C-23C5-7AC5-FE1A633C28A9"
        method = "GET"
        recordHeaders = false
        timestamp = 0
        timeToLive = 0
        url = "http://localhost:4567/haml/sc"
      '84490259-A5A7-BD3E-9BD3-FE1A63291A68' producer connected.
      '84490259-A5A7-BD3E-9BD3-FE1A63291A68' producer acknowledge of 'E74F7D5F-2A4C-23C5-7AC5-FE1A633C28A9'.
      Decoding HTTPService response
      Processing HTTPService response message:
      (mx.messaging.messages::AcknowledgeMessage)#0
        body = ""

        clientId = "DirectHTTPChannel0"
        correlationId = "E74F7D5F-2A4C-23C5-7AC5-FE1A633C28A9"
        destination = ""
        headers = (Object)#1
          DSStatusCode = 200
        messageId = "90A3A51A-2F1D-79A7-F269-FE1A63E19BCC"
        timestamp = 0
        timeToLive = 0

       

      This is the code i'm using to make the call, pretty basic:

      public function useHttpService(parameters:Object, url:String, method:String, format:String, handler:Function, contentTypeAsXML:Boolean=false):void {
             
              trace("useHttpService> url: "+url+" method: "+method+" handler: "+handler);
              trace("Security.sandboxType> "+
      Security.sandboxType);
           
              var service:HTTPService = new HTTPService();
              service.url = PROTOCOL+HOST+url;
              service.method = method;
              if (contentTypeAsXML)
                  service.contentType = "application/xml";
              service.addEventListener(ResultEvent.RESULT, handler);
              service.addEventListener(FaultEvent.FAULT, fault_handler);
              service.showBusyCursor=true;
              if (format == null)
                  service.resultFormat = "object";
              else   
                  service.resultFormat = format;
              service.send(parameters);
          }

      public function searchFor(searchString:String, handler:Function):void {
        useHttpService(null,"/haml/"+searchString, "GET", "e4x", handler);
      }


      Any help or pointers on debugging this would be greatly appreciated!!!

       

      thanks,

      Dennis