Exit Print View

Java Platform Micro Edition Software Development Kit Version 3.0

Get PDF Book Print View

Document Information

Getting Started

Java ME Platform SDK Features

Using Sample Projects

Creating and Editing Projects

Viewing and Editing Project Properties

Running Projects in the Emulator

Searching the WURFL Device Database

Finding Files in the Multiple User Environment

Profiling Applications

Monitoring Network Traffic

Lightweight UI Toolkit

Security and MIDlet Signing

BD-J Support

CLDC Emulation on a Windows Mobile Device

Installing CLDC Emulation on a Windows Mobile Emulator

On-device Debugging

Command Line Reference


JSR Support

JSR 75: PDA Optional Packages

JSR 82: Bluetooth and OBEX Support

JSR 135: Mobile Media API Support

JSR 172: Web Services Support

Generating Stub Files from WSDL Descriptors

Creating a New Mobile Web Service Client

Running JSR172Demo

JSR 177: Smart Card Security (SATSA)

JSR 179: Location API Support

JSRs 184, 226, and 239: Graphics Capabilities

JSR 205: Wireless Messaging API (WMA) Support

JSR 211: Content Handler API (CHAPI)

JSR 238: Mobile Internationalization API (MIA)

JSR 229: Payment API Support

JSR 256: Mobile Sensor API Support


Creating a New Mobile Web Service Client

This sample procedure creates a new project and adds a web service client. However, you can add a web service client to any MIDP project, it does not have to be new.

  1. Select File > New Project, choose MIDP application, and click Next. Name your project and ensure Create Hello MIDlet is checked. Click Finish.

  2. Right-click on the new project’s Source Packages node and select New > Other.

  3. In the Categories pane select Other, and in the File Types area choose Mobile Webservice Client.

  4. In the Generate J2ME Webservice Stub page:

    Click Finish. The new package appears in Source Packages and includes Shakespeare.java and Shakespeare_Stub.java.

  5. Edit HelloMIDlet.java as follows:

    • At the beginning, add the following import declaration:

      import testws.*

    • Locate the startApp() method and replace its contents with the following code:

      String text;
      Shakespeare s = new Shakespeare_Stub();
          text = s.GetSpeech("Romeo");
      }catch(java.rmi.RemoteException rex)
           text = "error";
      TextBox t = new TextBox("Hello", text, 2048, 0);
  6. Build and run the project. You see a quote from Shakespeare’s Romeo and Juliet on the device screen.

You can vary the above procedure to use a local WSDL file. Open the following web page in a browser:


Save it to a local file. For example, c:\ws\WSShakespeare.wsdl. Follow the procedure above, except at Step 4, specify the local file name.