This article reviews an example of creating a Silverlight client and integrating it with WebORB for Java. At the end of the article, you will have a working Silverlight application which makes a remoting invocation of a Java object hosted inside of WebORB. The invoked server-side method runs a database query and returns a result as an instance of java.sql.ResultSet. The Silverlight client receives the response, adapts it to an array of objects, each representing a row in the result set and then renders it in a Silverlight DataGrid component using data binding. The same identical approach can be used to invoke any Java service type supported by WebORB, including EJBs, Spring Beans and 3rd party web services.
Requirements
Download and install WebORB for Java. The installer provides an option for setting up Visual Studio template for developing Silverlight applications with WebORB. Make sure to keep the option selected as shown in the image below:

WebORB for Java can be integrated into any Java EE application server or Servlet Engine. To keep things simple, this article assumes that WebORB is running standalone. However the integration demonstrated in the article does not change when WebORB is deployed in another container.
Open a command prompt window, change the directory to the folder where WebORB is installer and run the following command to start the server:
java -jar weborb.jar
Start Visual Studio 2008 and select File > New > Project. In the New Project window, select Silverlight under Visual C# or Visual Basic. One of the available template is going to be "Silverlight Application with WebORB" as shown in the image below. Select the template, enter a name for the project and click OK. (This article uses the 'SL2Java' project name).

Silverlight application can be loaded into a browser from a web server or the file system. Visual Studio simplifies the deployment and offers a choice of creating a web project which will contain an HTML page referencing your Silverlight application. The popup shown below provides a choice for the configuration. Select the first option as shown in the image below and click OK.

Once the project is created, its structure should be the same as shown in the image below:

The client application will consist of a button and a datagrid. The button's Click event will send a remoting request to a Java object. The datagrid will render data received from the server-side. Double-click Page.xaml and add the following XAML code:
<
UserControlExpand the Page.xaml node in the Solution Explorer and double-click Page.xaml.cs to open up the code view. Since the project is created from a WebORB template, it already includes a sample of making a remoting invocation. Modify the code as shown below (assuming you are developing in C#):
using
System;The code is fairly straight-forward, however, some things may be worth clarifying:
Before running the example, it is important to deploy this and this files into the root of the WebORB for Java web server. The reason is the Silverlight client is loaded from one web server and will send invocation requests to another one. The files must be copied into the webapp folder located in the root of the WebORB for Java installation (see the image below):

Alternatively, the Silverlight client application can be deployed into the WebORB for Java server and thus avoid additional policy files.
Compile and run the Silverlight application. Once it runs, click the "Load Data From Java" button. Silverlight makes a remoting invocation of a java object and renders the received response in the datagrid as shown below:

Download complete Silverlight to Java project.
Occasionally it may be important to understand what goes on between the
client Silverlight application and the server-side objects to diagnose
communication or application logic problems. A special tool which enables
monitoring and debugging of client/server traffic is
RIA AppPuncher. The product
runs a proxy server and visualizes all the requests and responses a client sends
and receives. For a full list of features see the following page:
http://www.themidnightcoders.com/products/ria-apppuncher/debugger-edition.html