7083T - Service Oriented Architecture: Week 4 - Topic 3 Semantic in SOA
7083T - Service Oriented Architecture: Week 4 - Topic 3 Semantic in SOA
7083T - Service Oriented Architecture: Week 4 - Topic 3 Semantic in SOA
Week 4 Topic 3
Semantic in SOA
Step Composing SOA
The most fundamental components of
a Web services-based SOA.
Outcome Create the Web Browse the Web Program the Web
Web Service Architecture
"server"
Service provider
publish bind
(WSDL) (SOAP)
9
Basic Web Service Usage Scenario
2 http get
(manual) web
Web Service
service lookup
3 WSDL file Repository
(UDDI)
SOAP
messages
(http transport)
14
SOAP Message
SOAP messages consist of
Envelope: top element of XML message (required)
Header: general information on message such as security (optional)
Body: data exchanged (required)
Header
elements are application-specific envelope
may be processed and changed header
by intermediaries or recipient
Body
elements are application-specific body
processed by recipient only
Skeleton SOAP Message
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
...
...
</soap:Header>
<soap:Body>
...
...
<soap:Fault>
...
...
</soap:Fault>
</soap:Body>
</soap:Envelope>
Example: SOAP Message
<?xml version='1.0' ?>
Envelope
<env:Envelope xmlns:env="http://www.w3.org/2002/12/soap-envelope">
<env:Header>
<m:reservation xmlns:m=http://travelcompany.example.org/reservation
env:role=http://www.w3.org/2002/12/soap-envelope/role/next
SOAP attributes env:mustUnderstand="true">
<m:dateAndTime>2001-11-29T13:20:00.000-05:00</m:dateAndTime>
</m:reservation> Header
<n:passenger xmlns:n=http://mycompany.example.com/employees
env:role=http://www.w3.org/2002/12/soap-envelope/role/next
SOAP attributes
env:mustUnderstand="true">
<n:name>ke Jgvan yvind</n:name>
</n:passenger>
</env:Header>
<env:Body>
<p:itinerary xmlns:p="http://travelcompany.example.org/reservation/travel">
<p:departure>
<p:departing>New York</p:departing>
<p:arriving>Los Angeles</p:arriving>
Body
<p:departureDate>2001-12-14</p:departureDate>
</p:departure>
<p:return>
<p:departing>Los Angeles</p:departing>
<p:arriving>New York</p:arriving>
<p:departureDate>2001-12-20</p:departureDate>
</p:return>
</p:itinerary> 17
</env:Body>
Conversational Message Exchanges in SOAP
proposed
itinerary
alternatives
choice
SOAP RPC
Encapsulate RPC into SOAP messages
procedure name and arguments
response (return value)
processing instructions (transactional RPC!)
Example: Request message
<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2002/12/soap-envelope" >
<env:Header>
<t:transaction xmlns:t="http://thirdparty.example.org/transaction" transaction information
env:encodingStyle="http://example.com/encoding"
env:mustUnderstand="true" >5</t:transaction>
</env:Header>
<env:Body>
TID
<m:chargeReservation env:encodingStyle="http://www.w3.org/2002/12/soap-encoding"
method invocation
xmlns:m="http://travelcompany.example.org/">
<m:reservation xmlns:m="http://travelcompany.example.org/reservation">
<m:code>FT35ZBQ</m:code>
</m:reservation>
<o:creditCard xmlns:o="http://mycompany.example.com/financial"> parameter 1
<n:name xmlns:n="http://mycompany.example.com/employees">
ke Jgvan yvind </n:name>
<o:number>123456789099999</o:number>
<o:expiration>2005-02</o:expiration>
</o:creditCard>
parameter 2
</m:chargeReservation>
</env:Body>
</env:Envelope>
SOAP RPC
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset="utf-8"
Content-Length: nnnn HTTP response
<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2002/12/soap-envelope">
SOAP response message
</env:Envelope>
WSDL
3. WSDL Web Service Description
Language
Description of Web services in XML format
abstract description of operations and their parameters (messages)
binding to a concrete network protocol (e.g. SOAP)
specification of endpoints for accessing the service
Structure of a WSDL document
Types: structure
of messages
(protocol) Binding:
Operations concrete protocol
concrete
Port: Binding and Service: collection
a network address of related ports
26
Overview of Defining WSDL Services
1. Define in XML Schema the message types used when invoking the service:
MT1, MT2 etc.
2. Define (named) messages by using these types, e.g.
message m1 has type MT1
message m2 has type MT2 etc.
3. Define Services that consist of one or more operations; each operation is
implemented by the exchange of messages
service S offers operation O1; for executing O1 first send a request message m1,
then a response message m2 is returned
4. Define a Binding B to a specific protocol, e.g. SOAP
service S is implemented in SOAP; the SOAP messages are constructed from the
abstract messages m1 and m2 by, e.g. inlining the message as body of SOAP
messages
5. Service S is provided with binding B at the following URI's (called ports)
Example: Overall Document Structure
<?xml version="1.0">
<definitions name="StockQuote>
<types>
<schema>
definition of types in XML Schema
</schema>
</types>
<message name="GetTradePriceInput">
definition of a message....
</message>
<portType name="StockQuotePortType">
<operation name="GetLastTradePrice">
definition of an operation
</operation>
</portType>
<binding name="StockQuoteSoapBinding">
definition of a binding
</binding>
<service name="StockQuoteService">
<port name="StockQuotePort">
definition of a port
</port>
</service>
</definitions>
Example: Definition of Types
29
Example: Definition of Messages and
PortType
30
Example: Definition of Binding and Service
31
PortTypes
WSDL supports 4 message patterns that an endpoint (=service provider!) can
support for an operation
one-way: message is sent to service provider without expecting response
request-response: request is sent to service provider expecting response
solicit-response: provider sends a message and expects response
notification: message is sent by service provider
Message patterns are distinguished by the use of input/output elements
one way:
<wsdl:definitions .... > <wsdl:portType .... > *
<wsdl:operation name="nmtoken">
<wsdl:input name="nmtoken"? message="qname"/>
</wsdl:operation>
</wsdl:portType >
</wsdl:definitions>
request/response:
<wsdl:definitions .... >
<wsdl:portType .... > *
<wsdl:operation name="nmtoken" parameterOrder="nmtokens">
<wsdl:input name="nmtoken"? message="qname"/>
<wsdl:output name="nmtoken"? message="qname"/>
<wsdl:fault name="nmtoken" message="qname"/>*
</wsdl:operation
</wsdl:portType >
UDDI
4. UDDI Universal Description
Discovery and Integration
Standard for describing, publishing and finding web services
Still evolving
Use XML-based description files for services
Main components
White pages: basic contact information about an organization
Yellow pages: classification of organization based on industrial
categorization
Green pages: technical description of services offered by registered
organizations
Access to UDDI Registry
Standard UDDI API (accessible via SOAP)
Web browser
Data Structures (XML)
Business entity: general information + business services
Business services: business level description + binding templates
Binding templates: access point + tModel (service types)
34
tModel: abstract definition of a web service
Registering a WSDL Service in UDDI
1. Register a business
2. Register the abstract service definition (tModel)
3. Register the service implementation definition (BusinessService)