2 Replies Latest reply on Feb 15, 2010 5:14 AM by abaki

    HTTP Service XML Response?

    abaki Level 1

      Hi,

       

      I have implemented an HTTP service to my getXML.php which produces XML output. I used Flash Builder Data Menu to do that, not write services by hand. It created a service packet, and also created an object type as return value( valueObjects). It converts responed XML file into that object type, and user can use that object to access data. However, I want to get XML file directly, I do not want that conversion. I looked at action script codes, and modify operation.resultType but it did not work. Any suggestiontions?

       

                _serviceControl = new HTTPMultiService("http://localhost/XMLprovider/"); 
               var operations:Array = new Array();
               var operation:Operation;  
               var argsArray:Array;       
      
               operation = new Operation(null, "getXML");
               operation.url = "getXML.php";
               operation.method = "GET";
               argsArray = new Array("s");
               operation.argumentNames = argsArray;         
               operation.serializationFilter = serializer0;
               operation.properties = new Object();
               operation.properties["xPath"] = "/";
            operation.resultType = valueObjects.SelectionXML;            
               operations.push(operation);
      
               _serviceControl.operationList = operations;
      

        • 1. Re: HTTP Service XML Response?
          Gaurav P(Adobe) Level 2

          You will need to modify the <Service Name> class.

          You can modify its constructor as:

          package services.srv
          {
              import mx.rpc.http.Operation;

           

          public class Srv extends _Super_Srv
          {
              public function Srv()
              {
                  var operation:Operation = _serviceControl.getOperation("getXML") as Operation;
                  operation.serializationFilter = null;
                  operation.resultFormat = "xml";       
              }

           

                        
          }

           

          }

           

          You can then get the XML from the result event as:

          protected function Operation1Result_resultHandler(event:ResultEvent):void
          {
                          trace((event.result as XMLNode).toString());
          }

          • 2. Re: HTTP Service XML Response?
            abaki Level 1

            thank you for your reply,

             

            I need to study action script quickly, could you please recommened me a tutorial or book...

             

            thx