- Harpreet Singh, Technical Support @ Adobe
LiveCycle Data Services 4.6 provides a HTML5/JavaScript library that lets you develop client applications that call remoting destinations in Data Services using plain HTML and JavaScript with no Adobe Flash involved.
You can use the JavaScript APIs that do not require compilation against services-config.xml. Remoting only needs destination-to-channel mapping, and the channel information (URL, ID) from services-config.xml. Therefore, instead of compiling against the services-config.xml, you create your own ChannelSet, and assign a component (RemoteObject) before using the component. Alternatively, if your browser supports the HTML5 WebSockets, you can use a WebSocket channel, instead of a RTMP channel in Flash, for real-time communication.
- Set up the channel(s).
var channel = new flex.client.channels.Channel("my-amf","http://localhost:8400/RemotingHtmlLcdsApp/messagebroker/amf");
var amfChannel = new flex.client.channels.Channel("my-nio-amf","http://localhost:2080/nioamf","flex.client.channels.Channel.HttpMode.REGULAR");
var wsChannel = new flex.client.channels.Channel("my-nio-amf-websocket","ws://localhost:2080/nioamfwebsocket"); - Create a channel set.
var channelSet = new flex.client.channels.ChannelSet([ channel,amfChannel ]); - Create and initialize a RemoteObject with channelSet and destinationId.
var remoteObject = new flex.client.rpc.remoting.RemoteObject("EchoService");
remoteObject.setChannelSet(channelSet); - Add the result and fault handlers for the remoteObject.
remoteObject.addEventListener(flex.client.rpc.events.ResultEvent.RESULT, function(resultEvent) {
result = resultEvent.getResult();
alert(result);
});
remoteObject.addEventListener(flex.client.rpc.events.FaultEvent.FAULT, function(faultEvent) {
var fault = faultEvent.getFaultString();
alert(fault);
}); - Make the remoting call and call the disconnect on remoteObject.
remoteObject.invoke("echo");
remoteObject.disconnect();
Download the sample code from here. Access the JavaScript reference here.
