Deploying the Example in Embedded WebSphere

The IBM WSTK comes with a tool called wsdlgen, which is used to create the XML files needed to publish a Web service. This tool can be used to publish Web services exposed on a Java class, EJB, or COM object. The XML files that are generated by this tool are in standard WSDL (Web service definition language) format and can be used to publish the Web service to any SOAP-compliant application server.

  1. Make sure that jintegra.jar, excel.jar, and excelwebservice.jar files are included in your CLASSPATH by entering the command

    set CLASSPATH=%CLASSPATH%;D:\jintegra\lib\jintegra.jar;d:\Pure\excel.jar;D:\Pure\excelwebservice.jar;
  2. Go to the bin directory of the IBM WSTK installation. Run the WSTK wsdlgen tool by entering the command

    wsdlgen
  3. Select Java Class and click Next.

  4. Enter samples.excelwebservice.ExcelCalculatorWebService as the Class Name.

    Enter D:\pure\ExcelCalculatorWebService.wsdl as the Output Filename.

    Enter ExcelCalculatorWebService as the Service Name.

    Enter urn:excelcalculatorwebservice as the Service URN.

    Enter http://www.excelcalculatorwebservice.com/ExcelCalculatorWebService as the Target Namespace.

    Set the Binding URL, and WSDL URL prefix appropriately. For example, if your Web server is on localhost and listening on port 8080, you should set these values as http://localhost:8080/soap/servlet/rpcrouter, and http://localhost:8080/wsdl, respectively.

  5. Click Next. If you get a message from wsdlgen about not finding the ExcelCalculatorWebService class, or some of the classes accessed by this class, check your CLASSPATH variable. It must be set correctly so that wsdlgen can find all the classes needed to deploy this Web service.

  6. Select double minus(double, double), double plus(double, double), double times(double, double) and double divide(double, double) from the Method Signature list.

  7. Click Next. wsdlgen displays a confirm message. Click Finish.

  8. wsdelgen creates the corresponding descriptor files and displays a message to inform you it has created the files. Click OK.

  9. Although we specified D:\Pure as the output directory, wsdlgen only outputs the wsdl files into that directory. wsdlgen outputs the XML file that we need to deploy the example (DeploymentDescriptor.xml) in the current directory. In our case the current directory is the bin directory of the WSTK installation. Copy DeploymentDescriptor.xml to D:\Pure.

  10. Before you start the Embedded WebSphere, you must set the PATH and CLASSPATH correctly. You must make sure that all .jar files related to SOAP are in your CLASSPATH. Normally, when your run one of the samples that has been shipped with WSTK, it sets the environment variables by calling wstkenv batch file. In our case, we can run this batch file manually. Go to the bin directory of your WSTK installation directory and enter the following command:

    wstkenv
  11. WSTK sets an environment variable called WSTK_CP which contains the path to all jar files related to SOAP server. You can use this environment variable to set the CLASSPATH. While you are in D:\Pure enter the following command to set the CLASSPATH

    set CLASSPATH=%CLASSPATH%;%WSTK_CP%;D:\Pure\excelwebservice.jar;D:\jintegra\lib\jintegra.jar;D:\Pure\excel.jar;
  12. When a program wants to use a COM object, Windows needs to authenticate the client. J-Integra® comes with a native DLL file that performs the authentication on behalf of the client. This DLL is in the bin directory of J-Integra®. You should update the PATH environment variable to include this directory. To update the PATH, enter the command

  13. set PATH=%PATH%;D:\jintegra\bin;
  14. Start the Embedded WebSphere server by entering the command

    start "WebSphere Server" "D:\wstk-2.4\bin\websphere" run

    The Embedded WebSphere starts in a new DOS session window and displays some text. When you see the "HTTP Transport Started" message, your Embedded WebSphere server is ready to respond to requests. To shut down the Embedded WebSphere server, press Ctrl+C.

  15. To deploy the example onto the Embedded WebSphere server, while you are in D:\Pure enter the command

    java org.apache.soap.server.ServiceManagerClient http://localhost:8080/soap/servlet/rpcrouter deploy DeploymentDescriptor.xml

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

  16. If there was no error on running the command, the Excel Calculator Web service is deployed and ready to serve. Proceed to Running the Calculator Web Service Client.