By using Prana to create an application context for your Remoting enabled application, you want to achieve two things for maximum flexibility:
- don't compile against services-config.xml
- don't specify destinations on the client
It was with the second goal that I ran into a little issue lately when I was creating an application context for a project that uses BlazeDS. Untill now, I had mostly been using WebORB .Net for Remoting with Flex/AIR and the nice thing is that it offers you a GenericDestination. (AMFPHP offers that too btw) That way, for simple destinations, you don't actually have to specify any destinations in remoting-config.xml. When configuring remote objects on the client, you can set the "destination" property to "GenericDestination" and specify the "source" property. The "source" property then refers to the fully qualified classname of the service you want to invoke.
Here's an example:
-
<object id="myRemoteObject" class="mx.rpc.remoting.mxml.RemoteObject">
-
<property name="destination" value="GenericDestination"/>
-
<property name="endpoint" value="http://localhost/project/weborb.aspx"/>
-
<property name="source" value="com.domain.project.SomeService"/>
-
</object>
It might be interesting to note that there must be a "GenericDestination" defined on the server. So in remoting-config.xml, you would see a destination defined as:
-
<destination id="GenericDestination">
-
<properties>
-
<source>*</source>
-
</properties>
-
</destination>
Opposed to a concrete defined destination like:
-
<destination id="myDestination">
-
<properties>
-
<source>com.domain.project.SomeService</source>
-
</properties>
-
</destination>
The wildcard (*) character is replaced at runtime with the value you specify in the "source" property of the remote object.
Switching to BlazeDS however, there is no GenericDestination available. Hm, ok then let's add one. So, I copy the GenericDestination from my WebORB remoting-config.xml to my BlazeDS remoting-config.xml, change my remote objects to specify the GenericDestination and add the source attribute:
-
<object id="myRemoteObject" class="mx.rpc.remoting.mxml.RemoteObject">
-
<property name="destination" value="GenericDestination"/>
-
<property name="endpoint" value="http://localhost:8400/project/messagebroker/amf"/>
-
<property name="source" value="com.domain.project.SomeService"/>
-
</object>
BlazeDS will be smart enough to support this...I hope...nope! A ClassNotFoundException is thrown. Apparently BlazeDS is looking for a class named "*" and is unable to handle this.
I might have a look at the BlazeDS sources and try to figure out how this functionality could be added. Or has anyone allready done this, or knows a workaround?
Add to Bloglines - Digg This! - del.icio.us - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
Christophe Herreman is a software developer living in Belgium. He's working on high-end Flex and AIR solutions at
September 27th, 2008 at 9:09 am
Not sure that if it’s what you want, but here’s what I’m doing in AS3 with ColdFusion :
private var _endpointUri:String = “http://yourserver/flex2gateway/”;
private var _destination:String = “ColdFusion”;
private var _pathToCFC:String = “pathToYourCFC”;
private var _cs:ChannelSet = new ChannelSet();
private var _customChannel:Channel = new AMFChannel(”my-cfamf”, _endpointUri);
_cs.addChannel(_customChannel);
private var _ro:RemoteObject = new RemoteObject();
_ro.destination = _destination;
_ro.channelSet = _cs;
_ro.source = _pathToCFC:String;
you just have to modify few things I think…
September 27th, 2008 at 9:16 am
Hi Cyril,
it seems like “ColdFusion” is WebORB’s “GenericDestination” in ColdFusion. Is that a destination you defined yourself or is it already available in the remoting-config.xml?
September 27th, 2008 at 12:05 pm
That indeed is the GenericDestination in ColdFusion. It is defined by default.
September 27th, 2008 at 6:04 pm
And what’s wrong with using WebORB for Java, that actually supports the same
GenericDestination out of the box?
September 27th, 2008 at 6:13 pm
@Mark: There’s nothing wrong with WebORB, hehe. We are just bound to certain technologies in this project. I’m curious though in how far Data Management is implemented in WebORB for Java. Is its feature set comparable to that of LCDS?
September 29th, 2008 at 4:45 am
Christophoe, if you look in the flex documentation(http://livedocs.adobe.com/flex/2/langref/mx/rpc/remoting/RemoteObject.html), the remote object source attribute can not be set dynamically for JavaAdapters.
let’s take a step back though. don’t you think it’s better to keep the server class mappings in the server side configuration file? otherwise you have to update and recompile your flex code whenever the server class structure changes…
September 29th, 2008 at 6:05 am
Data Management in WebORB for Java is complete. In my opinion the implementation kicks the one in LCDS’s right in the rear-end. You just have to try it. Still
curious why you have to be bound to certain technologies? Were you paid by a
large company with red logo to use Blaze, hehehe
November 12th, 2008 at 12:10 pm
hi friends,
i am trying to connect the Flex and Struts without JSP using WebORB. if any one have some idea means, please share with me.
thanks
areef
November 12th, 2008 at 12:21 pm
Hi Friend,
in my application, i have layers like EJB -> Struts -> JSP, but i am trying to change the layers like EJB -> Struts -> Flex, with WebORB. i dont like to change the Layers. i dont know how i am going to achieve the Goal. for that i need your suggestion to reach the target, i am expecting your support for this,
thanks
areef
November 19th, 2008 at 4:33 pm
Personally I don’t like the idea of the generic Destination, if I remember correctly (Mark can correct me if I am wrong)
was that a Generic Destination with a * is discouraged in WebORB aswell.
Ries