CS/INFO 330: Web Driven Web Applications Web Services Definition: - - PowerPoint PPT Presentation

cs info 330 web driven web applications
SMART_READER_LITE
LIVE PREVIEW

CS/INFO 330: Web Driven Web Applications Web Services Definition: - - PowerPoint PPT Presentation

CS/INFO 330: Web Driven Web Applications Web Services Definition: Web Services A standardized way of integrating Web- based applications, using XML to tag data SOAP to transport data Simple Object Access Protocol WSDL to


slide-1
SLIDE 1

CS/INFO 330: Web Driven Web Applications

Web Services

slide-2
SLIDE 2

Definition: Web Services

  • A standardized way of integrating Web-

based applications, using

  • XML to tag data
  • SOAP to transport data
  • Simple Object Access Protocol
  • WSDL to describe available services
  • Web Services Description Language
  • An Interface Description Language

(IDL)

  • UDDI to list available services
  • Universal Description, Discovery and

Integration

slide-3
SLIDE 3

Goals for B2B Integration

  • Service-Oriented Architecture
  • Redesign of middleware protocols
  • Standardization
slide-4
SLIDE 4

Service-Oriented

  • Service: procedure, method, or object

with stable published interface

  • Functionality always exposed as

services

  • Loosely coupled
  • Invoked by programs as well as users
slide-5
SLIDE 5

Middleware Redesign

  • Peer-to-Peer
  • No central coordinator
  • Between trust domains
  • Compatibility with Internet
slide-6
SLIDE 6

Web Services Integrating Between Companies

internal infrastructure

supplier customer warehouse

internal infrastructure internal infrastructure internal procurement requests internal functionality made available as a service Web service Web service Web service interactions based on protocols redesigned for peer to peer and B2B settings languages and protocols standardized, eliminating need for many different middleware infrastructures (need only the Web services middleware)

slide-7
SLIDE 7

Basic Web Services

  • Components:
  • communicate (SOAP)
  • describe services - IDL (WSDL)
  • directory service (UDDI)
slide-8
SLIDE 8

Minimalist Infrastructure ...

service provider service requestor

application object (client) application object (service provider) SOAP-based middleware SOAP-based middleware SOAP messages exchanged on top of, HTTP, SMTP, or other transport converts procedure calls to/ from XML messages sent through HTTP or other protocols.

slide-9
SLIDE 9

Using WSDL Specification

service provider service requestor

application object (client) application object (service provider) stub skeleton WSDL of service provider WSDL compiler (server side) WSDL compiler (client side) <operation name="orderGoods"> <input message = "OrderMsg"/ > </ operation> SOAP-based middleware SOAP-based middleware SOAP messages

Note all WSDL “processing” happens at development time.

slide-10
SLIDE 10

Using UDDI Registry

service descriptions

SOAP-based middleware

UDDI registry service provider service requestor

application object (client) application object (service provider) stub skeleton SOAP-based middleware SOAP-based middleware SOAP messages SOAP messages (to look for services) SOAP messages (to publish service description)

slide-11
SLIDE 11

Simple Object Access Protocol

  • Specifies:
  • message format for one-way comms
  • specification for SOAP RPC
  • rules for processing SOAP messages
  • rules for transport - HTTP and SMTP
slide-12
SLIDE 12

A SOAP Message

SOAP envelope SOAP header header block SOAP body body block

Header: info for intermediate nodes Body: actual message

slide-13
SLIDE 13

SOAP Message Example

<?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <m:reservation xmlns:m="http://travelcompany.example.org/reservation" env:role="http://www.w3.org/2003/05/soap-envelope/role/next" env:mustUnderstand="true"> <m:reference>uuid:093a2da1-q345-739r-ba5d-pqff98fe8j7d</m:reference> <m:dateAndTime>2001-11-29T13:20:00.000-05:00</m:dateAndTime> </m:reservation> <n:passenger xmlns:n="http://mycompany.example.com/employees" env:role="http://www.w3.org/2003/05/soap-envelope/role/next" env:mustUnderstand="true"> <n:name>Åke Jógvan Ø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> <p:departureDate>2001-12-14</p:departureDate> <p:departureTime>late afternoon</p:departureTime> <p:seatPreference>aisle</p:seatPreference> </p:departure> <p:return> <p:departing>Los Angeles</p:departing> <p:arriving>New York</p:arriving> <p:departureDate>2001-12-20</p:departureDate> <p:departureTime>mid-morning</p:departureTime> <p:seatPreference/> </p:return> </p:itinerary> <q:lodging xmlns:q="http://travelcompany.example.org/reservation/hotels"> <q:preference>none</q:preference> </q:lodging> </env:Body> </env:Envelope>

slide-14
SLIDE 14

SOAP over HTTP

service provider

SOAP engine service implementation (other tiers) HTTP engine

service requestor

HTTP engine client implementation (other tiers) SOAP engine

slide-15
SLIDE 15

Simple Implementation

service requestor

client implementation HTTP engine client stub SOAP engine

invokes the service as a local call invoke SOAP engine to prepare SOAP message packages SOAP into HTTP and passes it to an HTTP client that sends it to the provider

service provider

service implementation HTTP server server stub SOAP router

invokes the local procedure of the service implementation the router parses the message, identifies the appropriate stub, and delivers the parsed message passes the content of the HTTP message to the router

slide-16
SLIDE 16

WSDL Specifications

  • Abstract part
  • signatures,
  • perations
  • like traditional IDL
  • Concrete part
  • bindings / services

/ ports

WSDL specification abstract part

types messages

  • perations

port types

concrete part

bindings services and ports

slide-17
SLIDE 17

Concrete Part

  • Interface Bindings
  • message encoding and protocol

bindings (e.g., RPC-style operation, communication via SOAP over HTTP)

  • Ports
  • interface binding + network address

where port type implementation can be accessed

  • Services
  • logical groupings of ports
slide-18
SLIDE 18

Automatic Generation of WSDL

service provider service requestor

application object (client) application object (service provider) stub skeleton WSDL of service provider WSDL compiler (server side) WSDL compiler (client side) SOAP-based middleware SOAP-based middleware SOAP messages WSDL generator

1 2

slide-19
SLIDE 19

WSDL Example: GreatH Hotel Reservation Service

<?xml version="1.0" encoding="utf-8" ?> <description xmlns="http://www.w3.org/@@@@/@@/wsdl" targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc" . . . > . . . </description>

WSDL 2.0 empty shell (Example taken from W3C’s WSDL primer)

slide-20
SLIDE 20

Message Types

<?xml version="1.0" encoding="utf-8" ?> <description xmlns="http://www.w3.org/@@@@/@@/wsdl" targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc" xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc" . . . > ... <types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://greath.example.com/2004/schemas/resSvc" xmlns="http://greath.example.com/2004/schemas/resSvc"> <xs:element name="checkAvailability" type="tCheckAvailability"/> <xs:complexType name="tCheckAvailability"> <xs:sequence> <xs:element name="checkInDate" type="xs:date"/> <xs:element name="checkOutDate" type="xs:date"/> <xs:element name="roomType" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:element name="checkAvailabilityResponse" type="xs:double"/> <xs:element name="invalidDataError" type="xs:string"/> </xs:schema> </types> . . . </description>

slide-21
SLIDE 21

Interface Definition

<?xml version="1.0" encoding="utf-8" ?> <description xmlns="http://www.w3.org/@@@@/@@/wsdl" targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc" xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc" . . . xmlns:wsdlx="http://www.w3.org/@@@@/@@/wsdl-extensions"> . . . <types> ... </types> <interface name = "reservationInterface" > <fault name = "invalidDataFault" element = "ghns:invalidDataError"/> <operation name="opCheckAvailability" pattern="http://www.w3.org/@@@@/@@/wsdl/in-out" style="http://www.w3.org/@@@@/@@/wsdl/style/iri" wsdlx:safe = "true"> <input messageLabel="In" element="ghns:checkAvailability" /> <output messageLabel="Out" element="ghns:checkAvailabilityResponse" /> <outfault ref="tns:invalidDataFault" messageLabel="Out"/> </operation> </interface> . . . </description>

slide-22
SLIDE 22

Bindings

Specifies how messages can be exchanged

<?xml version="1.0" encoding="utf-8" ?> <description xmlns="http://www.w3.org/@@@@/@@/wsdl" targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc" xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc" xmlns:wsoap= "http://www.w3.org/@@@@/@@/wsdl/soap" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> . . . <types> . . . </types> <interface name = "reservationInterface" > ... </interface> <binding name="reservationSOAPBinding" interface="tns:reservationInterface" type="http://www.w3.org/@@@@/@@/wsdl/soap" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"> <operation ref="tns:opCheckAvailability" wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/> <fault ref="tns:invalidDataFault" wsoap:code="soap:Sender"/> </binding> . . . </description>

slide-23
SLIDE 23

Service Definition

Where can the service be accessed

<?xml version="1.0" encoding="utf-8" ?> <description xmlns="http://www.w3.org/@@@@/@@/wsdl" targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc" xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc" xmlns:wsoap= "http://www.w3.org/@@@@/@@/wsdl/soap" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> . . . <types> . . . </types> <interface name = "reservationInterface" > . . . </interface> <binding name="reservationSOAPBinding" interface="tns:reservationInterface" . . . > . . . </binding> <service name="reservationService" interface="tns:reservationInterface"> <endpoint name="reservationEndpoint" binding="tns:reservationSOAPBinding" address ="http://greath.example.com/2004/reservation"/> </service> </description>

slide-24
SLIDE 24

Documenting the Service

<?xml version="1.0" encoding="utf-8" ?> <description . . . > <documentation> This document describes the GreatH Web service. Additional application-level requirements for use of this service -- beyond what WSDL 2.0 is able to describe -- are available at http://greath.example.com/2004/reservation-documentation.html </documentation> . . . </description>

slide-25
SLIDE 25

The Whole Picture

<?xml version="1.0" encoding="utf-8" ?> <description xmlns="http://www.w3.org/@@@@/@@/wsdl" targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc" xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc" xmlns:wsoap= "http://www.w3.org/@@@@/@@/wsdl/soap" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsdlx= "http://www.w3.org/@@@@/@@/wsdl-extensions"> <documentation> This document describes the GreatH Web service. Additional application-level requirements for use of this service -- beyond what WSDL 2.0 is able to describe -- are available at http://greath.example.com/2004/reservation-documentation.html </documentation> <types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://greath.example.com/2004/schemas/resSvc" xmlns="http://greath.example.com/2004/schemas/resSvc"> <xs:element name="checkAvailability" type="tCheckAvailability"/> <xs:complexType name="tCheckAvailability"> <xs:sequence> <xs:element name="checkInDate" type="xs:date"/> <xs:element name="checkOutDate" type="xs:date"/> <xs:element name="roomType" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:element name="checkAvailabilityResponse" type="xs:double"/> <xs:element name="invalidDataError" type="xs:string"/> </xs:schema> </types> <interface name = "reservationInterface" > <fault name = "invalidDataFault" element = "ghns:invalidDataError"/> <operation name="opCheckAvailability" pattern="http://www.w3.org/@@@@/@@/wsdl/in-out" style="http://www.w3.org/@@@@/@@/wsdl/style/iri" wsdlx:safe = "true"> <input messageLabel="In" element="ghns:checkAvailability" /> <output messageLabel="Out" element="ghns:checkAvailabilityResponse" /> <outfault ref="tns:invalidDataFault" messageLabel="Out"/> </operation> </interface> <binding name="reservationSOAPBinding" interface="tns:reservationInterface" type="http://www.w3.org/@@@@/@@/wsdl/soap" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"> <fault ref="tns:invalidDataFault" wsoap:code="soap:Sender"/> <operation ref="tns:opCheckAvailability" wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/> </binding> <service name="reservationService" interface="tns:reservationInterface"> <endpoint name="reservationEndpoint" binding="tns:reservationSOAPBinding" address ="http://greath.example.com/2004/reservation"/> </service> </description>