J2ME Web Services

The Java 2 Micro Edition (J2ME) Web Service specification is an attempt at standardizing programmatic access to Web services from J2ME client applications. Currently, this specification exists as Java Specification Request (JSR) 172 as part the Java Community Process (JCP). More information about JSR-172 can be found at http://www.jcp.org.

Web services can be accessed by J2ME clients today, but involve low-level network APIs that result in non-standard and proprietary implementations. Other specifications and initiatives, such as Java API for XML Processing (JAXP) and Java API for XML-based RPC (JAX-RPC), have addressed high-level and standardized means of accessing XML-based Web services from Java platforms. However, these initiatives do not sufficiently address the unique requirements and limitations of mobile environments, including footprint, computational resources, and wireless networks.

The goal of JSR-172 is to augment the J2ME platform to support two additional capabilities:

  1. Support parsing of XML data.

    As mobile devices are used increasingly within enterprise environments, they will need to access structured data most likely in the form of XML. Instead of requiring individual applications to build XML parsing support themselves, an optional package for the J2ME platform makes sense. The J2ME XML parsing will support a strict subset of JAXP 1.2 such that the API implementation fits within the footprint and performance requirements of target mobile devices.

  2. Support easy and standardized programmatic access to XML-based SOAP Web services.

    As an increasing number of useful Web services become available both within the enterprise as well as from third-party vendors, facilitating and standardizing easy programmatic access to these Web services becomes desirable. This optional package will define a standard API for accessing XML Web services from J2ME applications.

    The Web services support within the JSR-172 specification is meant to be independent of the XML parsing support the Web services optional package is independent of the XML parsing optional package and can be used independently and separately from each other. The JSR-172 Web services specification only supports access to Web services by the mobile client and does not currently address hosting Web services by mobile devices. The Web services API is a strict subset of the JAX-RPC specification such that the API implementation fits within the footprint and performance requirements of target mobile devices.

Since the JSR-172 separates its support of Web services from its support of XML parsing, the remainder of this chapter discusses only the Web services support.

Supported APIs

The JSR-172 specification includes APIs that programmers can use to access remote Web services. The specification does not include any special server-side APIs, but instead specifies only client-side APIs.

The client-side APIs specified by the JSR-172 specification are the following APIs of the JAX-RPC specification:

  • The javax.xml.rpc.Stub interface

  • The javax.xml.rpc.JAXRPCException class

All J2ME Web service runtime system implementations must implement the above APIs.

Programming Model

The current version of the JSR-172 specification requires that developers building mobile applications that directly invoke remote Web services follow these steps:

  1. Generate a local stub from the WSDL description of the remote Web service.

  2. Instantiate an instance of the generated stub.

  3. Invoke methods of the instantiated stub, which correspond to operations of the remote Web service.

  4. Package the stub with the mobile application.

These steps are inline with standard Web service invocations using stubs. By following these steps and using an implementation of the JSR-172 specification, J2ME developers can easily build and deploy Web services-based mobile applications.

Developing Enterprise Web Services. An Architect's Guide
Developing Enterprise Web Services: An Architects Guide: An Architects Guide
ISBN: 0131401602
EAN: 2147483647
Year: 2003
Pages: 141

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net