2 Replies Latest reply on Sep 17, 2007 3:46 AM by

    XMLRPC.. almost there =)

    skeeeter144
      Alright, so i've got a little something working.. I've figured out how to use actionscript in flash8 to get the data from an xmlrpc service that I want; But, the questioin is.. how do I do this in FLEX?

      Here is the code that I am using:
      [CODE]import com.mattism.http.xmlrpc.Connection;
      import com.mattism.http.xmlrpc.ConnectionImpl;
      import com.mattism.http.xmlrpc.util.XMLRPCDataTypes;

      var SERVICE_URL:String = "https://xmlservice/";

      function postIt(){
      var rpc:Connection = new ConnectionImpl(SERVICE_URL);

      rpc.addParam("user"); // Username
      rpc.addParam("pass"); // Password

      rpc.onLoad = onPostComplete;
      rpc.call('login');
      }

      function onPostComplete(token:String):Void {
      trace("Token: " + token);
      _root.resultbox.text = token;
      _global.token = token;
      }

      function GetTickets(){
      var rpc:Connection = new ConnectionImpl("https://xmlservice/" + _global.token);

      rpc.addParam("Test");
      rpc.call('getTest');
      trace("Using Token: " + _global.token);
      rpc.onload = onLoadListing;
      }

      //Then, I can debug it and see the output.
      onLoadListing = function( response:Array ){
      trace("Found the following objects:");
      var i:Number; for (i=1; i<response.length; i++){
      trace(i+". |"+response .Customer+" | "+response.Status);
      trace(" |"+response .Subject);}
      }; [/CODE]

      Now, just to start off with the basics, I've been messing around with the lesson that's included with FLEX, which looks like this:
      [CODE]
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      creationComplete="feedRequest.send()" layout="absolute">

      <mx:HTTPService
      id="feedRequest"
      url=" http://weblogs.macromedia.com/mchotin/index.xml"
      useProxy="false" />

      <mx:Panel x="10" y="10" width="475" height="400" title="{feedRequest.lastResult.rss.channel.title}">

      <mx:DataGrid id="dgPosts" x="20" y="20" width="400" dataProvider="{feedRequest.lastResult.rss.channel.item}">
      <mx:columns>
      <mx:DataGridColumn headerText="Posts" dataField="title"/>
      <mx:DataGridColumn headerText="Date" dataField="pubDate" width="150" />
      </mx:columns>
      </mx:DataGrid>

      <mx:LinkButton x="20" y="225" label="Read Full Post" click="navigateToURL(new URLRequest(dgPosts.selectedItem.link));"/>

      <mx:TextArea x="20" y="175" width="400" htmlText="{dgPosts.selectedItem.description}" />



      </mx:Panel>

      </mx:Application>[/CODE]

      So basically what I want do do is the same thing, except replace the HTTPService with the array that I get from the xmlrpc, via actionscript.

      Can anyone help me out on how to get this working in FLEX?

      Thanks :)