~- ~ ~.~ -- .. . . ...
WEB-SERVICES [Intro) By Mr. SekharReddy ., i ;
Q.) What is distributed technology?
I ' I
A technology is said to be distributed i f it's business objects are geographically dispersed i I
(across multiple JVM's) and st111 communicating one another. ' I
Q.) Why distributed technology?
I-) Load balancing
I High Availability
I-:, High Processing
Q.) What are different distributed technologies?
I > There are so many distributed technologies o CORBA o RMI o EJB o WEB SERVICES ... etc.
.&
CORBA > More complexity in the implementation
I - > Heavy weight Language dependent
I > Commercial I :, Plat from independent
RMI I > Lack of Enterprise services/Middle ware services I > Open source I IVo acknowledgement , #
I > Language dependent I > Plat from independent
E3 B I-> Supports Enterprise services/Middle ware services in the declarative manner
Having multiple flavors of APIs t o handle different requirements o Session beans
Stateless Stateful
o Entity beans(not using now) = JPA
o Message Driven Beans -- !
Naresh i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,23734842 An IS0 9001 : 2000 Certified Company I
. . . . . . . . . . . . . . . . . . .- - . . . . .. . . -, . . . - - . . - . - - - .- . . .. . .- - - - -- . . - - - .- .- . . . . Page 1 -
http://javabynataraj.blogspot.com 2
. . - ~ - ~ .. - - ...p-p.p....p-.pp-
WEB-SERVICES (Intro) By Mr. ~ e k h a r ~ e d d v ~ ~ . ~ ~ !
I > Managed by Application server Robust
I Heavy weight c> Language Dependent G Plat from independent
WEB SERVICES I-? Supports Enterprise services I > Interoperable (Language independent & Plat from independent)
So, Web services is interoperable distributed technology I ! 1
Q.) What we require if two persons need to communicate?
1 .) Two persons @ I I 2.) Medium
3.) Language 4.) RuIes(protocoI)
I
Web services architecture
I f two applications needs to communicate
a Both the applications should be connected (network) e Both application needs to communicate by following some rules(protocols)
o H r r P o FTP o SMTP ... etc.
r:, To communicate language is required(Neutra1 language) o XML
- --
~ a G s h i Technologies, Opp. Satyam Theatre, Arneerpet, Hyderabad, Ph: 040-23746666,23734842
. . . . . . . . . . -. . - - - - - - - An I S 0 9001 : 2000 Certified Company P~@Z---
http://javabynataraj.blogspot.com 3
- -. --ppp-p..-- --
WEB-SERVICES (Introl Bv Mr. ~ e k h a r ~ F d x F T I 1
SMTP
I In the internet world we prefer t o use H-TTP protocol, and we have so many technologies ,, which supports HlTP protocol. I
X I
I > Lets assume that we are sending employee information form "Consumer" to "Provider" in the XML format as follows. i
I
<id>ysreddy</id> +.-..- - __.__.L.---'
Authentication Data <password>* * * * * *</passwOrdx-------~---'--
<id >88 @8</i d ---_.__ --__ ---_ ---- <name>sekhar</name>s--..---- --.-..-.-...- - ~ ___.----- -__._--- '---:..- -Business Data
<salary>2489</salary> c---,-:--p------
e At "Provider" side i t may be interpreted as follows
---,- H I Naresh i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666 23734842
- I An I S 0 9001 : 2000 Certified Company
- - - - - - .- -. - -- I Page 3
http://javabynataraj.blogspot.com 4
,,,' ,.,;,- Authentication Data
<employee> ,,,,,, ,,.. ,,, ,,' ,,I'
,.,.,'' ,,.,
<id>ysreddy</id>:::-. . ,, ,,,... ,,,, ,,,,, I, ,111
..__> ,,,, , 1
,,,' ,,,"
<password>**** **<l,p-,i+" labSWb s i d y . _,.,"
'-I ...
<id>88688</id> : . " . ._ ..._. ... 'I.
<name>~ekha~</~~me>: . . . . .... ":a, Business Data ............. .. .. ....... ......... ............... <sa lary>2489</sa la ry> z-,
</employee>
I-:, So, classification of the information is missing. I
I I-> So, we don't send raw XML document(contains business data) to the providers.
We need classification of the request data like I
o Processing information/Authentication information I o Business inforniation
I I-:, To achieve this we will go for SOAP I 0 SOAP stands for Simple Object Access Protocol - I-> SOAP is a classification protocol
SOAP is a binding protocol(processing data + business data)
C'onsu msr Provider
But what services are providing by the Provider should be explained. To know the services of "Provider", "Consumer" cannot look into the code of of "Provider".
3 So "Consumer" needs the information like what are the services are providing, what they will take as input, and what the output they will return, what url has to call t o get services ... etc.
~3 "Provider1' will explain all these information in one document called "WSDL". Q "WSDL" stands for Web Service Description Language + "WSDL" is an XML document, because it should be language independent, so that any
type of client can understand the services of the "Provider".
Nares'h i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,. 23734842 An IS0 9001 : 2000 Certified Company - - - - - .- .- - . .
..-.-. .. ........... ........... .......
Page 4--- http://javabynataraj.blogspot.com 5
.- ~~ - ~ - - -
WEB-SERVICES (Intro) Bv Mr. SekharReddv-- 1
.;t, "WSDL" is the document which explains the services information. But how can I
"Consumer" get that WSDL document, from where "Consumer" get? i
L-:, So "WSDL" documents has to be placed in some location from where "Consumer" can access them, that location is nothing but "UDDI"
I I
~2 UDDI stands for Universal Description Discovery and Integration I UDDI is the Registry where all the WSDL documents are registered
' I , '
I UDDI should be interoperable, so it is also developed in XPIL \ I
r2 UDDI registry also called XlYL registry I -
I
i i ~.
Naresh i Technologies, Opp. Satyam Theatre, Ari~eerpet, Hyderabad, Ph: 040-23746666,23734842 An IS0 9001 : 2000 Certified Company
I ~ . - -. .- i
Page 5 ' -
http://javabynataraj.blogspot.com 6
2. ) What is WS-I?
The WS-I (Web Services Interoperability) Organization is an association of I T industry compa~iies, including IBM and Microsoft, that aim to create Web services specifications that all companies can use.
4.) What are the different standards given by WS-I to implement Web services ?
r3 WS-I has given o Basic Profile 1.0 (BP 1.0) o Basic Profile 1.1 (BP 1 .l) o Basic Profile 2.0 (BP 2.0)
Naresh i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,23734842 An I S 0 9001 : 2000 Certified Company
. - - - - - -- - Pa=-6-
http://javabynataraj.blogspot.com 7
, - - - ~
WEB-SERVICES (Intro) By Mr. S e k h a r R e d d v . ,
I Q.) What are Web services?
I I-:, Web services is a software application that confirms the WS-1's given speicifiations( BP -.I
l.O/BP l . l / B P 2.0) is said t o be web services. I I
I I 13 Any program that is distributed in nature, language independent and plat form neutral is \
said to be web services. I I - I I There so many API's, Implementations for the WS-I given standards 1
~3 Sun has released "JAX-RPC" API that follows BP 1.0 standard Sun has released "JAX-WS" API that follows BP 1 . 1 standard
JAX-RPC -4 ,AX-ws I
JAX-RPC : Java APIs for XML-based Remote Procedure Call
JAX-WS : Java API fo r XPlL Web Services
JAX-P : Java API for XML Processing
JAX-B : Java Architecture for XML Binding I i - JAX-R : Java API for XML Registries 1 SAAJ : SOAP with Attachments API for Java 1
.- 1
Naresh i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,23734842 I
I . - . -. . - - - -. -. . -- An IS0 9001 : 2000 Certified Company
p a g e - 7 -
Implementation (from different companies)
-- -- . -- -- Specification (froni WS-I)
API (from Sun microsystem)
http://javabynataraj.blogspot.com 8
. . . . ~
. WEB-SERVICES [Intro) By Mr. ~ekharkeddf
JAX-WS RI(from Sun) BP 1.1 JAX-WS Apache-Axis2(from ASF)
Metro(from Sun) CXF(from ASF) ... etc.
- - - -- - -- - -- - - pp -
BP 1.0
NOTE: JAX-WS RI(Reference Implementation) was fa~led to access by .Net, means fa~led in interoperability. Sun then released "metro" implementation of JAX-WS, which resolved interoperab~lity problem and also added some more features.
i i NOTE: Apache CXF internally uses spring.
- --
JAX-RPC
! Web Services Development
-- ---- JAX-RPC-SI(from sun)
... Apache-Axis(from ASF) etc
I I Web services development can done in two ways
1. Contract first(top-down) approach 2. Contract last(bottom-up) approach
- I , Contract first A ~ ~ r o a c h -
! WSDL + Services ! -
I
Contract last Amroach 1 I
I
' Services + WSDL I I , NOTE:
~3 Services can be developed with any technology like .Net, Java, Php ... etc ... ' d I n java, Services can be developed using any API like JAX-RPC, JAX-WS, RESTFUL etc..
... I ~3 I n java, Services can be developed using any implementations like sun, apache etc.. I I But WSDL development is unique, it's not plat form specific, not language specific, not
technology specific, not API specific, not implementation specific.
, So, we can say we are developing web services using I > JAX-RPC, Contract first approach
I I 3 JAX-RPC , Contract last approach
I I
I NOTE: I n the internet world w& prefer to use HlTP protocol, and we have so many technologies I
/ which supports HlTP protocol. - I ! Q.) What are the HTTP protocols implemented API's?
( 1. Servlet API 2. EJB API
i I I
Naresh i Technologies, opp. Satyarn Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,23734842 1 I 1 An IS0 9001 : 2000 Certified Company
-. . . . . . . . . . . . . . . . . . . . . . . . . . .-....... -- I
Pa ge8--. ,
http://javabynataraj.blogspot.com 9
--- --
WEB-SERVICES (lntro'l--- Bv Mr. ~ e k h a r ~ e d T l t 7
' Q.) W h a t is e n d p o i n t ?
1 I, A component which receives "Consumer" request I, I n general we use either servlet or ejb as an End Po~nt.
So, we can say we are developing web services using I > JAX-RPC, Servlet end point url, Contract first approach 1 > JAX-RPC, EJB end point url, Contract last approach
I
i MEP 1 MEP stands for ~ e s s a g d ~ x c h a n g i n g Patterns
1
r3 " C o n s ~ ~ r n e r ~ ~ can communicate with "Provider" in three ways o Synchronous request-reply o Asynchronous request-reply
I I o Fire and forget
I I Synchronous reques t - rep ly I 0 I n this "Consumer" sends the request t o "Provider", and "Consumer" blocks until response
I
comes back from the "Provider", Until response comes back "Consumer" can't proceed. I
After Response Received, continues i ts process ......
Asvnch ronous reauest-re~ly 1 I I
e In this "Consumer" sends the.request t o "Provider", and "Consumer" will not wait until it '
gets the response. I I > After request sent t o the "Provider" it continues its flow of execution I "Consumer" will have "Response L is tener " which listens the response from the
"Provider". - i
I Naresh i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,23734842
An I S 0 9001 : 2000 Certified Company i
- - - - - I .-,
Page 9 http://javabynataraj.blogspot.com 10