3 Replies Latest reply on Jul 27, 2006 12:26 PM by ntsiii

    resultFormat="object" in webservice. Flawed or is it me??

    nivla17 Level 1
      <mx:WebService id="getListTargs" wsdl="myurl/dropper.cfc?wsdl" useProxy="false">
      <mx:operation result="testRet();" name="dropRanges" fault="Alert.show(event.fault.message)" resultFormat="object"/>
      </mx:WebService>

      When I get the XML back from that webservice it comes back as a string and not an object. Is something wierd with resultFormat or do I have to do some kind of conversion to get it into an object????
        • 1. Re: resultFormat=&quot;object&quot; in webservice. Flawed or is it me??
          mike2281 Level 1
          The code below is working to populate a class with the values returned from a web service, ofcourse you have to create the class and create the callback function but I believe you have to create the class even with the full blown FDS Java implementation so it's a trivial task.

          This code is all AS, as I personally dont like using the tags.

          These are two load functions in a custom ArrayCollection, so ignore the this. calls as they are just calling super class functions.

          public function LoadAllModules():void
          {
          var ws:WebServices = WebServices.Instance;
          var op:AbstractOperation = ws.Service.getOperation("GetAllModules");
          op.addEventListener("fault", ws.Fault_Callback);
          op.addEventListener("result", this.LoadAllModules_Callback);
          op.send();
          }

          private function LoadAllModules_Callback(result:ResultEvent):void
          {
          this.disableAutoUpdate();
          for (var s:String in result.result)
          {
          var m:MyClass = new MyClass();
          m.ModuleID = result.result[s].ModuleID;
          m.Name = result.result[s].Name;
          m.BaseName = result.result[s].BaseName;
          m.AssemblyName = result.result[s].AssemblyName;
          m.AssemblyNamespace = result.result[s].AssemblyNamespace;
          m.Active = result.result[s].Active;
          m.RemoteFiles = result.result[s].RemoteFiles;
          this.Add(m);
          this.itemUpdated(m);
          }
          this.enableAutoUpdate();
          }
          • 2. Re: resultFormat=&quot;object&quot; in webservice. Flawed or is it me??
            nivla17 Level 1
            But according to the webservice doc ex:

            <mx:WebService id="WS" wsdl=" http://ws.invesbot.com/stockquotes.asmx?WSDL"
            useProxy="true"
            fault="Alert.show(event.fault.faultstring), 'Error'">

            <mx:operation name="GetQuote" resultFormat="object">
            <mx:request>
            <symbol>{stockSymbol.text}</symbol>
            </mx:request>
            </mx:operation>
            </mx:WebService>

            <mx:Panel title="WebService Example" height="75%" width="75%"
            paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">

            <mx:Label width="100%" color="blue"
            text="Enter a stock symbol to obtain a quote."/>

            <mx:TextInput id="stockSymbol" text="ADBE"/>
            <mx:Button label="Get Quote" click="WS.GetQuote.send()"/>

            <mx:Text htmlText="Company: {WS.GetQuote.lastResult.GetQuoteResult.StockQuote.Company}"/>
            <mx:Text htmlText="Current price: ${WS.GetQuote.lastResult.GetQuoteResult.StockQuote.Price}"/>

            </mx:Panel>

            It should automatically convert it to a object.

            Hey adobe WTF?
            • 3. Re: resultFormat=&quot;object&quot; in webservice. Flawed or is it me??
              ntsiii Level 3
              Yes, that is very strange. I will keep investigating and post if I figure anything out.

              Tracy