RemoteObjecting to BlazeDS in Flex
I have a blazeds amf url, which is https://..../afm/MessageBrok. Actually im not sure if it's what is referred to as the amf gateway or what. But basically, how do I do a remoteobject call to a blazeds location, for a servic开发者_开发技巧e/destination and then use it like a web service, without having to set an xml file or anything on the flex side. The BlazeDS side is working fine, but basically, I need to know the code in the mxml file i need to use to get to that...
a) Create your remote object (you can do it from mxml or as):
<mx:RemoteObject id="remoteObject" destination="campaignRemoteServices">
<mx:method name="method1" result="createResult1(event)" fault="createFault1(event)"/>
<mx:method name="method2" result="createResult2(event)" fault="createFault2(event)"/>
<mx:.......
</mx:RemoteObject>
Before doing that you need to know the destination name and the exposed methods.
b) Configure the channels for your remote object:
var channelSet:ChannelSet = new ChannelSet();
var channel:AMFChannel = new AMFChannel("amf", "blazeds amf endpoint , for example http://localhost:8080/myapp/messagebroker/amf");
channelSet.addChannel(channel);
remoteObject.channelSet = channelSet;
c)Invoke the methods:
remoteObject.method1("test");
精彩评论