Asynchronous binding for AJAX clients in WebORB
One of the features we added in the 2.0 GA release of WebORB is the support for asynchronous object binding for AJAX clients. Previously, the only way to create a client proxy for a server-side object was the webORB.bind() call which is synchronous. As a result, the binding process could freeze the browser for a brief period of time which may not be a desirable effect.
The asynchronous binding uses a separate thread in the browser to create a proxy and delivers the proxy object via callback. Consider the example below. The code binds to the com.foo.Bar object available in a WebORB server at weborbServerUrl.
var className = "com.foo.Bar";
var weborbServerUrl = "http://host:port/weborb";
var async = new Async( gotProxy, failedToBind );
webORB.asyncBind( className, weborbServerUrl, null, null, async );
function gotProxy( proxyObj )
{
// cache proxy object. The proxy object has all the
// same methods as com.foo.Bar
this.proxy = proxyObj;
}
function failedToBind( error )
{
alert( "unable to create proxy. " + error.description );
}
The most important part if the 'async' argument which contains two function references. One is called when the proxy is created, the other is called if an error occurs.
It is recommended to initiate object binding upon successful page loading and chain the execution logic through the binding callbacks.







