Question

Hi I am trying to set up remoting in an AIR app.

Does anyone know if I need to define a context-root in the compiler settings. Can't seem to find any articles about setting it up, only in flex.

Thanks

Was it helpful?

Solution

compiler setting looks like:

-services "X:\tomcat\webapps\blazeds\WEB-INF\flex\services-config.xml"

however, if you want AIR to work over http you have to setup it abit different than a webapp. dunno why, but when using a webapp its enough to setup the flex-server on blazeDS or whatver backend you use and than use something like

protected function createData(event:MouseEvent):void
{

 var javaObject : RemoteObject = new RemoteObject("YOUR_CONFIGURED_JAVA_CLASS");

 javaObject.showBusyCursor = true;

 var token : AsyncToken = javaObject.YOUR_JAVA_METHOD();
 token.addResponder(new mx.rpc.Responder(dataResult,handleFault));

}

but when using AIR you HAVE to setup a destination and endpoint, otherwise it will fail to connect and you will end up with and error like

'Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://ain.swf/blazeds/messagebroker/amf''

so, for AIR apps you have add the following

 javaObject.endpoint = "http://IP:PORT/blazeds/messagebroker/amf";
 javaObject.destination = "hello";

where hello again is the config'd java-class you're calling.

hope that helped.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top