Posts tagged "JavaScript"

Creating web applications using HTML5/JavaScript Remoting Client SDK with LiveCycle Data Services

- 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.

  1. 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");
  2. Create a channel set.
    var channelSet = new flex.client.channels.ChannelSet([ channel,amfChannel ]);
  3. Create and initialize a RemoteObject with channelSet and destinationId.
    var remoteObject = new flex.client.rpc.remoting.RemoteObject("EchoService");
    remoteObject.setChannelSet(channelSet);
  4. 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);
    });
  5. 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.

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 5.8/10 (6 votes cast)