You are on page 1of 15

J2EE WebServices

 Introduction to Web Services

 Why Web Services and advantages over conventional equivalent system ?

 Core concepts

 J2EE web services – various frameworks/technologies


INTRODUCTION TO WEBSERVICES

“ Web services are software components that interact with one another
dynamically via standard internet technologies making it possible to build
bridges between IT systems that otherwise would require extensive development
efforts.”

Easy way to define web services is:


 It is s/w component which can be exposed as service on web.

 Can be consumed by any client in a language independent way by the use of standard xml

specification.
Points to
UDDI description
Registry WSDL

Points to
service
Finds Describes
Service Service

Web
WebService
Service SOAP Web
WebService
Service
Client
Client (J2EE,
(J2EE,PL/SQL,
PL/SQL,
(J2EE, .NET,C/C++,
(J2EE,.NET,
.NET, .NET,C/C++,
PL/SQL Legacy
Legacy…)
PL/SQL…)…) Invokes with …)
XML Messages
Conventional Approaches of exposing/consuming a service

RMI in Java
When we want to expose certain service in Java , we can expose it thru RMI
The client can later consume that service using RMI protocol.

Problem ?
Concepts
Concepts related to J2EE servlet (how it works) –

In web.xml servlet url mapping and servlet class is configured.


Servlet class(basically user defined class) extends HttpServlet
and Implement one of the methods doGet/doPost.

About HTTP
HTTP packet – has header part & body part
HTTP methods – GET/POST/PUT/DELETE/TRACE/OPTIONS
GET – generally used for requesting some info
POST – used for processing part for e.x saving form data in DB.

So, how does the request works??? – a demo

HOW J2EE web services are related with it?


Few terminologies/technology used in web services
 XML
 SOAP – basically a xml based message format(protocol)

<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header> ... ... </soap:Header>
<soap:Body> ... ...
<soap:Fault> ... ... </soap:Fault>
</soap:Body>
</soap:Envelope>
 UDDI- Universal Description Discovery Integration – place where webservices are published
 WSDL – web services description language, this is what makes web services language independent.
 Its basically contract what server and client has to follow.
 JAX-RPC – Java API for XML-based RPC

 Supports component-based Web-service development


 JAXP – Java API for XML Processing

 framework for parsing and transforming XML docs


 JAXB – Java Architecture for XML Binding

 Mechanism for creating Java objects corresponding to XML Schema elements and attributes
 SAAJ – SOAP with Attachments API for JAVA

 Simple object model for managing SOAP message content


J2EE web services implementation

 JAX- RPC – implementations -> axis (from Apache)

 JAX-WS – implementations -> Metro(from Sun), JBOSS JAX-WS, Weblogic


JAX-WS, IBM JAX-WS

 JWSDP – Java WebServices Developer Pack


Ways of creating webservices

 Bottom up approach- creating service endpoint first, then generating WSDL file

 Top Down approach – creating wsdl file first, then creating the service class
How does the communication work for J2EE web services
 Client follows the contract specified in wsdl file i.e where the service is located and
how to invoke the service.

 Client invokes the service, the request goes as soap message wired over HTTP and
waits for the result. So, which HTTP method?

 Server processes the HTTP body which contains soap message which is further de-
serialize to invoke the actual class’s method.

 Server sends the SOAP response message as HTTP body payload which client
receives.
What are these implementation all about?

 All are SOAP runtime environment.

 All are deployed as servlet i.e the core concept is same

 Services are wrapped inside the servlet

 Can be used either at server/client side


Processing SOAP message using handlers

 When handlers are required ?– can be used for security/logging

 Writing handlers – a simple demo


How about security ?

 HTTPS

 XML Encryption- XML Security Suite from IBM,


Trust Services Integration Kit(TSKIT) from Verisign
Processing SOAP message using handlers

 When handlers are required ?– can be used for security/logging

 Writing handlers – a simple demo


References

 Developing Java Web Services (Wiley Publication)

 The Ultimate Guide – J2EE Web Services by Richard Monson-Haefel

You might also like