J2ME Web Services: Harsh Maheshwari-09030142071 Tanmay Gupta-09030142066 Ashish Srivastava-09030142062

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

J2ME Web Services

Harsh Maheshwari-09030142071
Tanmay Gupta-09030142066
Ashish Srivastava-09030142062
Web services in J2ME
Web services in the Java 2 Platform, Micro Edition (J2ME) platform,
as defined by Java Specification Request 172 (JSR 172), follow the
same specifications, architecture, and invocation model as with
standard Web services
JSR 172 Web Services APIs (WSA) follow these core Web services specifications:

Standard Web services

Simple Object Access Protocol (SOAP) 1.1,

Web Services Definition Language (WSDL) 1.1

XML 1.0

XML Schema, which, of course, defines the XML schema.


WSDL
What is WSDL?
 WSDL stands for Web Services Description
Language
 WSDL is written in XML
 WSDL is an XML document
 WSDL is used to describe Web services
 WSDL is also used to locate Web services
 WSDL is a W3C recommendation
Structure of WSDL document
<definitions>

<types>
  definition of types........
</types>

<message>
  definition of a message....
</message>

<portType>
  definition of a port.......
</portType>

<binding>
  definition of a binding....
</binding>
</definitions>
Structure of WSDL document Contd..
 Types– a container for data type definitions using some type
system (such as XSD).
 Message– an abstract, typed definition of the data being
communicated.
 Operation– an abstract description of an action supported by the
service.
 Port Type–an abstract set of operations supported by one or more
endpoints.
 Binding– a concrete protocol and data format specification for a
particular port type.
 Port– a single endpoint defined as a combination of a binding and a
network address.
 Service– a collection of related endpoints.
SOAP
SOAP is for communication Protocol between
applications
SOAP is a format for sending messages
SOAP communicates via Internet
SOAP is platform independent
SOAP is language independent
SOAP is based on XML
SOAP is XML based protocol to let application
exchange information over HTTP.
HTTP + XML = SOAP
Why Soap
Today's applications communicate using Remote Procedure Calls
(RPC) between objects like DCOM and CORBA, but HTTP was not
designed for this. RPC represents a compatibility and security
problem; firewalls and proxy servers will normally block this kind
of traffic.

A better way to communicate between applications is over HTTP,


because HTTP is supported by all Internet browsers and servers.

SOAP provides a way to communicate between applications


running on different operating systems, with different
technologies and programming languages.
Skeleton SOAP Message
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header>
...// Optional Element Consist of Platform Specific Information
..// Protocol Specific information
</soap:Header>

<soap:Body>
...// Message Part
  <soap:Fault>
  ... // Error Message and Resolution
  </soap:Fault>
</soap:Body>

</soap:Envelope>
Hello world message in SOAP

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<message xsi:type="xsd:string">Hello World
Message</message>
</SOAP-ENV:Body>

</SOAP-ENV:Envelope>
J2ME Web Services
(WSA)
This high-level architecture is structured as follows:

A client, Web services consumer: A network-aware application


residing on a WSA-enabled wireless device. The application
includes a JSR 172 stub that uses the JSR 172 runtime to
communicate with the network.

The network: This refers to the wireless and wired networks, part
of the Internet, and the communication protocols.

The server, Web services producer:


This is a Web server, typically behind firewalls and/or proxy
gateways.
This server might have access to back-end resources.
Understanding JSR 172
To begin to understand how J2ME Web Services works, let's first look at how a
typical JSR 172-based application is organized:
The application itself is a smart client based on the :-

(A)Mobile Information Device Profile (MIDP) or the Personal


Basis Profile (PBP),

(B)with business-specific logic, user interface, persistence


logic, life-cycle and application-state management.

(C) To handle XML documents, the application can employ


the JAXP subset API.

(D)To consume web services, it can use the JAX-RPC subset API
The JSR 172 Runtime and Service
Provider Interface

 Set properties specific to an RPC


invocation
 Describe the RPC invocation input
and return values
 Encode input values
 Invoke the RPC service endpoint
 Decode and return to the
application any values that the
service endpoint returns
Synchronous Request-Response Model

You might also like