52
Introduction to Web Services Week I

Introduction to Web Services

  • Upload
    marrim

  • View
    36

  • Download
    0

Embed Size (px)

DESCRIPTION

Introduction to Web Services. Week I. Overview. Legacy Systems Contract Development Platforms Advantages Disadvantages. Introduction Definitions XML WS Architecture Styles Profiles Specifications Similar Efforts. http://cmer.cis.uoguelph.ca. 2. Introduction. - PowerPoint PPT Presentation

Citation preview

Page 1: Introduction to Web Services

Introduction to Web Services

Week I

Page 2: Introduction to Web Services

Overview

• Introduction• Definitions• XML• WS Architecture• Styles• Profiles• Specifications• Similar Efforts

http://cmer.cis.uoguelph.ca 2

Legacy Systems Contract Development Platforms Advantages Disadvantages

Page 3: Introduction to Web Services

Introduction

• Web Services - “a software system designed to support interoperable Machine to Machine interaction over a network” – W3C

• Public methods or APIs that can be accessed over a private network or a public network such as the Internet.

• Can enable applications to publish their functionality to select groups or even the entire world.

http://cmer.cis.uoguelph.ca 3

Page 4: Introduction to Web Services

Definitions

• "Web Services provide a simplified mechanism to connect applications regardless of the technology or devices they use, or their location. They are based on industry standard protocols with universal vendor support that can leverage the internet for low cost communications, as well as other transport mechanisms. The loosely coupled messaging approach supports multiple connectivity and information sharing scenarios via services that are self describing and can be automatically discovered." - http://roadmap.cbdiforum.com/reports/roi/

http://cmer.cis.uoguelph.ca 4

Page 5: Introduction to Web Services

More Definitions

• “Web services are a new way of connecting businesses. Web services are platform-neutral and vendor-independent protocols that enable any form of distributed processing to be performed using XML and Web-based technologies.” - www.dmreview.com/rg/resources/glossary.cfm

• “Web services are self-contained business functions that operate over the internet.” - http://www.studiodog.com/glossary-w.html

http://cmer.cis.uoguelph.ca 5

Page 6: Introduction to Web Services

XML

• Web service technologies are based on XML

• XML facilitates the sharing of structured data across different information systems (i.e Internet)

http://cmer.cis.uoguelph.ca 6

Page 7: Introduction to Web Services

XML Advantages

• Text-based

• Human and machine readable

• Strict syntax and parsing make it reliable International standards

• Validation

• Hierarchical structure is suitable for most types of data

• Platform independant

http://cmer.cis.uoguelph.ca 7

Page 8: Introduction to Web Services

XML Disadvantages

• Redundant with large amounts of data.

• Data redundancy storage, transmission and processing costs.

• Syntax is verbose

• XML namespaces are problematic and/or tricky to use.

• The distinction between content and attributes in XML seems unnatural to some and makes designing XML data structures harder.

http://cmer.cis.uoguelph.ca 8

Page 9: Introduction to Web Services

Architecture

http://cmer.cis.uoguelph.ca 9

Page 10: Introduction to Web Services

Web Services Stack

http://cmer.cis.uoguelph.ca 10

Page 11: Introduction to Web Services

Invocation

http://cmer.cis.uoguelph.ca 11

Page 12: Introduction to Web Services

UDDI

• Universal Description, Discovery & Integration• XML-based registry• Stores information about businesses and Web services• Enables people/businesses to:

– Publish their service information– Define how their services should interact– Discover other services

http://cmer.cis.uoguelph.ca 12

Page 13: Introduction to Web Services

UDDI (Cont.)

• Meant to be interrogated by SOAP messages

• Provides access to WSDL documents

http://cmer.cis.uoguelph.ca 13

Page 14: Introduction to Web Services

UDDI (Cont.)

Consists of 3 components:• White pages

– Address, contact and known identifiers of business• Yellow pages

– Industrial categorization based on standard taxonomies

• Green pages– Technical information about the services

http://cmer.cis.uoguelph.ca 14

Page 15: Introduction to Web Services

WSDL

• Web Service Description Language• Pronounced “wiz-del”• XML-based language for describing Web service

interfaces– Functions that service provides– Parameters the function requires– Results the function returns

• Specification is divided into 6 major elements…

http://cmer.cis.uoguelph.ca 15

Page 16: Introduction to Web Services

WSDL Elements

• “definitions” element

– Root element of WSDL document

– Defines name of Web service

– Declares namespaces used in the document

– Contains all other elements

http://cmer.cis.uoguelph.ca 16

Page 17: Introduction to Web Services

WSDL Elements (Cont.)

• “types” element

– Describes all data types to be used between the client and server

• Does not include XML Schema built-in simple types (i.e string, integers)

– If WSDL type is not specified then defaults to XML Schema type

http://cmer.cis.uoguelph.ca 17

Page 18: Introduction to Web Services

WSDL Elements (Cont.)

• “message” element

– Describes a one-way message (request or response)

• Message name

• Message parameters

• Message return values

http://cmer.cis.uoguelph.ca 18

Page 19: Introduction to Web Services

WSDL Elements (Cont.)

• “portType” element

– Combines multiple message elements to form a complete “round trip” operation

• i.e Can combine 1 request message and 1 response message into a single request/response operation

– Can define multiple operation

http://cmer.cis.uoguelph.ca 19

Page 20: Introduction to Web Services

WSDL Elements (Cont.)

• “binding” element

– Specifics of how service will be implemented on the wire

• “service” element

– Specified address for invoking service

– Most often a URL

http://cmer.cis.uoguelph.ca 20

Page 21: Introduction to Web Services

SOAP

• XML-based messaging protocol

• Can work over HTTP

– Communicates through proxies and firewalls

• Once stood for “Simple Object Access Protocol” but acronym has since been dropped as it was considered to be misleading

http://cmer.cis.uoguelph.ca 21

Page 22: Introduction to Web Services

SOAP Elements

• “envelope” element

– specifies that the XML document is a SOAP message; encloses the message itself.

• “header” element (optional)

– contains information relevant to the message, e.g., the date the message was sent, authentication data, etc.

http://cmer.cis.uoguelph.ca 22

Page 23: Introduction to Web Services

SOAP Elements (Cont.)

• “body” element

– includes the message payload.

• “fault” element (optional)

– carries information about a client or server error within a SOAP message.

http://cmer.cis.uoguelph.ca 23

Page 24: Introduction to Web Services

SOAP Request

POST /EndorsementSearch HTTP/1.1Host: www.snowboard-info.comContent-Type: text/xml; charset="utf-8"Content-Length: 261SOAPAction: "http://www.snowboard-info.com/EndorsementSearch"<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetEndorsingBoarder xmlns:m="http://namespaces.snowboard-

info.com"> <manufacturer>K2</manufacturer> <model>Fatbob</model> </m:GetEndorsingBoarder> </SOAP-ENV:Body></SOAP-ENV:Envelope>

http://cmer.cis.uoguelph.ca 24

Page 25: Introduction to Web Services

SOAP Response

<SOAP-ENV:Envelope

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Body> <m:GetEndorsingBoarderResponse

xmlns:m="http://namespaces.snowboard-info.com"> <endorsingBoarder>Chris

Englesmann</endorsingBoarder> </m:GetEndorsingBoarderResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>

http://cmer.cis.uoguelph.ca 25

Page 26: Introduction to Web Services

Styles

1. Remote Procedure Call (RPC)

2. Service-Oriented Architecture (SOA)

3. Representational State Transfer (REST)

http://cmer.cis.uoguelph.ca 26

Page 27: Introduction to Web Services

RPC

• Has familiar function/method call interface

• Interacts through WSDL

• First Web services focused on RPC

• Most widely used style

• Criticized for not being loosely coupled

– Requires mapping XML to other languages

http://cmer.cis.uoguelph.ca 27

Page 28: Introduction to Web Services

SOA

• Web services built on SOA concepts

• Basic unit of communication is the message (not operation)

– Message oriented services

• Supported by most major software vendors

• Loose coupling is more prominent than in RPC

http://cmer.cis.uoguelph.ca 28

Page 29: Introduction to Web Services

REST

• Emulates the HTTP protocol by restricting interface operations

– GET, PUT, DELETE

• Interaction with stateful resources rather than messages or operations

• WSDL 2.0 supports binding for all HTTP require methods

http://cmer.cis.uoguelph.ca 29

Page 30: Introduction to Web Services

Profiles

• A set of specifications with versions:

– i.e SOAP 1.1, WSDL 1.1 UDDI 2.0, XML Schema 1.0 (Basic profile)

• Published by the WS-I

• Improves the interoperability of Web services

http://cmer.cis.uoguelph.ca 30

Page 31: Introduction to Web Services

Specifications

• Extend Web service capabilities

• Generally referred to as WS-*

– WS-Security

– WS-Reliability

– WS-ReliableMessaging

– WS-Addressing

– WS-Transaction

– Etc.(Many more)

http://cmer.cis.uoguelph.ca 31

Page 32: Introduction to Web Services

Previous Efforts

1. RMI

2. CORBA

3. DCOM

http://cmer.cis.uoguelph.ca 32

Page 33: Introduction to Web Services

RPC

• Remote Procedure Call• Sun Microsystems developed the Open Network

Computing RPC (1987) – communication mechanism for NFS

• A remote function could be invoked as if it were a local one

• Open Software Foundation’ DCE (Distributed Computing Environment) 1989

• Microsoft RPC initiative based on DCE/RPC (1990)

http://cmer.cis.uoguelph.ca 33

Page 34: Introduction to Web Services

Java RMI

• Remote Method Invocation

• A mechanism that is part of the Java programming language

• Allows Java objects to invoke methods on objects from another JVM

• Object equivalent of RPC

• Core package of Java 1.1+

http://cmer.cis.uoguelph.ca 34

Page 35: Introduction to Web Services

CORBA

• Common Object Request Broker Architecture

• A standard defined by the Object Management Group (OMG, 1991)

• Enables software components written in multiple computer languages and/or running on multiple computers to work together

http://cmer.cis.uoguelph.ca 35

Page 36: Introduction to Web Services

DCOM

• Distributed Component Object Model

• Proprietary Microsoft technology

• Extends Microsoft's COM

• Deprecated in favor of Microsoft .NET

http://cmer.cis.uoguelph.ca 36

Page 37: Introduction to Web Services

Legacy Systems

• Web services can port legacy systems to communicate with the rest of the business

• Could be expensive but so is building a new system

• It’s a workaround, but it works.

http://cmer.cis.uoguelph.ca 37

Page 38: Introduction to Web Services

Contract First vs. Contract Last

• Relates to how and when the WSDL file is generated

• The client relies on the WSDL to understand the Web service interface

• The client is dependant on the Web service not to change

http://cmer.cis.uoguelph.ca 38

Page 39: Introduction to Web Services

Contract First

• The advised approach

• Generate the WSDL file before you create the Web service

• Most likely you will already know the method definitions before implementing the services

• Prevents the WSDL from changing if the Web service changes

http://cmer.cis.uoguelph.ca 39

Page 40: Introduction to Web Services

Contract Last

• Not advised• But most convenient• Create the Web services first• Use a utility that automatically generates the WSDL for

you• If you make changes to the service then it may change

the WSDL– Unexpected change negatively affect the client

http://cmer.cis.uoguelph.ca 40

Page 41: Introduction to Web Services

Popular Supported Platforms

• C/C++• .Net• Java• PHP• Python• Ruby (on Rails)

http://cmer.cis.uoguelph.ca 41

Page 42: Introduction to Web Services

Some Related Efforts

• BPEL• ebXML• DPWS• WSDM

http://cmer.cis.uoguelph.ca 42

Page 43: Introduction to Web Services

BPEL

• Business Process Execution Language • OASIS Standard• A language for specifying business-to-

business process behavior based on Web Services

• Builds on Web services standards

http://cmer.cis.uoguelph.ca 43

Page 44: Introduction to Web Services

ebXML

• Electronic Business using eXtensible Markup Language (e-business XML)

• Pronounced (ee-bee-ex-em-el)• A family of XML based standards for:

– Promoting an open, XML-based infrastructure – Enabling the global use of electronic business

information– Ensuring interoperability, security, and

consistency for all trading partners

http://cmer.cis.uoguelph.ca 44

Page 45: Introduction to Web Services

DPWS

• Devices Profile for Web Services• Defines a minimal set of implementation

constraints to enable secure Web service:– Messaging– Discovery– Description– Eventing on resource constrained devices

• A Web service comparison to Universal Plug and Play (UPnP)

http://cmer.cis.uoguelph.ca 45

Page 46: Introduction to Web Services

WSDM

• Web Services Distributed Management• Pronounced (wisdom)• A standard for managing and monitoring the

status of Web services• A Web service comparison to Simple

Network Management Protocol (SNMP)

http://cmer.cis.uoguelph.ca 46

Page 47: Introduction to Web Services

Advantages

• Interoperable– Vendor, platform, and language independent XML

technologies– Ubiquitous HTTP for transport– Client only needs WSDL– Service implementation does not matter to client

http://cmer.cis.uoguelph.ca 47

Page 48: Introduction to Web Services

Advantages (Cont.)

• Code Re-use– "write once, use anywhere" programming – Reduces development time

• Cost Savings– Reduces development time– Reduces operating costs

http://cmer.cis.uoguelph.ca 48

Page 49: Introduction to Web Services

Advantages (Cont.)

• Versatile– Can be accessed by humans via web-based

interfaces– Can be accessed by autonomous applications or

other We services– Web services can be combined to create new

services (Service Composition)– The implementation behind the service does not

change the service itself

http://cmer.cis.uoguelph.ca 49

Page 50: Introduction to Web Services

Disadvantages

• Overhead – Transmitting large amounts of data in XML could

be costly– Portability vs. efficiency– Not yet suitable for critical real-time applications

http://cmer.cis.uoguelph.ca 50

Page 51: Introduction to Web Services

Disadvantages (Cont.)

• Quality of Service– Reliability of connection– Availability of service– Performance of the service

• Reliability– HTTP is not a reliable protocol in that it doesn't

guarantee delivery or a response.– Avoid changes to service interface that

customers won’t expect

http://cmer.cis.uoguelph.ca 51