Skip to content

Instantly share code, notes, and snippets.

@GoSteven
Created June 14, 2012 03:08
Show Gist options
  • Save GoSteven/2927829 to your computer and use it in GitHub Desktop.
Save GoSteven/2927829 to your computer and use it in GitHub Desktop.
Web Service review

RECITE

Gateways

  • Inclusive Gateway -- merging Inclusive Gateway
    decisions may produce more that one possible outcome
  • Parallel Gateways
  • Exclusive Gateway

Web Service Foundations: SOAP, WSDL, UDDI

Web Service as a middleware: Service Bus

Key concept:

a Web service is a software system designed to support interoperable machine-to-machine interaction over a network.

Three Roles:

  • service provider: develops an electronic service and registers its description at a publicly accessible service registry.
  • service registry: hosts web services
  • service requestor: query the registry to find a electronic service that meets requirments.

The client looks for a web service in the UDDI register

Downloads the web service's WSDL to build or generate a proxy(stub) for the web service

SOAP

Simple Object Access Protocol

SOAP Encoding Style

  • SOAP Remote Procedure Call (RPC) encoding, also know as Section 5 encoding, which is defined by the SOAP 1.1 specification
  • SOAP Remote Procedure Call Literal encoding (SOAP RPC-literal), which uses RPC methods to make calls but uses an XML do-it-yourself method for marshalling the data
  • SOAP document-style encoding, which is also know as messaage-style or document-literal encoding.

WSDL

Web Services Description Language

It uses XML syntax, it describes a service in terms of the operations that make up the service, the messages that each operation requires and the parts from which each message is composed.

WSDL Main Elements:

  • definitions
  • types
  • message
  • portType
  • operation
  • binding a binding defines message encoding format and protocol details for operatinos and messages definedby a particular portType
    • wsdl:binding
      • name attribute
      • type attribute
    • soap:binding
      • protocol format: Envelope, Header and Body
      • style attribute: rpc or document
      • transport attribute: transport protocol (HTTP, SMTP)
    • wsdl:operation
      • portTye <-> binding
    • soap:operation
    • soap:body

Web Service Development

  • Bottom-up
  • Top-down

UDDI Advertising/Discovering Services

Registration deal with persistently storing the Web service.

Two type of registries:

  • document-based registry
  • meta-data-based service registry

Service Discovery

  • static
  • dynamic

UDDI Basic Data Types

  • BusinessEntity
  • BusinessService and BindingTemplates
  • tModel

UDDI registry can be browsed by human , can be programmatically accessed

WS-*: Web Service Extensions

WS- : Second generation of Web services standards/specifications

WS-ReliableMessaging provides a framework capable of guaranteeing:

  • service providers will be notified of the success or failure of message
  • messages sent with specific sequence-related rules will arrive as intended

We Service and Business Processes

What is a business process?

A collection of activities performed by human uses or software applications that together form the different steps to be completed to achieve a particular business objective.

Processing Modeling

  • tasks: a process that cannot be subdivided(unit of work)
  • sequence: some tasks need to be performed in a strict order
  • selection: certain tasks do not need to be carried out
  • parallel: some tasks can be performed in parallel
  • synchronization: some task need to wait for the result of previous tasks
  • iteration: some tasks need to be repeated

Scheduling and work allocation are the basic tasks of a WfMS(Workflow Management Systems)

  • System Workflows
    • automatically
    • no user interface/interaction
    • typical candidates: Enterprise Application Integrations
  • Human Workflows
    • manual (or automated)
    • Humans are involved
    • typical candidates: Human-intensive domain(e.g., Logistics, HR)

Workflow Concepts

Routing:

  • Parallel routing
    • AND-split
  • Selective routing:
    • OR-split
  • Synchronization
    • AND-join
    • XOR-join

Enactment: when a work item is assigned to a resource, it only becomes a activity when the resource accepts it from his "in tray"

There are three types of triggers for work item enactment:

  • a resource initiative
  • an external event
  • a time signal

Modeling Workflows with Petri Nets

Classical Petri Nets

  • a place(circle)
  • a transition(square)

BPMN

Business Process Modeling Notation

It can generate an executable language(BPEL) for business level notation

BPMN diagram elements

  • Flow Objects
    • Events
    • Activities
    • Gateways
  • Connection Objects
    • Sequence Flow
    • Message Flow
    • Association
  • Swimlanes
    • Pools
    • Lanes
  • Artefacts
    • Data Object
    • Group
    • Annotation

BPEL

Business Process Execution Language

Web Service Coordination

A collection of valid conversations supported by a Web service is called co-ordination protocol

WS Orchestration vs. Choreography

  • Orchestration describes how Web services can interact with each other at the message level, including the business logic and execution order of the interactions from the perspective and under control of a single endpoint (single party)
  • Choreography is associated with the public (globally visible) message exchanges, rule of interaction and agreements that occur between multiple business process endpoints.
    Choreography tracks the sequence of messages that may involve multiple parties and multiple sources, and described from the perspectives of all parties(common view)

orchestration: single executable process - Web service composition choreography: multi-party collaboration

bpel examples ...

REST-based Web Services (I)

An architectural style guide of building networked systems.

Objective: Expose resources on a networked system

REST itself is not an official standard specification or even a recommendation. It is just a design guideline

URL: Uniform Resource Locator

REST is an acronym standing for Representational State Transfer

REST principle says: URI needs to contain the state within it, not just a key to the state stored on the server

  • a RESTful service requires that the state stay on the client side

  • client transmit the state to the server for every request that needs it

  • server can nudge the client toward new state by sending 'next links' for the client

  • server does not keep state of its own on behalf of a client

  • PUT: Create a new Resource (new URI) or update a resource (existing URI)

  • GET: Retrieve a representation of a resource

  • POST: Modify the state of a resource. POST is a read-write operation and may change the state of the resource and provoke side effects on the server. Web browsers warn you when refreshing a page generated with POST

  • DELETE: Clear a resource, after the URI is no longer valid

  • HEAD and OPTIONS

Idempotent

POST and PUT

  • Post creates a new resource
    • but the server decides on that resource's URI
  • PUT create a new resource when you know the URI for the new resoure
    • Always use PUT to update an existing resource

Positive aspects of REST

  • Faster response time(caching)
  • Reduce server load(caching)
  • Improved server scalability and easier load-balancing(no session state)
  • Client software can be used (uniform interface)
  • Can be implemented with any server-side technology
  • HTTP client libraries are widespread
  • Easy to serve different types of content such as images, videos, xl-sheets
  • The "web" in "Web services" is for real

Negative aspects of REST

  • No interface description language like IDL or WSDL
  • Low tooling support for automation(but frameworks are coming along)
  • Most web browsers don't know PUT and DELETE
  • Not complex enough for vendors to make expensive "enterprise" products

Data Services: XML Transformations and Query Techniques

Data services focus on providing "uniform access" to data for its clients.

XPath

text() comment() node()

parent::person[attribute::name='Sue']

XSLT

XQuery

XQuery is a case-sensitive language.

Keywords are in lower-case.

Uses of XQuery

  • Extraction information from a relational database for use in a web service
  • Generating reports on data stored in a database for presentation on the Web as XHTML
  • Searching textual documents in a native XML database and presenting the results
  • Pulling data from databases or packaged software and transforming it for application integration
  • Combining content from traditionally non-XML sources to implement content management and delivery
  • Ad hoc querying of standalone XML documents for the purposes of testing or research

Exposing Data as Services

  • A data service is a query-based access layer that facilitates the ability of calling applications to access and manage disparate data
  • Data services give consumers an easy-to-use, uniform model for accessing heterogeneous, distributed data
  • From the perspective of the data consumer, Data Services Platform presents a sensible, uniform model for getting and using information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment