Oracle® Java Micro Edition Software Development Kit Developer's Guide Release 8 for Windows E50624-01 |
|
Previous |
Next |
The Oracle Java ME SDK 8 emulator supports JSR 172: J2ME Web Services Specification. JSR 172 provides APIs for accessing web services from mobile applications. It also includes an API for parsing XML documents.
NetBeans IDE 8.0 provides a stub generator that automates creating source code for accessing web services that conform to the J2ME Web Services Specification.
You can add stub files to any MEEP application.
Note: If you are using NetBeans IDE 8.0, the SOAP Web Services plugin must be installed and activated. |
To add a stub file:
In the Projects window, expand the tree for a project, right-click the Source Packages node and select New, and then Other. Select the Java ME Embedded category and then Java ME Web Service Client.
In the New Java ME Webservice Client page, you can do one of the following:
Click Running Web Service and enter the URL for the WSDL, and then click Retrieve WSDL.
Click Specify the Local filename for the retrieved WSDL and browse to find a file on your system.
In either case, you must enter a package name (if it is not supplied), and then click Finish. The new package appears in the project and includes an interface file and a stub file.
You can now edit your source files to call the content that the stub file provides, then build and run the project.
For additional information about how to generate stub files and other supporting files from the command line, see Generating Stub Files from the Command Line.
Mobile clients can use the Stub Generator to access web services. The wscompile
tool generates stub files, ties, serializers, and WSDL files used in Java API for XML (JAX) RPC clients and services. The tool reads a configuration file that specifies a WSDL file, a model file, or a compiled service endpoint interface.
The wscompile.exe
file is located under bin
in the Java ME SDK installation directory. The syntax for the stub generator command is as follows:
wscompile <command> [options] <config_file>
The following commands for the wscompile
tool are available:
Command | Description |
---|---|
|
Same as |
|
Generates client artifacts (stubs, etc.) |
|
Generates interfaces and value types only |
The following options for the wscompile
tool are available:
Option | Description |
---|---|
|
Specifies where to place generated output files |
|
Enables the given features |
|
Generates debugging information |
|
Same as |
|
Specifies a HTTP proxy server (port defaults to 8080) |
|
Writes the internal model to the given file |
|
Optimizes generated code |
|
Specifies where to place generated source files |
|
Outputs messages about what the compiler is doing |
|
Prints version information |
|
Sets the CLDC version to 1.0 (default). Float and double become String. |
|
Sets the CLDC version to 1.1. Float and double are OK. |
|
Shows all CLDC 1.0 information and warning messages. |
Note: Only one |
The wscompile
tool can read WSDL files, compiled service endpoint interface (SEI) files, or model files as input. The following table lists features that can be specified with the -f
option for the wscompile
command, and the type of files that can be provided when the feature is specified. Multiple features must be separated by commas.
Option | Description |
---|---|
|
Turns on explicit service context mapping |
|
Turns off data binding for literal encoding |
|
Turns off encoding type information |
|
Turns off support for multiple references |
|
Turns off full validation of imported WSDL documents |
|
Searches schema for subtypes |
|
Turns on direct serialization of interface types |
|
Enables WSI-Basic Profile features (default) |
|
Resolves |
|
No unwrap |
The following are examples of using the wscompile
command:
wscompile -gen -d generated config.xml wscompile -gen -f:nounwrap -O -cldc1.1 -d generated config.xml