Viewing and Editing Project Properties
Running Projects in the Emulator
Searching the WURFL Device Database
Finding Files in the Multiple User Environment
CLDC Emulation on a Windows Mobile Device
Installing CLDC Emulation on a Windows Mobile Emulator
JSR 82: Bluetooth and OBEX Support
JSR 135: Mobile Media API Support
Generating Stub Files from WSDL Descriptors
JSR 177: Smart Card Security (SATSA)
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)
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.
Select File > New Project, choose MIDP application, and click Next. Name your project and ensure Create Hello MIDlet is checked. Click Finish.
Right-click on the new project’s Source Packages node and select New > Other.
In the Categories pane select Other, and in the File Types area choose Mobile Webservice Client.
In the Generate J2ME Webservice Stub page:
Click Running Web Service and in the WSDL URL field, enter:
In the Package field, enter testws. This is the package name.
Click Finish. The new package appears in Source Packages and includes Shakespeare.java and Shakespeare_Stub.java.
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(); try { text = s.GetSpeech("Romeo"); }catch(java.rmi.RemoteException rex) { text = "error"; System.out.println(rex.getMessage()); } TextBox t = new TextBox("Hello", text, 2048, 0); t.addCommand(exitCommand); t.setCommandListener(this); display.setCurrent(t);
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:
http://www.xmlme.com/WSShakespeare.asmx?WSDL
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.