I wanted to use some amfphp functions in .NET and get access to some objects. After some searching I found a piece an opensource gateway that would do the trick. How to use AMFPHP functions from .NET WPF application?
Ok here is were I am right now , and I could really use some help. After having made the connection and proper calls
public void Connect()
{
// Create NetConnection client
_netConnection = new NetConnection();
_netConnection.ObjectEncoding = ObjectEncoding.AMF0;
_netConnection.NetStatus += new NetStatusHandler(_netConnection_NetStatus);
_netConnection.Connect("http://www.mytestserver.nl/services/gateway");
System.Console.WriteLine("*** Flash RPC ***");
_netConnection.Call("amfphp.mytestserver.getObjects", new GetCustomersHandler(), new object[] { "415" });
System.Console.WriteLine("Press 'Enter' to exit");
}
And in my handler
public class GetCustomersHandler : IPendingServiceCallback
{
public void ResultReceived(IPendingServiceCall call)
{
object result = call.Result;
System.Console.WriteLine("Server response: " + result);
//DataAccess sample sends back an ArrayCollection (AMF3)
ArrayCollection items = result as ArrayCollection;
foreach (object item in items)
{
Flex.CustomerVO customer = item as Flex.CustomerVO;
System.Console.WriteLine(customer.firstname + " " + customer.lastname);
}
}
}
This is the way it is done in the project given in the samples folder. I cannot iterate through the items , so I figured let me see how I can access my results object. And here is were is it (at least for me) getting a bit tricky. I can see the results as type object in my list , I can access the result array (?object) , but how do I iterate through my results objects in code since it is not an array. To clarify I added some screenshots.
http://imageshack.us/f/685/fluorine1.png/ as can be seen here results containing 46 items.
a little more clarification http://imageshack.us/f/38/fluorine2.png/ (For instance I wish to access the Key, Value and such). Does anyone have a solution or approach. It doesn't feel difficult(perhaps it is) but I seem to missing something. Some help anyone?