package import com ak33m rpc xmlrpc XMLRPCObject import mx collections

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package
{
import com.ak33m.rpc.xmlrpc.XMLRPCObject;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ArrayUtil;
public class XmlRpcConnection {
private static var returnedData:ArrayCollection;
private static var endpoint:String = "http://77.127.194.4:8000";
private static var destination:String = "";
private static var service:XMLRPCObject;
public function XmlRpcConnection() {}
public static function main():void {c
service = new XMLRPCObject();
service.endpoint = endpoint;
service.destination = destination;
service.addEventListener(FaultEvent.FAULT, onFault);
service.addEventListener(ResultEvent.RESULT, onResult);
service.makeCall("get_users", null);
}
public static function onResult(event:ResultEvent):void {
returnedData = new ArrayCollection(ArrayUtil.toArray( event.result ));
}
public static function onFault(event:FaultEvent):void {
Alert.show(event.fault.faultString,event.fault.faultCode);
}
}
}