161
Web Services

JavaEra first pdf - WordPress.com//javabynataraj.blogspot.com 2. WEB-SERVICES .. - ~ ... sekhars--..---- ---- --.-..-.- ... + "WSDL" is an XML document,

  • Upload
    dinhanh

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Web Services

~- ~ ~.~ -- .. . . ...

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

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