The default location of [WEBORB HOME] is /Program Files/WebORB for .NET/4.0/

.NET Service

The server side code for this quick start can be found at the following path in your WebORB installation: [WEBORB HOME]\examples\quickstart\server-side. The directory also includes a compiled assembly (quickstart.dll). You can either compile the code yourself, or use quickstart.dll included with the product distribution. To expose the server-side class as a remoting service through WebORB, the assembly must be copied to the /bin folder of your WebORB installation. Once you deploy the assembly, you can verify that it is recognized by WebORB by opening the WebORB Management Console and selecting the Services tab. The assembly will show up in the ".NET Assemblies" node in the service browser.

WebORB for .NET supports AJAX-based invocations of .NET objects. The product includes a JavaScript library enabling the integration on the client (browser) side. This quick start guide includes a working example in the product distribution at [WEBORB HOME]/examples/quickstart/javascript-ajax.

To enable JavaScript/AJAX to .NET integration, the JavaScript code must import the WebORB client-side library:

<script language="javascript" src="WebORB.js"></script>

The sample client uses the following code to connect to WebORB and perform a remoting (AJAX) invocation:

The webORB.bind() call connects to WebORB and creates the JavaScript proxy for the .NET class identified by the first argument of the call ("weborb.examples.quickstart.ComputerInfoService"). The class must be identified by using full .NET type name (namespace plus class name). The second argument ("weborb.aspx") is a URL for WebORB. In the example above, the URL is a relative URL, as a result, the JavaScript client must be deployed in and loaded from the same virtual directory where WebORB is running. Alternatively, the URL can be an absolute URL if the client is loaded from elsewhere.

Once the JavaScript proxy for a remote class is created, you can use it to execute remote method invocations. The example above shows two ways to invoke remote methods - synchronous and asynchronous. To invoke a remote .NET method, simply invoke it on the proxy object and pass the same arguments the method on the server expects. In the example above, the server-side method signature of getComputerInfo declares one argument - requestID, the JavaScript code sends a corresponding numeric value.

For asynchronous invocations, the code creates an instance of the Async class and specifies the name of the callback function. The callback function is invoked by the WebORB JavaScript library when a response from the remote invocation becomes available.

Deploying and Running the JavaScript Client

To deploy the JavaScript client for the example reviewed in this guide, copy computerinfo.htm into the root of the weborb4 virtual directory (the default location is /Program Files/WebORB for .NET/4.0/). You can run the JavaScript client by opening the following URL: http://localhost/weborb4/computerinfo.htm