Running the Calculator Web Service Client

  1. Start the Embedded WebSphere server.

  2. Open another DOS session and go to D:\Pure

  3. Set the PATH and CLASSPATH environment variables. Refer here for how to set these environment variables.

  4. Run the Calculator Web Service client by entering the following command:

    java samples.excelwebservice.Calculator http://localhost:8080/soap/servlet/rpcrouter

    Note If you are running the Embedded WebSphere server on a different host or port, replace localhost and/or 8080 with the appropriate values.

  5. The calculator opens. Try to do a calculation, and you will see that everytime the calculator wants to perform an operation, it contacts the ExcelCalculatorWebService and passes the operands and displays a Working... message at the bottom of its screen. After it receives the result, it displays it on the screen. We intentionally set the visible flag of the Excel COM object to true, so everytime the Calculator Web Service client sends a request to ExcelCalculatorWebService, you will see an instance of the Excel COM object open, and after it performs its job, it disappears. In a real situation we do not need to set the visible flag of this COM object to true.

    The Calculator Web Service client is ready to operate. Click some numbers, then click an operation, and then click some other numbers.

    To see the result, click an operation. You will see an Excel COM object show up for a moment, and then the Calculator displays the result.

    The Calculator displays the result and is ready to perform another operation.

Conclusion

Using J-Integra® Bridge you have enabled a Java Web service client to use the SOAP protocol to interact with Excel and worksheets as a Web service. The example has used Excel to perform some simple operations and retrieve the result from Excel.

Although this is a simple example, it demonstrates the power of the J-Integra® Java-COM Bridge. Remember that you can access Excel on your local or remote Windows computer, or access Excel remotely from a non-Windows computer.