You are on page 1of 161

Web Services

~-

WEB-SERVICES [Intro)

~

--

~.~

.. .....

By Mr. SekharReddy i;
.
,

Q.) What is distributed technology?
I

'

A technology is said t o be distributed if it's business objects are geographically dispersed
(across multiple JVM's) and st111communicating one another.

I

i

I

'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

o
o
o

CORBA
RMI
EJB
WEB SERVICES ...etc.
.&

CORBA
> More complexity in t h e implementation
I->
Heavy weight
Language dependent
> Commercial
:, Plat from independent
I

I

RMI
> Lack of Enterprise services/Middle ware services
I

Open source
IVo acknowledgement
> Language dependent
> Plat from independent

I >
I
I

I

,#

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
- .-.. . . ...
...- - ........
...
- - . .- .- - -.-.... ..- - - - -- ..-,

Page 1
http://javabynataraj.blogspot.com
2

I

.. . .

-

..

-

-

~

~

.

-

-

.
.
.
p
p
.
p
.
.
.
.
p
.
p
p
-

By Mr. ~ e k h a r ~ e d d v

WEB-SERVICES (Intro)
I

> Managed by Application server

Robust
Heavy weight
c> Language Dependent
G Plat from independent
I

WEB SERVICES

Supports Enterprise services
> Interoperable (Language independent & Plat from independent)

I-?
I

I

So, Web services is interoperable distributed technology

!

1

Q.) What we require if two persons need to communicate?

I
I

1 .) Two persons @
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

r:,

Both application needs to communicate by following some rules(protocols)
o HrrP
o FTP
o SMTP...etc.
To communicate language is required(Neutra1 language)
o XML

-

--

~ a G s ihTechnologies, Opp. Satyam Theatre, Arneerpet, Hyderabad, Ph: 040-23746666,23734842
An I S 0 9001 : 2000 Certified Company
.... .. . ..
.-. .-- -- ---

P~@Z---

http://javabynataraj.blogspot.com

3

Opp. - -- I I Page 3 http://javabynataraj.blogspot. Ph: 040-23746666 23734842 An I S 0 9001 : 2000 Certified Company ---. and we have so many technologies which supports HlTP protocol.-.L..-:--p------ e At "Provider" side it may be interpreted as follows H I ---.-. Hyderabad..-...-.------. Satyam Theatre. I <id>ysreddy</id>+..-__..com 4 . ~ e k h a r ~ F d x F T SMTP I n the internet world we prefer t o use H-TTP protocol... Ameerpet.<password>** * * * *</passwOrdx-------~---'-<id>88@8</i d ---_.----. I > Lets assume that we are sending employee information form "Consumer" to "Provider" in .- -.__.---' Authentication Data ---_ <name>sekhar</name>s--.-- WEB-SERVICES (Introl Bv Mr.-. I I XI i the XML format as follows.- Naresh i Technologies.__ --__ __._--- ~ -Business Data <salary>2489</salary>c---.___.---- '---:. 1 -- --ppp-p..-.

I-> So...23734842 An IS0 9001 : 2000 Certified Company ...__> ...-.d y _.etc. .... we don't send raw XML document(contains business data) t o the providers... Ph: 040-23746666. ' I .. ...." .. 3 So "Consumer" needs the information like what are the services are providing....... . Ameerpet..... -............ " .... . </employee> ...' .." <password>******<l...... .. Satyam Theatre...' .. To know the services of "Provider"... so that any type of client can understand the services of the "Provider"..... .. . -..'' . .. - Page 4--http://javabynataraj... 1 1 1 .. <id>ysreddy</id>:::-.. . To achieve this we will go for SOAP 0 SOAP stands for Simple Object Access Protocol SOAP is a classification protocol SOAP is a binding protocol(processing data + business data) I-> C'onsu msr Provider But what services are providing by the Provider should be explained.....i+" labSWbs i..........1 '-I ....I' .. <sa lary>2489</salary> ..... BusinessData . -. " <name>~ekha~</~~me>: : a ... . Q "WSDL" stands for Web Service Description Language + "WSDL" is an XML document... Hyderabad.-..... I I I I I I - We need classification of the request data like o Processing information/Authentication information o Business inforniation I-:.-. . z-. -. .. ... Nares'h i Technologies... ... I... what url has t o call t o get services .I: So. because it should be language independent.. classification of the information is missing.._. .. Opp........ ~3 "Provider1' will explain all these information in one document called "WSDL"..p-.' ......... .. "Consumer" cannot look into the code of of "Provider"..blogspot. <id>88688</id> : . Authentication Data <employee> ....com 5 .. ..... . what they will take as input..-..._ .. . and what t h e output they will return.

23734842 An I S 0 9001 : 2000 Certified Company ~. from where "Consumer" get? So "WSDL" documents has t o be placed in some location from where "Consumer" can access them.Hyderabad. Opp... that location is nothing but "UDDI" ~2 UDDI stands for Universal Description Discovery and Integration UDDI is the Registry where all the WSDL documents are registered UDDI should be interoperable.-.- ~~ WEB-SERVICES (Intro) - ~ .blogspot. Satyam Theatre. ' I \ I I - I i ~ .1 "WSDL" is the document which explains the services information. i I i . i I L.t. Ph: 040-23746666.-- Bv Mr.. But how can "Consumer" get that WSDL document. SekharReddv-. Ari~eerpet.com 6 ' - .:- I I ' I . Naresh i Technologies.- Page 5 http://javabynataraj. so it is also developed in XPIL r2 UDDI registry also called XlYL registry I .

Opp. Hyderabad.. -. Ph: 040-23746666.0) Naresh i Technologies. Ameerpet. that aim t o create Web services specifications that all companies can use. ) What is WS-I? The WS-I (Web Services Interoperability) Organization is an association of I T industry compa~iies. 4. Satyam Theatre.including IBM and Microsoft.blogspot.l) o Basic Profile 2.0) o Basic Profile 1.- Pa=-6http://javabynataraj.2 ..0 (BP 1.-.com 7 .1(BP 1.23734842 An I S 0 9001 : 2000 Certified Company .)What are the different standards given by WS-I to implement Web services ? r3 WS-I has given o Basic Profile 1.0 (BP 2.

Satyam Theatre..- Naresh i Technologies. Ph: 040-23746666. Hyderabad.O/BP l .. Ameerpet. I I I I .7http://javabynataraj. - - - ~ WEB-SERVICES (Intro) By Mr.. 1 standard -4 JAX-RPC .com 8 . S e k h a r R e d d v .23734842 An IS0 9001 :2000 Certified Company -.0 standard Sun has released "JAX-WS" API that follows BP 1 .. Q.-.-- I I p a g e .I I I I \ - There so many API's. Implementations for t h e WS-I given standards 1 ~3 Sun has released "JAX-RPC" API that follows BP 1.AX-ws I JAX-RPC : Java APIs for XML-based Remote Procedure Call JAX-WS : Java API f o r XPlL Web Services JAX-P : Java API for XML Processing JAX-B : Java Architecture for XML Binding Ii JAX-R : Java API f o r XML Registries 1 SAAJ : SOAP with Attachments API for Java 1 - -- -.0) is said t o be web services.)What are Web services? I Web services is a software application that confirms the WS-1's given speicifiations( BP l. Opp. I -.blogspot. 13 Any program that is distributed in nature.. I-:.. l / B P 2. language independent and plat form neutral is said to be web services..-. .- . Specification (froni WS-I) -- -- Implementation API (from Sun microsystem) (from different companies) 1 .

...Net. i i NOTE: Apache CXF internally uses spring. Php . we can say we are developing web services using I> JAX-RPC..-- - BP . ~ ... means fa~ledin interoperability. .... .etc... I Contract first A ~ ~ r o a c h - !! WSDL - + Services 1 I Contract last Amroach I Services ' I I + WSDL I ' NOTE: ~3 Services can be developed with any technology like . I But WSDL development is unique..etc d I n java.- By Mr..-. not implementation specific. Ameerpet.) What are the HTTP protocols implemented API's? I ( 1 I 1.. not API specific. Contract last(bottom-up) approach I - . I I I I / - NOTE: I n the internet world w& prefer to use HlTP protocol. Ph: 040-23746666.. Java. Contract last approach . WEB-SERVICES [Intro) -. ! Q. Contract first approach 3 JAX-RPC .. apache .-.. . RESTFUL..1 JAX-RPC-SI(from sun) Apache-Axis(from ASF) . ~3 I n java.. Services can be developed using any implementations like sun. which resolved interoperab~lityproblem and also added some more features. and we have so many technologies which supports HlTP protocol.etc JAX-WS RI(from Sun) Apache-Axis2(from ASF) Metro(from Sun) CXF(from ASF) . Servlet API 2... Sun then released "metro" implementation of JAX-WS.. I I So... .. opp.-. EJB API i I II Naresh i Technologies. ~ e k h a r k e d d f ------ -. Certified Company .. Hyderabad... .. NOTE: JAX-WS RI(Reference Implementation) was fa~ledto access by .etc. Contract first(top-down) approach 2.....Net....0 JAX-RPC JAX-WS BP 1. 9 I1 I ......23734842 An IS0 9001 : 2000-. n o t language specific..-- p p 1. Services can be developed using any API like JAX-RPC. it's not plat form specific..com Page8--. n o t technology specific.. -- http://javabynataraj.etc.blogspot.. JAX-WS..Satyarn Theatre. ! Web Services Development I Web services development can done in two ways 1.

. we can say we are developing web services using > JAX-RPC.blogspot. I. and "Consumer" blocks until response comes back from the "Provider". After request sent t o the "Provider" it continues its flow of execution "Consumer" will have " R e s p o n s e L i s t e n e r " which listens t h e response from the "Provider"...--- -- Bv Mr.) W h a t i s e n d p o i n t ? 1 I. Page 9 http://javabynataraj. So. c o n t i n u e s i t s process . ~ e k h a r ~ e d T l t 7 WEB-SERVICES (lntro'l--' Q. I I After Response Received. Servlet end point url. and "Consumer" will not wait until it I > I - -- gets the response. Contract last approach I 1 I i MEP 1 1 r3 I I I I MEP stands for ~ e s s a g d ~ x c h a n g i nPatterns g " C o n s ~ ~ r n can e r ~ ~communicate with "Provider" in three ways o Synchronous request-reply o Asynchronous request-reply o Fire and forget I Synchronous request-reply 0 I n this "Consumer" sends the request t o "Provider".-.. I i - I Naresh i Technologies.23734842 An I S 0 9001 : 2000 Certified Company - - i .. Hyderabad. Contract first approach > JAX-RPC. Ph: 040-23746666. Ameerpet. EJB end point url. A component which receives "Consumer" request I n general we use either servlet or ejb as an End Po~nt.request t o "Provider".com 10 I . Opp. Satyam Theatre. Until response comes back "Consumer" can't proceed. 1 A s v n c h r o n o u s reauest-re~ly I 'I e In this "Consumer" sends the.

http://javabynataraj.blogspot.com 11 .

blogspot.http://javabynataraj.com 12 .

com 13 .blogspot.http://javabynataraj.

blogspot.http://javabynataraj.com 14 .

blogspot.http://javabynataraj.com 15 .

http://javabynataraj.com 16 .blogspot.

com 17 .http://javabynataraj.blogspot.

http://javabynataraj.com 18 .blogspot.

com 19 .http://javabynataraj.blogspot.

http://javabynataraj.blogspot.com 20 .

http://javabynataraj.com 21 .blogspot.

http://javabynataraj.com 22 .blogspot.

http://javabynataraj.blogspot.com 23 .

blogspot.com 24 .http://javabynataraj.

com 25 .http://javabynataraj.blogspot.

com 26 .blogspot.http://javabynataraj.

blogspot.com 27 .http://javabynataraj.

blogspot.http://javabynataraj.com 28 .

http://javabynataraj.com 29 .blogspot.

http://javabynataraj.blogspot.com 30 .

blogspot.com 31 .http://javabynataraj.

http://javabynataraj.blogspot.com 32 .

com 33 .blogspot.http://javabynataraj.

com 34 .http://javabynataraj.blogspot.

com 35 .http://javabynataraj.blogspot.

com 36 .blogspot.http://javabynataraj.

http://javabynataraj.blogspot.com 37 .

blogspot.com 38 .http://javabynataraj.

com 39 .http://javabynataraj.blogspot.

http://javabynataraj.blogspot.com 40 .

com 41 .http://javabynataraj.blogspot.

blogspot.http://javabynataraj.com 42 .

blogspot.http://javabynataraj.com 43 .

blogspot.http://javabynataraj.com 44 .

com 45 .blogspot.http://javabynataraj.

blogspot.com 46 .http://javabynataraj.

blogspot.http://javabynataraj.com 47 .

blogspot.com 48 .http://javabynataraj.

com 49 .http://javabynataraj.blogspot.

com 50 .blogspot.http://javabynataraj.

blogspot.com 51 .http://javabynataraj.

com 52 .blogspot.http://javabynataraj.

blogspot.http://javabynataraj.com 53 .

http://javabynataraj.com 54 .blogspot.

http://javabynataraj.blogspot.com

55

http://javabynataraj.blogspot.com

56

http://javabynataraj.blogspot.com

57

blogspot.com 58 .http://javabynataraj.

com 59 .http://javabynataraj.blogspot.

com 60 .http://javabynataraj.blogspot.

com 61 .http://javabynataraj.blogspot.

http://javabynataraj.com 62 .blogspot.

blogspot.com 63 .http://javabynataraj.

blogspot.http://javabynataraj.com 64 .

http://javabynataraj.blogspot.com 65 .

http://javabynataraj.blogspot.com 66 .

http://javabynataraj.blogspot.com 67 .

com 68 .blogspot.http://javabynataraj.

blogspot.http://javabynataraj.com 69 .

com 70 .blogspot.http://javabynataraj.

blogspot.http://javabynataraj.com 71 .

com 72 .http://javabynataraj.blogspot.

http://javabynataraj.blogspot.com 73 .

com 74 .http://javabynataraj.blogspot.

com 75 .blogspot.http://javabynataraj.

http://javabynataraj.blogspot.com 76 .

http://javabynataraj.blogspot.com 77 .

blogspot.http://javabynataraj.com 78 .

blogspot.http://javabynataraj.com 79 .

http://javabynataraj.com 80 .blogspot.

com 81 .http://javabynataraj.blogspot.

http://javabynataraj.blogspot.com

82

http://javabynataraj.blogspot.com

83

http://javabynataraj.blogspot.com

84

com 85 .blogspot.http://javabynataraj.

com 86 .blogspot.http://javabynataraj.

com 87 .blogspot.http://javabynataraj.

com 88 .http://javabynataraj.blogspot.

com 89 .blogspot.http://javabynataraj.

blogspot.http://javabynataraj.com 90 .

http://javabynataraj.blogspot.com 91 .

http://javabynataraj.blogspot.com 92 .

http://javabynataraj.blogspot.com 93 .

com 94 .blogspot.http://javabynataraj.

http://javabynataraj.com 95 .blogspot.

blogspot.com 96 .http://javabynataraj.

com 97 .http://javabynataraj.blogspot.

com 98 .http://javabynataraj.blogspot.

com 99 .blogspot.http://javabynataraj.

blogspot.com 100 .http://javabynataraj.

http://javabynataraj.blogspot.com 101 .

http://javabynataraj.blogspot.com 102 .

http://javabynataraj.blogspot.com 103 .

http://javabynataraj.blogspot.com

104

http://javabynataraj.blogspot.com

105

http://javabynataraj.blogspot.com

106

com 107 .http://javabynataraj.blogspot.

blogspot.http://javabynataraj.com 108 .

blogspot.http://javabynataraj.com 109 .

com 110 .http://javabynataraj.blogspot.

com 111 .blogspot.http://javabynataraj.

com 112 .blogspot.http://javabynataraj.

blogspot.com 113 .http://javabynataraj.

com 114 .blogspot.http://javabynataraj.

com 115 .blogspot.http://javabynataraj.

blogspot.http://javabynataraj.com 116 .

blogspot.com 117 .http://javabynataraj.

com 118 .http://javabynataraj.blogspot.

com 119 .blogspot.http://javabynataraj.

http://javabynataraj.com 120 .blogspot.

http://javabynataraj.blogspot.com 121 .

http://javabynataraj.blogspot.com 122 .

blogspot.http://javabynataraj.com 123 .

blogspot.com 124 .http://javabynataraj.

blogspot.com 125 .http://javabynataraj.

http://javabynataraj.com 126 .blogspot.

blogspot.com 127 .http://javabynataraj.

http://javabynataraj.blogspot.com 128 .

http://javabynataraj.com 129 .blogspot.

blogspot.com 130 .http://javabynataraj.

blogspot.http://javabynataraj.com 131 .

blogspot.com 132 .http://javabynataraj.

http://javabynataraj.blogspot.com 133 .

com 134 .http://javabynataraj.blogspot.

com 135 .http://javabynataraj.blogspot.

http://javabynataraj.com 136 .blogspot.

http://javabynataraj.com 137 .blogspot.

com 138 .blogspot.http://javabynataraj.

blogspot.com 139 .http://javabynataraj.

com 140 .http://javabynataraj.blogspot.

blogspot.com 141 .http://javabynataraj.

com 142 .http://javabynataraj.blogspot.

http://javabynataraj.blogspot.com

143

http://javabynataraj.blogspot.com

144

http://javabynataraj.blogspot.com

145

http://javabynataraj.com 146 .blogspot.

http://javabynataraj.com 147 .blogspot.

http://javabynataraj.com 148 .blogspot.

blogspot.com 149 .http://javabynataraj.

com 150 .http://javabynataraj.blogspot.

http://javabynataraj.com 151 .blogspot.

com 152 .blogspot.http://javabynataraj.

blogspot.com 153 .http://javabynataraj.

blogspot.com 154 .http://javabynataraj.

com 155 .blogspot.http://javabynataraj.

blogspot.http://javabynataraj.com 156 .

com 157 .blogspot.http://javabynataraj.

com 158 .blogspot.http://javabynataraj.

blogspot.com 159 .http://javabynataraj.

blogspot.com 160 .http://javabynataraj.

com 161 .http://javabynataraj.blogspot.