J2ME™ Web Services Demo Application

Java™ 2 Platform, Micro Edition, Wireless Toolkit
Version 2.1

December  2003

 

The J2ME Web Services Demo

The Java™ 2 Platform, Micro Edition (J2METM) Web Services Demo application is an example MIDlet suite that demonstrates how an application can access standard web services. The Wireless Toolkit contains a C stub generator that enables you to use the data in a Web Service Description Language (WSDL) file that is provided specifically for this demo application. You will use the stub generator to generate classes with stub APIs. The stub APIs are used by the Server Script application to look for fabricated news headlines collected from the test Web Service.

Running the Server Script Application

To run the Web Services Demo, follow these steps:

  1. Set the Network Configuration in the Preferences dialog box if you are behind a proxy, otherwise you can skip to Step 2.
    1. Choose Edit -> Preferences and click the Network Configuration tab.
    2. Type the HTTP proxy server and port number in the labeled text fields and click OK.
  2. Press the Open Project button on the KToolBar, select the jsr172demo project, and click Open Project.
  3. Choose Project -> Stub Generator.
    1. Enter the WSDL filename by clicking Browse and selecting the servicescript.wsdl file.
    2. Enter the Output Package name: example.serverscript.connector and click OK.

      The entry is case sensitive so type the output package name as shown.

  4. Press the Build button on the KToolBar.
  5. Press the Run button on the KToolBar when the build has completed.

    The default emulator opens with the Server Script application loaded.

  6. Click the Launch button to start the demo.
  7. Click Yes to okay the use of airtime.
  8. Use the Arrow and Select buttons to choose a news topic.

Example Server Code

Example server code is provided with the Web Services demo (jsr172demo). It is located in the server directory of the demo. Refer to the example batch or shell files to compile and deploy the server code. JavaTM Web Services Developer Pack 1.2 is required for compiling and deploying the server code.