web service protocols web service specifications
Download
Skip this Video
Download Presentation
Web Service Protocols —Web service specifications

Loading in 2 Seconds...

play fullscreen
1 / 96

Web Service Protocols —Web service specifications - PowerPoint PPT Presentation


  • 141 Views
  • Uploaded on

课程名:以服务为中心的软件开发设计与实现. Web Service Protocols —Web service specifications. Outline. Overview of Web Services XML and XML Schema The Communication Protocol (SOAP) Web Services Description (WSDL) Web Services Publication and Discovery (UDDI) Summary. Overview of Web Services. Web Services.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Web Service Protocols —Web service specifications' - zody


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
outline
Outline
  • Overview of Web Services
  • XML and XML Schema
  • The Communication Protocol (SOAP)
  • Web Services Description (WSDL)
  • Web Services Publication and Discovery (UDDI)
  • Summary
web services
Web Services
  • Web Services: Web services are a recent set of technology specifications that leverage existing proven open standards such as XML, URL, and HTTP to provide a new system-to-system communication standard.
  • Working Definition:Network-resident software Services accessible via standardized protocols
    • Simple Object Access Protocol (SOAP): very flexible remote procedure call
  • Lots of interest in trade press, academic community, standards bodies, . . .
  • Applications in e-commerce, telecom, science, GRID, government, education, . . .
categories of web services
Categories of Web Services
  • Business-Oriented Web Services
    • ERP,CRM,
    • Application system integration
  • Consumer-Oriented Web Services
    • B2C website, across multi B2C systems
  • Device-Oriented Web Services
    • Support the services across different kinds of services. E.g weather report, email service
  • System-Oriented Web Services
    • Authentication
    • Monitoring
    • QoS
soa model
SOA Model
  • As a distributed computing architecture, Web Services

are the most important implementation for SOA.

  • SOA Model is Web Services Concept Architecture.
concept in soa model
Concept in SOA Model
  • Role
    • Services Provider
    • Services Requestor
    • Services Registry
  • Operation
    • Publish
    • Find
    • Bind
  • Key Component
    • Services
    • Services Description
core standards in soa model
Core Standards in SOA Model
  • Some Standards
    • Web Services Description Language (WSDL)
    • Universal Description, Discovery and Integration (UDDI)
    • Simple Object Access Protocol (SOAP)
    • Web Service Flow Language (BPEL)
    • ……
the level model of soa development
The Level Model of SOA Development

Services Consumer

Business Process

Integration Architecture

Qos Security Management

Services

Components

Services Provider

Existing Application Resources

the processes of web services
The Processes of Web Services

Simplify and/or automate web Services

  • Discovery
    • What properties should be described?
    • How to efficiently query against them?
  • Composition
    • Specifying goals of a composition
    • Specifying constraints on a composition
    • Building a composition
    • Analysis of compositions
  • Invocation
    • Keeping enactments separated
    • Providing transactional guarantees
  • Monitoring
    • How to track enactments
    • Recovering from failedenactments
web services standard stack
Web Services Standard Stack

Web Services

composition:

WSFL,BPEL4WS

WS-CDL

WS-CAF

Web Services

Security:

XML-Encryption

XML-Signature

WS-Security

WS-SecureConversation

WS-SecurityPolicy

WS-Trust

Web Services

Transaction:

WS-Coordination

WS-Transaction

WS-AtomicTransaction

WS-BusinessActivity

Web Services

Management:

WSDM, WS-Manageability

SPML, WS-Provisioning

Publishing and

discovery:

UDDI,

WSIL,

WS-Discovery

Services Description Layer: WSDL, WSCL, WSCI,WS-MetadataExchange, WS-Policy

XML messaging layer: SOAP , WS-Addressing, WS-Notification, WS-Eventing,

WS-Enumeration, WS-MessageDelivery, WS-Reliability,WS Reliable Messaging,

WS-Resources WS-Transfer

Transport layer: HTTP, SMTP, FTP, etc.

web service core standards
Web Service Core Standards

BPEL

Behavior

WSDL

Interface

SOAP

IBM WebSphere

Microsoft .Net

Sun J2EE

Message

XML Schema

Type

XML

Data

Implementation Platforms

Web Service Standards

the structure of xml
The structure of XML
  • Tag: label for a section of data
  • Element and Subelement: section of data beginning with and ending with matching

Elements must be properly nested

    • Proper nesting
      • ….
    • Improper nesting
      • ….
    • Formally: every start tag must have a unique matching end tag, that is in the context of the same parent element.
the structure of xml1
The structure of XML
  • Every document must have a single top-level element

Hayes

Main

Harrison

A-102

Perryridge

400

. .

Top level element

the structure of xml2
The structure of XML
  • Attribute
    • Elements can haveattributes

A-102

Perryridge

400

    • Attributes are specified by name=value pairs inside the starting tag of an element
    • An element may have several attributes, but each attribute name can only occur once
the structure of xml3
The structure of XML
  • Differences between element and attribute

A-102

Perryridge

400

Attribute can only occur once

Attributes cannot be nested

Attributes have no order

the structure of xml4
The structure of XML
  • Well-Formed XML Documents
    • There is only one outermost element in the document (called the root element)
    • Each element contains an opening and a corresponding closing tag
    • Tags can not overlap, as in LeeHong
    • Attributes within an element have unique names
    • Element and tag names must be permissible
the structure of xml5
The structure of XML
  • The Tree Model of XML Documents
    • There is exactly one root
    • There are no cycles
    • Each node, other than the root, has exactly one parent
    • Each node has a label. Element or attribute
    • The order of elements is important
xml example
XML Example

Where is your draft?

Grigoris, where is the draft of the paper

you promised me last week?

namespace
Namespace
  • XML data has to be exchanged between organizations
  • Same tag name may have different meanings in different organizations, causing confusion on exchanged documents
  • Specifying a unique string as an element name avoids confusion
  • Better solution: use unique-name:element-name
  • Avoid using long unique names all over document by using XML Namespaces
namespace1
Namespace

>

Three namespaces:

schema namespace

datatype namespace

myNS namespace

sample code read xml
Sample Code—Read XML

import java.net.URL;

import org.dom4j.Document;

import org.dom4j.DocumentException;

import org.dom4j.io.SAXReader;

public class Foo {

public Document parse(URL url) throws DocumentException {

SAXReader reader = new SAXReader();

Document document = reader.read(url);

return document;

}

}

  • public void bar(Document document) throws DocumentException {
  • Element root = document.getRootElement();
  • // iterate through child elements of root
  • for ( Iteratori = root.elementIterator(); i.hasNext(); ) {
  • Element element = (Element) i.next();
  • // do something
  • }
  • // iterate through child elements with element name "foo"
  • for ( Iteratori = root.elementIterator( "foo" ); i.hasNext(); ) {
  • Element foo = (Element) i.next();
  • // do something
  • }
  • // iterate through attributes of root
  • for ( Iteratori = root.attributeIterator(); i.hasNext(); ) {
  • Attribute attribute = (Attribute) i.next();
  • // do something
  • }
  • }
sample code write xml
Sample Code—Write XML

import org.dom4j.Document;

import org.dom4j.DocumentHelper;

import org.dom4j.Element;

public class Foo {

public void createDocument() {

Document document = DocumentHelper.createDocument();

Element root = document.addElement( "root" );

Element author1 = root.addElement( "author" )

.addAttribute( "name", "James" )

.addAttribute( "location", "UK" )

.addText( "James Strachan" );

Element author2 = root.addElement( "author" )

.addAttribute( "name", "Bob" )

.addAttribute( "location", "US" )

.addText( "Bob McWhirter" );

FileWriter out = new FileWriter( "foo.xml" );

document.write( out );

}

}

xml schema
XML Schema
  • Database schemas constrain what information can be stored, and the data types of stored values
  • schemas are very important for XML data exchange
    • Otherwise, a site cannot automatically interpret data received from another site
  • Two mechanisms for specifying XML schema
    • Document Type Definition (DTD)
    • XML Schema

Like DDL for database?

ddl example
DDL Example

/*Column Information For - psn.publisher*/

Field Type Collation Null Key Default Extra Privileges Comment

------ ---------------- --------------- ------ ------ ------- ------ ------------------------------- -------

id int(11) unsigned (NULL) NO PRI 0 select,insert,update,references

name varchar(255) utf8_general_ci NO select,insert,update,references

/*DDL Information For - psn.publisher*/

Table Create Table

--------- --------------------------------------------------------------------------------

publisher CREATE TABLE `publisher` (

`id` int(11) unsigned NOT NULL default '0',

`name` varchar(255) NOT NULL default '',

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Publisher information from DBLP'

xml schema1
XML Schema
  • XML Schema Supports
    • Typing of values
      • E.g. integer, string, etc
      • Also, constraints on min/max values
    • User defined types
    • Is itself specified in XML syntax, unlike DTDs
      • More standard representation, but verbose
    • Is integrated with namespaces (reuse and refine)
    • Many more features
      • List types, uniqueness and foreign key constraints, inheritance ..
slide29

….. definitions of customer and depositor ….

xml schema2
XML Schema
  • Element Types

with possible attributes:

    • ‘ type’ attribute

define the element type of this element: type=". . ." (more on types later)

    • cardinality constraints:

• minOccurs="x", where x may be any natural number (including zero)

• maxOccurs="x", where x may be any natural number (including zero) or unbounded

xml schema4
XML Schema
  • Attribute Types

with possible attributes

    • type=". . ."
    • use="x", corresponds to #OPTIONAL and #IMPLIED in DTDs
    • use="x" value=". . .", where x may bedefault or fixed
xml schema6
XML Schema
  • Data Types
    • Numerical data types, including integer, Short, Byte, Long, Float,Decimal
    • String data types, including string, ID, IDREF, CDATA, Language
    • Date and time data types
  • user-defined data types
    • simple data types and complex data types
xml schema7
XML Schema
  • Complex data type and extension data type
    • defined from already existing data types by defining some attributes (if any) and using sequence, all and choice.

minOccurs="0" maxOccurs="unbounded"/>

xml schema8
XML Schema

gang

Huang

xml schema9
XML Schema

Data Type Extension: existing data types can be extended by new elements or attributes

minOccurs="0" maxOccurs="1"/>

xml schema10
XML Schema
  • Restriction data type and simple data type

be defined by restricting existing data types

minOccurs="1" maxOccurs="2"/>

xml schema11
XML schema
  • Simple data types can also be defined by restricting existing data types.

why s imple o bject a ccess p rotocol
Why Simple Object Access Protocol
  • SOAP is an XML messaging protocol that is independent of any specific transport protocol.
  • Light weight replacement for complicated distributed object technology
  • Originally for BizTalk (Microsoft/UserLand/DevelopMentor)
  • Now a W3C standard
  • Based on XML
soap message structure
Envelope contains

Header

Body

Header is optional

Out-of-band information such as…

Authentication information

Message routes

Logging

Transaction flow

Body contains XML body of RPC call

SOAP Envelope

SOAP Header

Header Block

. . .

Header Block

SOAP Body

Body Block

. . .

Body Block

SOAP Message Structure
web services description language wsdl1
Web Services Description Language (WSDL)
  • WSDL is an XML-based interface definition language that separates function from implementation, and enables design by contract as recommended by SOA.
  • WSDL defines
    • What does Services do –interface
    • Access specification –how
    • Location of the Services –where
wsdl specification
WSDL Specification

types

message

message

message

porttype

operation

operation

operation

binding

service

port

ingredients of wsdl
Ingredients of WSDL

Supports

Interface

Port Type

Operation

How to invoke

Input & Output

Formats & Protocols

Accessspecification

Binding

Message

How to encode

Implements

Provides

Port

Services

Endpoints

main structure of wsdl
Main Structure of WSDL

XML schema types

definition of a message

a set of operations

communication protocols

a list of binding and ports

types
Types
  • define data types used in defining messages
  • XML Schema, DTD, and etc.
  • XML Schema must be supported by any vendor of WSDL conformant products

minOccur = “1” maxOccur=“10”/>

wsdl messages
WSDL Messages
  • A element defines the data elements of an operation
  • Each message can be the input or output of an operation, and may consist of one or more parts
  • A part resembles a parameter of a function

wsdl port types
WSDL PortTypes
  • The element is the most important WSDL element: it defines
    • a web Service
    • the operations that can be performed, and
    • the messages that are involved
  • The defines the connection point to a web Services, an instance of
    • It can be compared to a function library (or a module, or a class) in a traditional programming language
    • Each operation can be compared to a function in a traditional programming language
operation types
Operation Types
  • The request-response type is the most common operation type, but WSDL defines four types:
    • One-way: The operation can receive a message but will not return a response
    • Request-response: The operation can receive a request and will return a response
    • Solicit-response: The operation can send a request and will wait for a response
    • Notification: The operation can send a message but will not wait for a response
  • WSDL 1.2 adds: request – multiple response
operation types1
Operation Types

One-way:

Request-response:

binding
Binding
  • Binding defines how message are transmitted, and the location of the Services
  • element has two attributes:
    • type: the port type
    • name: name of the binding
  • has two attributes:
    • style: either “document” or “rpc”
    • transport: protocol to use, e.g., “http”
binding 2 alternatives to soap over http
Binding (2) – Alternatives to SOAP over http
  • XML documents over HTTP
    • Less need to do this with commonplace SOAP toolkits
    • But these are still web services
  • XML RPC
    • Simpler than SOAP and longer history
    • Limitations on objects that can be exposed
    • With current SOAP toolkit support, little reason to use
binding1
Binding

transport=“http://schemas.xmlsoap.org/soap/http” />

services
Services

My first Services

summary of wsdl
Summary of WSDL
  • Types
  • Message
  • Operation
  • PortType
  • Binding
  • Port
  • Service
why do we need a web services registry
Why Do We Need a Web Services Registry
  • Web services are valuable because of standardized payloads and transport definitions
    • The value is creating a web service that is used by many clients
  • Can’t happen unless the services are advertised to multiple consumers
slide63
UDDI
  • UDDI servers act as a directory of available services and service providers. SOAP can be used to query UDDI to find the locations of WSDL definitions of services, or the search can be performed through a user interface at design or development time.
  • Data structure specification describes what kind of data is stored in UDDI.
  • The programmer’s API specification contains how a UDDI registry can be accessed.
  • The replication specification contains descriptions of how registries replicate information among themselves.
slide64
UDDI
  • Three basic functions
    • publish:how to register a web service
    • Search: how to find a specific web service
    • binding: How to connect to a web service
core uddi entities
Core UDDI Entities

businessEntity

businessService

Interface tModel

bindingTemplate

bindingTemplate

Interface tModel

businessService

bindingTemplate

summary1
Summary
  • As a distributed computing architecture,Web Services are the most important implementation for SOA;
  • Web Services: Flexible machine-machine interaction;
  • XML is a powerful language to describe data. It’s construct rules is defined by XML Schema.
  • SOAP is a light weight replacement for complicated distributed object technology which we use to wrap Web Services message;
  • The function and interface of Web Services is open by WSDL and the interaction between Web Services is presented by BPEL;
  • Universal Description, Discovery, and Integration (UDDI) is a technical specification for describing, discovering, and integrating web Services.
reference
A list of web service specifications. http://en.wikipedia.org/wiki/List_of_Web_service_specifications.

SOA & Webservices.http://www-900.ibm.com/developerWorks/cn/

webservices

WebServices. http://www.w3.org/2002/ws/

UeliWahli ,Thomas Kjaer…“WebSphere Version 6Web Services HandbookDevelopment&Deployment”,http://www.redbooks.ibm.com

/redbooks/pdfs/sg246461.pdf,2005

Stan Kleijnen,SrikanthRaju.An Open Web Services Archiecture.NewYork:

ACM Press,2003

XML.http://www.w3.org/TR/xml/

XML Schema. http://www.w3.org/TR/xmlschema11-1/

WSDL. http://www.w3.org/TR/wsdl

Tony Andrews, Francisco Curbera. Business Process Execution Language for Web Services Version 1.1.http://download.boulder.ibm.com/

ibmdl/pub/software/dw/specs/ws-bpel/ws-bpel.pdf

The Stencil Group.” The Evolution of UDDI ,UDDI.org White Paper”

http://www.uddi.org/pubs/the_evolution_of_uddi_20020719.pdf

Reference
thanks

Thanks!

HP: http://keg.cs.tsinghua.edu.cn/persons/tj/

Arnet: http://jietang.arnetminer.org/

uddi entities
UDDI Entities
  • businessEntity – provider of service
  • businessService – collection of related services
  • bindingTemplate- information necessary to use
  • tModel - “reusable concept” such as
    • Interface
    • Protocol used by web services
    • Category
  • publisherAssertion- relationship that business entity has with another businessEntity
  • Subscription – request to be informed of particular changes
businessentity identifying elements
businessEntity Identifying Elements
  • Uniquely identified by businessKey attribute
  • discoveryURLs
    • http://www.example.com?businessKey=uddi:example.com:registry:sales:53
      • Returns XML document of type businessEntity
    •     http://www.acmewidgets.com
  • name
    • Multiple names to do languages or abbreviations
    •   ........
    •   日本生花店
    •   ニッポンセイカテン
    •   NIPPON FLOWERS
    •   NF
    •   .....
  • description
    • Multiple descriptions potentially in multiple languages with xml:lang
businessentity identifiers and categories
businessEntity Identifiers and Categories
  • Optional IdentifierBag
    •    
  •         keyValue=”31-626-8655” />
  • Optional CategoryBag
    •   
    •     keyValue=”US-CA” />
tmodels
tModels
  • The “technical fingerprint”
    • tModel defines unique identifiers for interfaces and interface specifications
    • Once tModel is published service advertises compliance with the spec represented by including the correct tModelKey
  • Value sets
    • Categorization hierarchies
    • E.g. categoryBag and identifierBag have references to tModels with the system of values
  • Find qualifiers
    • find_businessuddi:uddi.org:findqualifier:sortbydateasc
tmodel structure1
tModel Structure
  • Exactly one non-empty name
  • Zero or more descriptions
  • Zero or more overviewDocs
    • useType=text
    • useType=wsdlInterface
  • identifierBag
    • Contains tModelKey which uniquely identifies tModel (inconsistent?)
    • Other logical identifiers
  • categoryBag
    • list of categories that describe specific aspects of the tModel
uddi apis
UDDI APIs
  • Inquiry
  • Publication
  • Subscription
  • Security
  • Custody Transfer
  • Replication
inquiry api patterns
Inquiry API Patterns
  • Browse
    • find_xx
  • Drill-down
    • Use browse then drill-down
    • get_xx
  • Invocation
    • Use browse and drilldown and get bindingTemplate
    • Invoke from bindingTemplate
inquiry api functions
Inquiry API Functions
  • find_binding
  • find_business
  • find_relatedBusinesses
  • find_service
  • find_tModel
  • get_bindingDetail
  • get_businessDetail
  • get_operationalInfo
  • get_serviceDetail
  • get_tModelDetail
public registries
Public Registries
  • IBM Public registry Registration: https://uddi.ibm.com/ubr/registry.html
  • inquiryURL= https://uddi.ibm.com/ubr/inquiryapi
  • publishURL= https://uddi.ibm.com/ubr/publishapi
  • Test registry Registration: https://uddi.ibm.com/testregistry/registry.html
  • inquiryURL= https://uddi.ibm.com/testregistry/inquiryapi publishURL= https://uddi.ibm.com/testregistry/publishapi
public registries1
Public Registries
  • HP
  • Registration: http://uddi.hp.com
  • inquiryURL = http://uddi.hp.com/ubr/inquire
  • publishURL = https://uddi.hp.com/ubr/publish
  • Microsoft
  • Registration: http://uddi.rte.microsoft.com inquiryURL=http://uddi.rte.microsoft.com/inquire publishURL=https://uddi.rte.microsoft.com/publish
  • SAP
  • Registration: http://udditest.sap.com inquiryURL=http://uddi.sap.com/UDDI/api/inquiry/ publishURL=https://uddi.sap.com/UDDI/api/publish/
connecting to uddi with net
Connecting to UDDI with .NET

public UddiConnectionInitializeConnection() {

string szInquiry = "http://test.uddi.microsoft.com/inquire"; string szPublish = "https://test.uddi.microsoft.com/publish"; string szExtension = "http://test.uddi.microsoft.com/extension.asmx";

string szUsername = null;

string szPassword = null;

UddiConnectionoConnection = null;

try {

oConnect = new UddiConnection(szInquiry, szPublish, szExtension, szUsername, szPassword);

System.Net.IWebProxyoProxy = System.Net.WebProxy("http://someproxy:80",true); oConnect.AutoGetAuthToken = true;

oConnect.HttpClient.Proxy = oProxy;

GetAuthTokenoGetToken = new GetAuthToken(szUsername, szPassword); oConnect.AuthInfo = oGetToken.Send(oConnect);

}

catch(InvalidUrlPassedExceptionoUddiEx) {

// Insert exception-handling code.

return null;

}

catch(UddiExceptionoUddiEx) {

// Insert exception-handling code.

return null;

}

return oConnect;

}

finding businesses with net
Finding Businesses with .NET

using Microsoft.Uddi;

try 

{// Create a connection to the UDDI node that is to be accessed.UddiConnectionmyConn = new UddiConnection("http://test.uddi.microsoft.com/inquire");// Create an object to find a business.FindBusinessfb = new FindBusiness("Fabrikam");// Send the prepared FindBusiness request over the connection.BusinessListbizList = fb.Send(myConn);// Report the summary result.Console.WriteLine("Found " + bizList.BusinessInfos.Count + " businesses");}catch (Microsoft.Uddi.UddiException e){ Console.WriteLine("UDDI error: " + e.Message); }catch (Exception gen){ Console.WriteLine("General exception: {0}", gen.Message);

}

publishing with net
Publishing with .NET
  • UddiConnection myConn = new UddiConnection(InquireTextbox.Text,PublishTextBox.Text);
  • myConn.AuthenticationMode = AuthenticationMode.UddiAuthentication;
  • myConn.Username = UserTextbox.Text;
  • myConn.Password = PasswordTextbox.Text;
  • // Create a named business entity.
  • BusinessEntity myBiz = new BusinessEntity(BusinessNameTextbox.Text);
  • // Use business entity to create an object to save a business.
  • SaveBusiness sb = new SaveBusiness(myBiz);
  • // Send the prepared save business request.
  • BusinessDetail savedBiz = sb.Send(myConn);
  • ReturnBiz.Text= savedBiz.BusinessEntities[0].Names[0].Text;
  • ReturnKey.Text= savedBiz.BusinessEntities[0].BusinessKey;
finding services with net
Finding Services with .NET

try {

UddiConnection conn = new UddiConnection("http://localhost/uddi/inquire.asmx");

FindService fs = new FindService(“holdem odds”);

ServiceList servList = fs.Send(conn);

// Display the service name and unique identifying key.

foreach (ServiceInfo servInfo in servList.ServiceInfos) { MessageBox.Show("Service: " + servInfo.Names[0].Text + " " + servInfo.ServiceKey);

}

}

catch (Microsoft.Uddi.UddiException ex) {

MessageBox.Show("UDDI Exception: " + ex.Message);

}

catch (Exception gen) {

MessageBox.Show("General Exception: " + gen.Message);

}

mapping wsdl to uddi
Mapping WSDL to UDDI
  • UDDI technote (V2.0 in August 2003) regarding
    • How to take about WSDL objects and store them in UDDI equivalents
    • Enables queries on WSDL constituents (portTypes, operations, ports)
ad