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

Q.) Why distributed technology?


I-)

Load balancing

High Availability

I-:,

High Processing

Q.) What are different distributed technologies?

> 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

RMI
> Lack of Enterprise services/Middle ware services
I

Open source
IVo acknowledgement
> Language dependent
> Plat from independent

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

.. . .

..

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

So, Web services is interoperable distributed technology

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

I
I

1 .) Two persons @
2.) Medium
3.) Language
4.) RuIes(protocoI)

Web services architecture


I f two applications needs to communicate

a Both the applications should be connected (network)

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

- -.

--

--ppp-p..--

WEB-SERVICES (Introl

Bv Mr. ~ e k h a r ~ F d x F T

SMTP

I n the internet world we prefer t o use H-TTP protocol, and we have so many technologies
which supports HlTP protocol.
I

> Lets assume that we are sending employee information form "Consumer" to "Provider" in

,,

I
I

XI

the XML format as follows.

<id>ysreddy</id>+.-..<password>** * * * *</passwOrdx-------~---'-<id>88@8</i d
---_.__
--__

__.__.L.---'

Authentication Data

---_

<name>sekhar</name>s--..------.-.-.-..- ----

'---:..___.----- -__._---

-Business Data

<salary>2489</salary>c---,-:--p------

e At "Provider" side it may be interpreted as follows

---,-

Naresh i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666 23734842
An I S 0 9001 : 2000 Certified Company

---- - -.-

-.

--

I
I
Page 3

http://javabynataraj.blogspot.com

-,;,.,
Authentication Data
<employee>
,,..
,,,,,'
,.,.,'' ,.,
,,,...
<id>ysreddy</id>:::-. .
,,,"
<password>******<l,p-,i+"
labSWbs i.d y
_,.,"
.._
..._. ...
<id>88688</id> : . "
<name>~ekha~</~~me>:
:
a
,
BusinessData
....... .. ............... .... "
........................
<sa lary>2489</salary>
,,,'

,,,,,,

,,I'

,,,,,
,,,,

I, ,
1
1
1

,,

..__>

,,,,

,,,'

,1

'-I

...

'
I
.

. . . .

z-,

</employee>

,I:

So, classification of the information is missing.

I-> So, we don't send raw XML document(contains business data) t o the providers.

I
I

We need classification of the request data like


o Processing information/Authentication information
o Business inforniation
I-:, 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. 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 t h e output they will return, what url has t o 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

"WSDL" is the document which explains the services information. But how can
"Consumer" get that WSDL document, from where "Consumer" get?
So "WSDL" documents has t o be placed in some location from where "Consumer" can
access them, 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, so it is also developed in XPIL
r2 UDDI registry also called XlYL registry

.;t,

L,:-

'

, '

Naresh i Technologies, Opp. Satyam Theatre, Ari~eerpet,Hyderabad, Ph: 040-23746666,23734842


An I S 0 9001 : 2000 Certified Company

~.

- -..-

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 t o 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=-6http://javabynataraj.blogspot.com
7

WEB-SERVICES (Intro)

By Mr. S e k h a r R e d d v .

Q.)What are Web services?

Web services is a software application that confirms the WS-1's given speicifiations( BP
l.O/BP l . l / B P 2.0) is said t o be web services.
13 Any program that is distributed in nature, language independent and plat form neutral is
said to be web services.
I-:,

I
I

-.I
I

I
\

There so many API's, Implementations for t h e WS-I given standards

~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

-4

JAX-RPC

,AX-ws

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

SAAJ : SOAP with Attachments API for Java

--

-- .

Specification
(froni WS-I)

--

--

Implementation
API
(from Sun microsystem) (from different companies)

.-

.- .-.
.- - -

Naresh i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,23734842


An IS0 9001 :2000 Certified Company

-.-..--

p a g e - 7http://javabynataraj.blogspot.com
8

. . .

. WEB-SERVICES [Intro)
-- -- - --

BP

- -- - -

By Mr. ~ e k h a r k e d d f
------

-- --

p
p

1.0

JAX-RPC

JAX-WS

BP 1.1

JAX-RPC-SI(from sun)
Apache-Axis(from ASF) ...etc
JAX-WS RI(from Sun)
Apache-Axis2(from ASF)
Metro(from Sun)
CXF(from ASF) ...etc.

NOTE: JAX-WS RI(Reference Implementation) was fa~ledto access by .Net, means fa~ledin
interoperability. Sun then released "metro" implementation of JAX-WS, which resolved
interoperab~lityproblem and also added some more features.
i

NOTE: Apache CXF internally uses spring.

Web Services Development

Web services development can done in two ways


1. Contract first(top-down) approach
2. Contract last(bottom-up) approach

Contract first A ~ ~ r o a c h

!!

WSDL
-

+ Services

Contract last Amroach


I

Services

'

+ WSDL

'

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..
~3 I n java, Services can be developed using any implementations like sun, apache ...etc..
I
But WSDL development is unique, it's not plat form specific, n o t language specific, n o t
technology specific, not API specific, not implementation specific.

So, we can say we are developing web services using


I>
JAX-RPC, Contract first approach
3 JAX-RPC , Contract last approach

I
I

/
-

NOTE: I n the internet world w& prefer to use HlTP protocol, and we have so many technologies
which supports HlTP protocol.

Q.) What are the HTTP protocols implemented API's?

1. Servlet API
2. EJB API

II

Naresh i Technologies, opp.Satyarn Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,23734842


An IS0 9001 : 2000-. Certified Company
.........................
.-.......
--

http://javabynataraj.blogspot.com

Page8--.

I1
I
,

---

--

Bv Mr. ~ e k h a r ~ e d T l t 7

WEB-SERVICES (lntro'l--'

Q.) W h a t i s e n d p o i n t ?
1

I,
I,

A component which receives "Consumer" request


I n general we use either servlet or ejb as an End Po~nt.

So, we can say we are developing web services using


> JAX-RPC, Servlet end point url, Contract first approach
> JAX-RPC, EJB end point url, Contract last approach
I
1

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

Synchronous request-reply
0 I n this "Consumer" sends the request t o "Provider", and "Consumer" blocks until response
comes back from the "Provider", Until response comes back "Consumer" can't proceed.

After Response
Received, c o n t i n u e s
i t s process

......

A s v n c h r o n o u s reauest-re~ly

'I

e In this "Consumer" sends the.request t o "Provider", and "Consumer" will not wait until it
I >
I

--

gets the response.


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

Naresh i Technologies, Opp. Satyam Theatre, Ameerpet, Hyderabad, Ph: 040-23746666,23734842


An I S 0 9001 : 2000 Certified Company
-

.-,

Page 9

http://javabynataraj.blogspot.com

10

http://javabynataraj.blogspot.com

11

http://javabynataraj.blogspot.com

12

http://javabynataraj.blogspot.com

13

http://javabynataraj.blogspot.com

14

http://javabynataraj.blogspot.com

15

http://javabynataraj.blogspot.com

16

http://javabynataraj.blogspot.com

17

http://javabynataraj.blogspot.com

18

http://javabynataraj.blogspot.com

19

http://javabynataraj.blogspot.com

20

http://javabynataraj.blogspot.com

21

http://javabynataraj.blogspot.com

22

http://javabynataraj.blogspot.com

23

http://javabynataraj.blogspot.com

24

http://javabynataraj.blogspot.com

25

http://javabynataraj.blogspot.com

26

http://javabynataraj.blogspot.com

27

http://javabynataraj.blogspot.com

28

http://javabynataraj.blogspot.com

29

http://javabynataraj.blogspot.com

30

http://javabynataraj.blogspot.com

31

http://javabynataraj.blogspot.com

32

http://javabynataraj.blogspot.com

33

http://javabynataraj.blogspot.com

34

http://javabynataraj.blogspot.com

35

http://javabynataraj.blogspot.com

36

http://javabynataraj.blogspot.com

37

http://javabynataraj.blogspot.com

38

http://javabynataraj.blogspot.com

39

http://javabynataraj.blogspot.com

40

http://javabynataraj.blogspot.com

41

http://javabynataraj.blogspot.com

42

http://javabynataraj.blogspot.com

43

http://javabynataraj.blogspot.com

44

http://javabynataraj.blogspot.com

45

http://javabynataraj.blogspot.com

46

http://javabynataraj.blogspot.com

47

http://javabynataraj.blogspot.com

48

http://javabynataraj.blogspot.com

49

http://javabynataraj.blogspot.com

50

http://javabynataraj.blogspot.com

51

http://javabynataraj.blogspot.com

52

http://javabynataraj.blogspot.com

53

http://javabynataraj.blogspot.com

54

http://javabynataraj.blogspot.com

55

http://javabynataraj.blogspot.com

56

http://javabynataraj.blogspot.com

57

http://javabynataraj.blogspot.com

58

http://javabynataraj.blogspot.com

59

http://javabynataraj.blogspot.com

60

http://javabynataraj.blogspot.com

61

http://javabynataraj.blogspot.com

62

http://javabynataraj.blogspot.com

63

http://javabynataraj.blogspot.com

64

http://javabynataraj.blogspot.com

65

http://javabynataraj.blogspot.com

66

http://javabynataraj.blogspot.com

67

http://javabynataraj.blogspot.com

68

http://javabynataraj.blogspot.com

69

http://javabynataraj.blogspot.com

70

http://javabynataraj.blogspot.com

71

http://javabynataraj.blogspot.com

72

http://javabynataraj.blogspot.com

73

http://javabynataraj.blogspot.com

74

http://javabynataraj.blogspot.com

75

http://javabynataraj.blogspot.com

76

http://javabynataraj.blogspot.com

77

http://javabynataraj.blogspot.com

78

http://javabynataraj.blogspot.com

79

http://javabynataraj.blogspot.com

80

http://javabynataraj.blogspot.com

81

http://javabynataraj.blogspot.com

82

http://javabynataraj.blogspot.com

83

http://javabynataraj.blogspot.com

84

http://javabynataraj.blogspot.com

85

http://javabynataraj.blogspot.com

86

http://javabynataraj.blogspot.com

87

http://javabynataraj.blogspot.com

88

http://javabynataraj.blogspot.com

89

http://javabynataraj.blogspot.com

90

http://javabynataraj.blogspot.com

91

http://javabynataraj.blogspot.com

92

http://javabynataraj.blogspot.com

93

http://javabynataraj.blogspot.com

94

http://javabynataraj.blogspot.com

95

http://javabynataraj.blogspot.com

96

http://javabynataraj.blogspot.com

97

http://javabynataraj.blogspot.com

98

http://javabynataraj.blogspot.com

99

http://javabynataraj.blogspot.com

100

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

http://javabynataraj.blogspot.com

107

http://javabynataraj.blogspot.com

108

http://javabynataraj.blogspot.com

109

http://javabynataraj.blogspot.com

110

http://javabynataraj.blogspot.com

111

http://javabynataraj.blogspot.com

112

http://javabynataraj.blogspot.com

113

http://javabynataraj.blogspot.com

114

http://javabynataraj.blogspot.com

115

http://javabynataraj.blogspot.com

116

http://javabynataraj.blogspot.com

117

http://javabynataraj.blogspot.com

118

http://javabynataraj.blogspot.com

119

http://javabynataraj.blogspot.com

120

http://javabynataraj.blogspot.com

121

http://javabynataraj.blogspot.com

122

http://javabynataraj.blogspot.com

123

http://javabynataraj.blogspot.com

124

http://javabynataraj.blogspot.com

125

http://javabynataraj.blogspot.com

126

http://javabynataraj.blogspot.com

127

http://javabynataraj.blogspot.com

128

http://javabynataraj.blogspot.com

129

http://javabynataraj.blogspot.com

130

http://javabynataraj.blogspot.com

131

http://javabynataraj.blogspot.com

132

http://javabynataraj.blogspot.com

133

http://javabynataraj.blogspot.com

134

http://javabynataraj.blogspot.com

135

http://javabynataraj.blogspot.com

136

http://javabynataraj.blogspot.com

137

http://javabynataraj.blogspot.com

138

http://javabynataraj.blogspot.com

139

http://javabynataraj.blogspot.com

140

http://javabynataraj.blogspot.com

141

http://javabynataraj.blogspot.com

142

http://javabynataraj.blogspot.com

143

http://javabynataraj.blogspot.com

144

http://javabynataraj.blogspot.com

145

http://javabynataraj.blogspot.com

146

http://javabynataraj.blogspot.com

147

http://javabynataraj.blogspot.com

148

http://javabynataraj.blogspot.com

149

http://javabynataraj.blogspot.com

150

http://javabynataraj.blogspot.com

151

http://javabynataraj.blogspot.com

152

http://javabynataraj.blogspot.com

153

http://javabynataraj.blogspot.com

154

http://javabynataraj.blogspot.com

155

http://javabynataraj.blogspot.com

156

http://javabynataraj.blogspot.com

157

http://javabynataraj.blogspot.com

158

http://javabynataraj.blogspot.com

159

http://javabynataraj.blogspot.com

160

http://javabynataraj.blogspot.com

161

You might also like