INF5120 Modellbasert systemutvikling

1 / 60
About This Presentation
Title:

INF5120 Modellbasert systemutvikling

Description:

... contextual support, e.g. like auto-completion, suggestions for elements, etc. ... Useful in a UML-centric development method if the modelling environment supports ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 61
Provided by: uio

less

Transcript and Presenter's Notes

Title: INF5120 Modellbasert systemutvikling


1
INF5120Modellbasert systemutvikling
  • Web Services
  • XML Schema
  • WSDL
  • BPEL
  • Forelesning 26.03.2007
  • Roy Grønmo
  • roy.gronmo_at_sintef.no

2
Outline
  • Web Services Infrastructure and Architecture
  • XML Introduction
  • XML Schema
  • Web Service Description Language (WSDL)
  • Business Process Execution Language (BPEL)

3
Web Services Infrastructure and Architecture
4
What is a Web service?
  • The term Web services is confusing.
  • There are many things that are referred to as
    Web services.
  • Adding to the confusion is the term services
    which is interpreted differently by different
    people.

5
What is a Web service?
Web
service
6
Definition (W3C) Web service
  • A Web service is a software system designed to
    support interoperable machine-to-machine
    interaction over a network. It has an interface
    described in a machine-processable format
    (specifically WSDL). Other systems interact with
    the Web service in a manner prescribed by its
    description using SOAP-messages, typically
    conveyed using HTTP with an XML serialization in
    conjunction with other Web-related standards.
  • - W3C Web Services Glossary, http//www.w3.org/TR/
    ws-gloss/

7
Characteristics of a basic Web service
  • Fundamental requirements
  • It receives service requests and sends service
    replies over HTTP
  • Service requests input data/parameters
  • Service responses output data/parameters
  • Data is normally formatted as an XML document
  • SOAP (Simple Object Access Protocol)
  • Interface w/ operations and associated bindings
    and protocols are described using WSDL
  • Additionally, a Web service may
  • Be registered with a discovery agent through
    which it can be located, typically UDDI.

8
Web services stack
Technologystack
Conceptualstack
9
Web services a conceptual view
10
Web Services Architecture
BPEL
11
Relationship between Architecture model and Web
Services
UML Activity
BPEL
UML Interface
WSDL
UML Class
XML Schema
12
Model-driven Web Services Two alternatives
ATL
1
PIM (COMET models)
PSM (WS UML Profile)
Model-to-model
MOFScript
1
MOFScript
Model-to-text
Model-to-text
  • Transformation choices
  • fixed
  • config file
  • user is prompted

2
Web Service (XML, Textual)
1. Transformation in two steps via UML profile
2. Transformation in one step
transformation
13
XML Introduction
14
XML - a Metameta Language
XML
SGML
Metameta/How to define schema
MathML
XSL
SMIL
OFX
HTML
Meta/Schema
XSL Doc
HTML Doc
XML Doc
Instances/Documents
15
XML Schema to represent the DTD in XML syntax and
express additional constraints
RDF Resource Description Framework - to add
metadata
XSL(T) to rearrange/restructure an XML
document and to prepare a document for
rendering based on an XSL document
Document Type Definition (DTD)
XML Document
XML Query to query sets of XML documents
XPointer to position a cursor in an XML document
XLink to create complex links
16
Example XML Document
  • lt?XML version"1.0"?gt
  • ltmemo clearance-level 0 status draftgt
  • ltmemo-headergt
  • ltfromgtBrian Smithlt/fromgt
  • lttogtMary Brownlt/togt
  • ltdategtMarch 3, 1998lt/dategt
  • ltsubjectgtexcessive overtimelt/subjectgtlt/memo-header
    gt
  • ltmemo-bodygtltparagtThe Flame Project team has been
    working overtime for weeks and weeks. Lets take
    the group to lunch on Friday. lt/paragtlt/memo-bodygt
  • lt/memogt

17
Example XML Document
  • lt?XML version"1.0"?gt
  • ltmemo clearance-level 0 status draftgt
  • ltmemo-headergt
  • ltfromgtBrian Smithlt/fromgt
  • lttogtMary Brownlt/togt
  • ltdategtMarch 3, 1998lt/dategt
  • ltsubjectgtexcessive overtimelt/subjectgtlt/memo-header
    gt
  • ltmemo-bodygtltparagtThe Flame Project team has been
    working overtime for weeks and weeks. Lets take
    the group to lunch on Friday. lt/paragtlt/memo-bodygt
  • lt/memogt

Start- and end-tags come in pairs
18
the content of simple elementsappears between
start tag and end tag
  • lt?XML version"1.0"?gt
  • ltmemo clearance-level 0 status draftgt
  • ltmemo-headergt Text content
  • ltfromgtBrian Smithlt/fromgt
  • lttogtMary Brownlt/togt
  • ltdategtMarch 3, 1998lt/dategt
  • ltsubjectgtexcessive overtimelt/subjectgtlt/memo-header
    gt
  • ltmemo-bodygtltparagtThe Flame Project team has been
    working overtime for weeks and weeks. Lets buy
    pizza for the group on Friday. lt/paragtlt/memo-bodygt
  • lt/memogt

19
the content of compound elementsappears between
start tag and end tag
  • lt?XML version"1.0"?gt
  • ltmemo clearance-level 0 status draftgt
  • ltmemo-headergt
  • ltfromgtBrian Smithlt/fromgt
  • lttogtMary Brownlt/togt
  • ltdategtMarch 3, 1998lt/dategt
  • ltsubjectgtexcessive overtimelt/subjectgtlt/memo-header
    gt
  • ltmemo-bodygtltparagtThe Flame Project team has been
    working overtime for weeks and weeks. Lets buy
    pizza for the group on Friday. lt/paragtlt/memo-bodygt
  • lt/memogt

a compound element includes all of the
complete subelements the tags and content of the
subelements
20
Attributes in XML
  • In the document, we see
  • ltmemo clearance-level 0 status draftgt
  • Attributes are associated with elements.and the
    assignment of values to attributes always appear
    in the start tag for the element.

tag name
attribute name
attribute value
attribute name
attribute value
21
Namespaces Example
  • Slightly modified listings document
  • lt?xml version"1.0"gt
  • ltRecent-Listings Area"Raleigh Hills" Date"March
    97
  • xmlnshttp//www.century21.com/listings.dtd
  • xmlnsmls"urnuuidC2F41010-65B3-11d1-A29F-00AA
    00C14882" gt
  • ltFor-Salegt
  • ltHome id"h1"gt
  • ltAddressgt8225 SW Canyon Lanelt/Addressgt
  • ltmlsStructuregt
  • ltNum-Bedsgt3lt/Num-Bedsgt
  • ltNum-Bathsgt2lt/Num-Bathsgt...

Default Namespace
Named Namespace
Prefix
22
XML is extensively used Examples
  • XML Metadata Interchange (XMI)
  • XSLT programming language for transformation
  • Web Services XML Schemas, WSDL, SOAP, BPEL
  • Storage/Exchange formats
  • Configuration files
  • Advantage Tool support for parsing, validation,
    editing, visualization, ease of debugging etc.
  • Disadvantage Poor readability, efficiency
    (compared to binary)

23
XML Schema
24
XML Schema Definition (XSD)
  • Define the legal building blocks of an XML
    document
  • Defines elements that can appear in a document.
  • Defines attributes that can appear in a document.
  • Defines which elements are child elements.
  • Defines the order of child elements.
  • Defines the number of child elements.
  • Defines whether an element is empty or can
    include text.
  • Defines data types for elements and attributes.
  • Defines default and fixed values for elements and
    attributes.

25
Simple types
  • Simple types are defined by restricting a
    built-in-type or another simple type
  • ltsimpleType nameagegt
  • ltrestriction baseintegergt
  • ltminInclusive value0/gt
  • ltmaxInclusive value130/gt
  • lt/restrictiongt
  • lt/simpleTypegt
  • fourteen facets to restrict including pattern,
    enumeration, length(3), period and duration

26
Another Example
ltsimpleType name"US-Flag-Colors"gt
ltrestriction base"string"gt
ltenumeration value"red"/gt
ltenumeration value"white"/gt
ltenumeration value"blue"/gt
lt/restrictiongt lt/simpleTypegt
27
Defining complex types
  • ltxsdcomplexType name"Address" gt
  • ltxsdsequencegt
  • ltxsdelement name"name"
    typexsdstring" /gt
  • ltxsdelement name"street"
    typexsdstring" /gt
  • ltxsdelement name"zip"
    typexsddecimal" /gt
  • lt/xsdsequencegt
  • ltattribute namecountry" typexsdstring"
    /gt
  • lt/xsdcomplexTypegt
  • ltxsdcomplexType name"PurchaseOrderType"gt
  • ltxsdsequencegt
  • ltxsdelement name"shipTo" type"Address" /gt
  • ...
  • lt/xsdcomplexTypegt

28
Document instance of purchase order
  • ltPurchaseOrder orderDate"1999-05-20"gt
  • ltshipTo country"US"gt
  • ltnamegtAlice Smithlt/namegt
  • ltstreetgt123 Maple Streetlt/streetgt
  • ltcitygtMill Valleylt/citygt
  • ltstategtCAlt/stategt
  • ltzipgt90952lt/zipgt
  • lt/shipTogt
  • ...
  • lt/PurchaseOrdergt

nameshipTo"
type"Address"
29
ltcomplexTypegt or ltsimpleTypegt?
  • When do you use the complexType element and when
    do you use the simpleType element?
  • Use the complexType element when you want to
    define child elements and/or attributes of an
    element
  • Use the simpleType element when you want to
    create a new type that is a refinement of a
    built-in type (string, integer, etc)

30
Defining attributes
  • ltattribute name"Category" use"required"gt
  • ltsimpleTypegt
  • ltrestriction base"string"gt
  • ltenumeration
    value"autobiography"/gt
  • ltenumeration
    value"non-fiction"/gt
  • ltenumeration value"fiction"/gt
  • lt/restrictiongt
  • lt/simpleTypegt
  • lt/attributegt
  • Note attributes can only have simpleTypes
    (i.e., attributes cannot have child elements).

Anonomous type
31
Notes about Attributes
  • The attribute declarations always come last,
    after the element declarations.
  • The attributes are always with respect to the
    element that they are defined (nested) within.

ltelement name"foo"gt ltcomplexTypegt
ltsequencegt lt/sequencegt
ltattribute name"bar" /gt ltattribute
name"boo" /gt lt/complexTypegt lt/elementgt
"bar and boo are attributes of foo"
32
Inheritance Extending complex types
  • ltcomplexType name"USAddress"gt
  • ltextension base"Address"gt
  • ltsequencegt
  • ltelement name"zip"
  • type"xsdstring"/gt
  • lt/sequencegt
  • lt/extensiongt
  • lt/complexTypegt

33
Elements
  • ltelement name"zip type"xsdstring"/gt

tag name in instance document
type is either built-in types, simpleTypes or
complexTypes
XML instance
ltzipgt90210lt/zipgt
34
XSD XML text editor
ltxsschema xmlnsxs"http//www.w3.org/2001/XMLSch
ema"gt lt/xsschemagt
  • Inside here goes
  • elements
  • complexTypes
  • simpleTypes
  • Can also be built using simple text editors
  • XML editors gives contextual support, e.g. like
    auto-completion, suggestions for elements, etc.,
    as well as validation of the XML document.

35
XSD UML profile for XSD
  • UML representation of XML schema.
  • Useful in a UML-centric development method if the
    modelling environment supports generation/import
    of XSD documents.

36
PIM4SOA main mappings to XSD
37
Web Service Description Language (WSDL)
38
Making a SOAP function call over HTTP
HTTP Request
Header
Body
XML Data
HTTP Response
Header
Body
XML Data
39
The SOAP Envelope
  • ltSOAPEnvelopegt
  • ltSOAPHeadergtlt/SOAPHeadergt
  • ltSOAPBodygt
  • ltmFunctionNamegt
    ltparamName1gtparamValue1lt/paramName1gt
  • ltparamName2gtparamValue2lt/paramName2
    gt
  • lt/mFunctionNamegt
  • lt/SOAPBodygt
  • lt/SOAPEnvelopegt

Optional
40
Web Services Description Language (WSDL)
  • Purpose
  • Web services need to be defined in a consistent
    manner so that they can be discovered by and
    interfaced with other services and applications.
  • The Web Services Description Language is a W3C
    specification providing the foremost language for
    the description of Web service definitions.
  • W3C, "Web Services Description Language (WSDL)
    Version 2.0 Part 1 Core Language", World Wide
    Web Consortium (W3C), W3C Working Draft, 3 August
    2004. http//www.w3.org/TR/2004/WD-wsdl20-20040803
    /

41
WSDL Conceptual view
42
WSDL Conceptual model
WS Client
WS Interface
WS Provider
Operations Invoked through Ports
Ports
Porttype
Operations
Concrete Endpoint Address
Operation
Name,Abstract Message Parts Schema Message
Exchange Pattern
(Reusable) Binding
Concrete Message Encoding Concrete Messaging
Protocol
43
WSDL Message exchange patterns
WS Provider
WS Client
Time
44
WSDL 1.1 metamodel
45
UML profile for WSDL
UML representation
Text representation
46
lttypesgt ltschemagt
ltcomplexType name"CreditCard"gt... ltelement
name"number" type"string"/gt ltelement
name"expires" type"date"/gt... lt/typesgt
ltmessage name"validateRequest"gt
ltpart name"card" type"CreditCard"/gtlt/messagegt
... ltportType name"Payment"gt
ltoperation name"validate"gt ltinput
message"validateRequest"/gt ltoutput
message"validateResponse"/gt
lt/operationgtlt/portTypegt ltportType
name"TransactionWFS"gt
ltoperation name"getCapabilities"gt...
ltoperation name"describeFeatureType"gt...
ltoperation name"getFeature"gt...
ltoperation name"lockFeature"gt...
ltoperation name"transaction"gt...
ltbinding name"PaymentSOAPBinding"
type"Payment"gt ltsoapbinding
transport"http//schemas.xmlsoap.org/soap/http"
...gt ltoperation name"validate"gt...lt/bindinggt
ltbinding name"TransactionWFSSOAPBinding"
type"Payment"gt ltoperation
name"getCapabilities"gt...
ltoperation name"describeFeatureType"gt...
ltoperation name"getFeature"gt...
ltoperation name"lockFeature"gt...
ltoperation name"transaction"gt...lt/bind
inggt ltservice name"myWebService"gt
ltport name"Payment_Port
binding"PaymentSOAPBinding"gt ltsoapaddress
location..www.myWebService.com"/gt...
ltport name"TransactionWFS_Port
binding"TransactionWFSSOAPBindi
ng"gt
Class
Copy-down Inheritance
Interface
Interface
Realize
BusinessService
47
Business Process Execution Language (BPEL)
48
BPEL
BPEL is a Web service composition language. It
defines how to compose other Web services so to
accomplish a more complex task. A BPEL engine is
capable of executing the composite service
described by BPEL. The outcome will be a
composite BPEL-defined Web service which itself
can be regarded as a Web service.
49
BPEL language
  • XML notation
  • Interaction with other Web services
  • ltreceivegt. Wait for an incoming message.
    Typically at the process start
  • ltinvokegt. Call another Web service
  • ltreplygt. Send a response message from the entire
    BPEL service
  • Control flow
  • ltsequencegt. Sequential control flow
  • ltflowgt. Parallel control flow
  • ltswitchgt. Conditional branching
  • ltwhilegt. Loop
  • Data flow
  • ltvariablegt. Defines the data objects involved
  • ltassigngt. Copy a data object from one variable to
    another possibly w/ data transformation

50
BPEL Simplified view
A BPEL process is a composite Web service with a
WSDL description.
51
BPEL Foundations
52
BPEL Details
  • Two Uses
  • Executable process descriptions
  • Business protocol descriptions Abstract
    processes
  • Partner links
  • Paired WSDL interfaces
  • Correlation setsBind messages to
    process/activity instances.
  • Endpoint references
  • Partner
  • Grouping constraint on partner links to a single
    business partner.
  • Process Activities
  • Basic - assign, throw, terminate, wait, empty,
    compensate
  • Partner interaction - receive, reply, invoke
  • Structured - sequence, switch, while, pick, flow,
    scope

53
BPEL example
54
BPEL Process
ltprocess name"purchaseOrderProcess" xmlns"http
//schemas.xmlsoap.org/ws/2003/03/business-process/
"gt ltpartnerLinksgt ltpartnerLink
name"purchasing" partnerLinkType"lnspurchasin
gLT" myRole"purchaseService"/gt ltpartnerLink
name"invoicing" partnerLinkType"lnsinvoicingL
T" myRole"invoiceRequester" partnerRole"invo
iceService"/gt ltpartnerLink name"shipping" part
nerLinkType"lnsshippingLT" myRole"shippingReq
uester" partnerRole"shippingService"/gt ltpartne
rLink name"scheduling" partnerLinkType"lnssch
edulingLT" partnerRole"schedulingService"/gt lt/p
artnerLinksgt
55
BPEL process
ltsequencegt ltreceive partnerLink"purchasing"
portType"lnspurchaseOrderPT"
operation"sendPurchaseOrder"
variable"PO"/gt ltflowgt ltlinksgt ltlink
name"ship-to-invoice"/gt ltlink
name"ship-to-scheduling"/gt lt/linksgt ltsequence
gt ltassigngt ltcopygt ltfrom variable"PO"
part"customerInfo"/gt ltto variable"shippingR
equest" part"customerInfo"/gt lt/copygt lt/ass
igngt ...
56
BPEL process
ltinvoke partnerLink"shipping" portType"lnss
hippingPT" operation"requestShipping"
inputVariable"shippingRequest"
outputVariable"shippingInfo"gt ltsource
linkName"ship-to-invoice"/gt lt/invokegt ltreceiv
e partnerLink"shipping"
portType"lnsshippingCallbackPT"
operation"sendSchedule"
variable"shippingSchedule"gt ltsource
linkName"ship-to-scheduling"/gt lt/receivegt ...
57
UML profile for BPEL
58
PIM4SOA main mappings to BPEL
59
RSM and UML profile for Web services
60
Referanser, neste forelesning...
  • XML, XML Schema, WSDL www.w3c.org
  • BPEL http//en.wikipedia.org/wiki/BPEL
  • www.oasis-open.org
  • NB! Utskrift av foilene fra denne forelesningen
    blir lagt ut på neste forelesning.
  • Neste forelesning 16.april, Interoperability and
    MDI EIF and EIM (Brian)
Write a Comment
User Comments (0)