Anda di halaman 1dari 26

Web Services. Web Services.

A programmable
component
Provides a particular
function for an
application
Can be published,
located, and invoked
across the Web
COM
Component
Platform:
Windows
RPC
Difficult to run
through
Firewalls
Previously
XML Web Service?
across the Web
Based on Internet
technologies
SOAP, XML and
transport protocols
such as HTTP, SMTP
Component
Platform:
any platform
SOAP over
HTTP
Easy to run
through
Firewalls
Firewalls
.NET
Why Use XML Web Services?
weather
XHL web 8erv|ce
P|c| your desl|ral|or:
Tre Wealrer
Forecasl ca||s lor:
Ra|n Ra|n
Redrord
Northw|nd Traders Trave| 8|te Northw|nd Traders Trave| 8|te
|nternet |nternet
Exchange Rate
XHL web 8erv|ce
Forecasl ca||s lor:
Tre excrarge rale |s:
we car l|y you lrere lor or|y:
Ra|n Ra|n
S1.5
S1,999.98
A|rfare
0atabase
A|rfare
XHL web 8erv|ce
Evolution to Web Services
XML Is the Glue
Presentation Presentation
Connecting Connecting
Applications Applications
Connectivity Connectivity
Browse Browse
the Web the Web
Program Program
the Web the Web
Applications Applications
Connect Connect
the Web the Web
Data Access Application Models
Evolution of data access
C||erl |og|c
8us|ress |og|c
0ala slorage
"Th|n" 6||ent
"Fat" 6||ent
XHL
serv|ce
XHL
web
serv|ce
1-T|er
(mono||th|c}
0ala slorage
3-T|er
N-T|er
2-T|er
|nternet
Web Services Overview
What Is a Web Service?
The solution? Web Services!
A Web Service exposes functionality to a consumer
Over the Internet or intranet
A programmable URL
Functions you can call over the Internet Functions you can call over the Internet
Based on Web standards
HTTP, XML, SOAP, WSDL, UDDI, with more to come
Can be implemented in any language on any
platform
Black boxes
Component-like, reusable
Web Services Overview
What Is a Web Service?
A Web Service combines the best features
of distributed computing and portals and
eliminates the worst
Provides a mechanism for invoking methods Provides a mechanism for invoking methods
remotely
Uses Web standards (e.g. HTTP, XML) to do so
Web Services Overview
What Is a Web Service?
Web Services allow you to interconnect:
Different companies
Many/any devices
Applications
Different clients Different clients
Not just browsers
Distribution and integration of application
logic
Enable the programmable Web
Not just the purely interactive Web
Web Services are loosely coupled
New paradigm for Internet development
Deliver applications as services
Richer, customer-driven experience
Continuous delivery of value/bits
Web Services Overview
What is a Web Service?
Continuous delivery of value/bits
Third-generation Internet
Web Services Overview
Evolution of the Web
HTML, XML
Generation 1
Static HTML
HTML
Generation 2
Web Applications
HTML
HTML, XML
HTML, XML
Generation 3
Web Services
Web Services Overview
Benefits
Everyone
Leverage existing infrastructure
Build or buy development decisions
Minimize development time/costs
Enterprises Enterprises
Integration imperative
Dynamic, easy B2B relationships
New Web-based businesses
Greater personalization
New services/new revenue streams
Be everywhere vs. single destination
Underlying Technologies
Web Services Stack
Description: Formal Service Descriptions: WSDL
Directory: Publish & Find Services: UDDI
Inspection: Find Services on server: DISCO
Ubiquitous Communications: Internet
Universal Data Format: XML
Wire Format: Service Interactions: SOAP
Simple, Open, Broad Industry Support
Network
XML Web Services Message Flow
Client
Web
Servic
SOAP
MESSAGE
SOAP
MESSAGE
Phase I
Serialize
Phase II Deserialize
SOAP
Request
Client
Proxy
Servic
e
SOAP
MESSAGE
SOAP
MESSAGE
Phase III
Serialize
Phase IV
Deserialize
SOAP
Response
Underlying Technologies
Web Services Stack
Discovery
Directory allows potential clients to locate
relevant Web Services
UDDI
Inspection allows you to locate documents about
Web Services located on at a given URL
DISCO
A Description language defines the format of
methods provided by a Web Service
WSDL
Underlying Technologies
Web Services Stack
Directory
http://www.uddi.org
uDDl uDDl uDDl uDDl
Dl5CO Dl5CO Dl5CO Dl5CO
Inspection
http://www.ibuyspy.com/ibuyspy.disco
Locate a Service
Link to Discovery Document (XML)
W
e
b

S
e
r
v
i
c
e

C
l
i
e
n
t
U
D
D
I

o
r
o
t
h
e
r
d
i
r
e
c
t
o
r
y

s
e
r
v
i
c
e
W5DL W5DL W5DL W5DL
5OAP 5OAP 5OAP 5OAP
Description
http://www.ibuyspy.com/ibuyspycs/InstantOrder.asmx?wsdl
Wire Format
Request Discovery Document
Return Discovery Document (XML)
Return Service Description (XML)
Return Service Response (XML)
Request Service
Request Service Description
W
e
b

S
e
r
v
i
c
e

C
l
i
e
n
t
W
e
b

S
e
r
v
i
c
e
Underlying Technologies
Web Service Wire Format - SOAP
The Web Service Wire Format specifies how
specific messages are exchanged
HTTP-GET
HTTP-POST
SOAP SOAP
HTTP-GET and HTTP-POST use a minimal
HTTP interface to invoke Web Services
Limited support for data types
SOAP provides a robust HTTP/XML
interface
Extensive support for data types
Guiding principle: Invent no new
technology
Builds on key Internet standards
SOAP HTTP + XML
SOAP
Overview
SOAP HTTP + XML
Submitted to W3C
The SOAP specification defines:
The SOAP message format
How to send messages
How to receive responses
Data encoding
Objects-by-reference
Distributed garbage collection
Bi-directional HTTP
Activation
SOAP
SOAP Is Not
Activation
Complicated
Doesnt try to solve every problem in distributed
computing
Can be easily implemented
SOAP
The HTTP Aspect
SOAP requests
PO51 /WebCa1cu1afo/Ca1cu1afo.asmx h11P/1.1 PO51 /WebCa1cu1afo/Ca1cu1afo.asmx h11P/1.1 PO51 /WebCa1cu1afo/Ca1cu1afo.asmx h11P/1.1 PO51 /WebCa1cu1afo/Ca1cu1afo.asmx h11P/1.1
Confenf Confenf Confenf Confenf- -- -1ype: fexf/xm1 1ype: fexf/xm1 1ype: fexf/xm1 1ype: fexf/xm1 Confenf Confenf Confenf Confenf- -- -1ype: fexf/xm1 1ype: fexf/xm1 1ype: fexf/xm1 1ype: fexf/xm1
5OAPAcf1on: hffp://fempu1.og/Add 5OAPAcf1on: hffp://fempu1.og/Add 5OAPAcf1on: hffp://fempu1.og/Add 5OAPAcf1on: hffp://fempu1.og/Add
Confenf Confenf Confenf Confenf- -- -Lengfh: 36 Lengfh: 36 Lengfh: 36 Lengfh: 36
<?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?>
<soap:Lnve1ope ...> <soap:Lnve1ope ...> <soap:Lnve1ope ...> <soap:Lnve1ope ...>
... ... ... ...
</soap:Lnve1ope> </soap:Lnve1ope> </soap:Lnve1ope> </soap:Lnve1ope>
SOAP Message
SOAP Envelope
SOAP Header
Headers
<heade> <heade> <heade> <heade> encloses headers
<Lnve1ope> <Lnve1ope> <Lnve1ope> <Lnve1ope> encloses payload
Protocol binding headers
The complete SOAP message
SOAP
Message Structure
SOAP Header
SOAP Body
Message Name & Data
Headers
XML-encoded SOAP message name
& data
<8ody> <8ody> <8ody> <8ody> contains SOAP message name
Individual headers
SOAP
SOAP Message Format
An XML document using the SOAP schema:
<?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?>
<soap:Lnve1ope ...> <soap:Lnve1ope ...> <soap:Lnve1ope ...> <soap:Lnve1ope ...>
<soap:heade ...> <soap:heade ...> <soap:heade ...> <soap:heade ...>
... ... ... ...
</soap:heade> </soap:heade> </soap:heade> </soap:heade>
<soap:8ody> <soap:8ody> <soap:8ody> <soap:8ody>
<Add xm1ns=hffp://fempu1.og/> <Add xm1ns=hffp://fempu1.og/> <Add xm1ns=hffp://fempu1.og/> <Add xm1ns=hffp://fempu1.og/>
<n1>12</n1> <n1>12</n1> <n1>12</n1> <n1>12</n1>
<n2>10</n2> <n2>10</n2> <n2>10</n2> <n2>10</n2>
</Add> </Add> </Add> </Add>
</soap:8ody> </soap:8ody> </soap:8ody> </soap:8ody>
</soap:Lnve1ope> </soap:Lnve1ope> </soap:Lnve1ope> </soap:Lnve1ope>
SOAP
Server Responses
Server replies with a result message:
h11P/1.1 200 Ok h11P/1.1 200 Ok h11P/1.1 200 Ok h11P/1.1 200 Ok
... ... ... ...
Confenf Confenf Confenf Confenf- -- -1ype:fexf/xm1 1ype:fexf/xm1 1ype:fexf/xm1 1ype:fexf/xm1
Confenf Confenf Confenf Confenf- -- -Lengfh: 391 Lengfh: 391 Lengfh: 391 Lengfh: 391
<?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?> <?xm1 ves1on=1.0?>
<soap:Lnve1ope ...> <soap:Lnve1ope ...> <soap:Lnve1ope ...> <soap:Lnve1ope ...>
<soap:8ody> <soap:8ody> <soap:8ody> <soap:8ody>
<Addkesu1f xm1ns=hffp://fempu1.og/> <Addkesu1f xm1ns=hffp://fempu1.og/> <Addkesu1f xm1ns=hffp://fempu1.og/> <Addkesu1f xm1ns=hffp://fempu1.og/>
<esu1f>2.6</esu1f> <esu1f>2.6</esu1f> <esu1f>2.6</esu1f> <esu1f>2.6</esu1f>
</Addkesu1f> </Addkesu1f> </Addkesu1f> </Addkesu1f>
</soap:8ody> </soap:8ody> </soap:8ody> </soap:8ody>
</soap:Lnve1ope> </soap:Lnve1ope> </soap:Lnve1ope> </soap:Lnve1ope>
SOAP
Encoding Complex Data
Data structures are serialized as XML:
<soap:Lnve1ope ...> <soap:Lnve1ope ...> <soap:Lnve1ope ...> <soap:Lnve1ope ...>
<soap:8ody> <soap:8ody> <soap:8ody> <soap:8ody>
<Gef5fockDafakesu1f xm1ns=hffp://fempu1.og/> <Gef5fockDafakesu1f xm1ns=hffp://fempu1.og/> <Gef5fockDafakesu1f xm1ns=hffp://fempu1.og/> <Gef5fockDafakesu1f xm1ns=hffp://fempu1.og/>
<esu1f> <esu1f> <esu1f> <esu1f>
<Desc1pf1on>P1asf1c Nove1f1es Lfd</Desc1pf1on> <Desc1pf1on>P1asf1c Nove1f1es Lfd</Desc1pf1on> <Desc1pf1on>P1asf1c Nove1f1es Lfd</Desc1pf1on> <Desc1pf1on>P1asf1c Nove1f1es Lfd</Desc1pf1on>
<P1ce>129</P1ce> <P1ce>129</P1ce> <P1ce>129</P1ce> <P1ce>129</P1ce>
<11cke>PLA5</11cke> <11cke>PLA5</11cke> <11cke>PLA5</11cke> <11cke>PLA5</11cke>
</esu1f> </esu1f> </esu1f> </esu1f>
</Gef5fockDafakseu1f> </Gef5fockDafakseu1f> </Gef5fockDafakseu1f> </Gef5fockDafakseu1f>
</soap:8ody> </soap:8ody> </soap:8ody> </soap:8ody>
</soap:Lnve1ope> </soap:Lnve1ope> </soap:Lnve1ope> </soap:Lnve1ope>
Open allows for other namespaces and
thus highly extensible
Ability to import other schemas & WSDL
Provides source for Web Services
WSDL
WSDL Elements
Provides source for Web Services
Provides both interface and implementation
details
Allows for separation of the two
3) Client requests discovery document
1) Client attempts to locate a Web service
2) URL to discovery document is returned
XML Web Services Infrastructure
Directory
Discovery
7) Client requests the web service
8) Web service returns result response
5) Client requests service description
6) Description document is returned
3) Client requests discovery document
4) Discovery document is returned
Description
Wire Format
Questions?

Anda mungkin juga menyukai