cis*6650.01 service-oriented computing

22
Qusay H. Qusay H. Mahmoud Mahmoud CIS*6650.01 CIS*6650.01 1 CIS*6650.01 CIS*6650.01 Service-Oriented Service-Oriented Computing Computing Qusay H. Mahmoud, Ph.D. Qusay H. Mahmoud, Ph.D. [email protected] [email protected]

Upload: liz

Post on 07-Jan-2016

27 views

Category:

Documents


0 download

DESCRIPTION

CIS*6650.01 Service-Oriented Computing. Qusay H. Mahmoud, Ph.D. [email protected]. Web Services…. RPC the XML way (two ways) 1) XML-RPC (xml-rpc.com) 2) SOAP JAX-RPC, JAX-WS, … Document vs. RPC Style REST Web Services Architecture http://www.w3.org/TR/ws-arch. XML-RPC. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 11

CIS*6650.01CIS*6650.01Service-Oriented ComputingService-Oriented Computing

Qusay H. Mahmoud, Ph.D.Qusay H. Mahmoud, Ph.D.

[email protected]@uoguelph.ca

Page 2: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 22

Web Services…Web Services…

RPC the XML way (two ways)RPC the XML way (two ways)– 1) XML-RPC (xml-rpc.com)1) XML-RPC (xml-rpc.com)– 2) SOAP2) SOAP

JAX-RPC, JAX-WS, …JAX-RPC, JAX-WS, …

Document vs. RPC StyleDocument vs. RPC Style

RESTREST

Web Services ArchitectureWeb Services Architecture– http://www.w3.org/TR/ws-archhttp://www.w3.org/TR/ws-arch

Page 3: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 33

XML-RPCXML-RPCA specification and implementation that enable A specification and implementation that enable applications running in a heterogeneous applications running in a heterogeneous environment to make procedure calls over the environment to make procedure calls over the InternetInternetDefined at UserLand Software in 1998Defined at UserLand Software in 1998Uses HTTP as the transport protocol and XML Uses HTTP as the transport protocol and XML for encodingfor encodingDesigned to be as simple as possible, allowing Designed to be as simple as possible, allowing complex data structures to be transmitted, complex data structures to be transmitted, processed, and returnedprocessed, and returned

Page 4: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 44

XML-RPCXML-RPCNot a solution to every problem.Not a solution to every problem.Simple and effective mean for exchanging Simple and effective mean for exchanging information (spec is less than 10 pages with information (spec is less than 10 pages with examples and FAQ)examples and FAQ)"We wanted a clean, extensible format that's very "We wanted a clean, extensible format that's very simple. It should be possible for an HTML coder to simple. It should be possible for an HTML coder to be able to look at a file containing an XML-RPC be able to look at a file containing an XML-RPC procedure call, understand what it's doing, and be procedure call, understand what it's doing, and be able to modify it and have it work on the first or able to modify it and have it work on the first or second try... We also wanted it to be an easy to second try... We also wanted it to be an easy to implement protocol that could quickly be adapted to implement protocol that could quickly be adapted to run in other environments or on other operating run in other environments or on other operating systems." - xmlrpc.com systems." - xmlrpc.com Simplicity makes it limitedSimplicity makes it limited

Page 5: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 55

SampleSampleXML-RPC requestXML-RPC request

testcase.getMonthName(3)testcase.getMonthName(3)

Page 6: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 66

SampleSampleXML-RCP ResponseXML-RCP Response

Page 7: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 77

XML-RPC to Java MappingXML-RPC to Java MappingExplore mapping to other languagesExplore mapping to other languages

Page 8: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 88

SOAPSOAPA Lightweight XML-based protocol for exchanging A Lightweight XML-based protocol for exchanging information in a distributed environmentinformation in a distributed environment

More complex than XML-RPC (over 40 pages)More complex than XML-RPC (over 40 pages)

Makes extensive use of XML namespaces and Makes extensive use of XML namespaces and attribute specification tags in every element of a attribute specification tags in every element of a messagemessage

Adds features that don’t exist in XML-RPC: user-Adds features that don’t exist in XML-RPC: user-defined data types, specify recipient, message defined data types, specify recipient, message specific processing control, and othersspecific processing control, and others

Page 9: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 99

SampleSample

See Week2 slidesSee Week2 slides

Page 10: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1010

ComparisonComparisonXML-RPC vs. SOAPXML-RPC vs. SOAP

Page 11: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1111

XML-RPC vs. SOAPXML-RPC vs. SOAPSOAP supports request routing and pre-processing of SOAP supports request routing and pre-processing of requests via SOAP headers requests via SOAP headers XML-RPC is lighter, taking up less bandwidth, and XML-RPC is lighter, taking up less bandwidth, and requiring less processing power requiring less processing power SOAP is namespace-aware (in fact every element SOAP is namespace-aware (in fact every element must be namespace-qualified) must be namespace-qualified) SOAP has a heavy-weight, robust data typing SOAP has a heavy-weight, robust data typing mechanism based on XML Schemas mechanism based on XML Schemas XML-RPC is easily sent and consumed, and is easily XML-RPC is easily sent and consumed, and is easily readable by humans readable by humans SOAP messages have a considerable amount of SOAP messages have a considerable amount of packaging contained in the envelope, but this allows packaging contained in the envelope, but this allows for flexibility in the messaging paradigm used (publish-for flexibility in the messaging paradigm used (publish-subscribe, point-to-point, etc.) subscribe, point-to-point, etc.)

Page 12: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1212

JAX-RPCJAX-RPCThe push for Java API started in 2001 as The push for Java API started in 2001 as JSR-101 (jcp.org)JSR-101 (jcp.org)

V1.0 released in 2003V1.0 released in 2003

Java primitives are tied to XML schema typesJava primitives are tied to XML schema types

Supports more Java standard library objects Supports more Java standard library objects (e.g. BigInteger)(e.g. BigInteger)

Architects of JAX-RPC has XML-RPC and Architects of JAX-RPC has XML-RPC and SOAP in mindSOAP in mind

Page 13: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1313

JAX-WSJAX-WSNext version of the spec is known as JAX-WS (JSR-Next version of the spec is known as JAX-WS (JSR-224) Java API for XML-based Web Services224) Java API for XML-based Web ServicesAims to reduce the complexity of web service Aims to reduce the complexity of web service developmentdevelopmentJava WSDP 1.6 (use GlassFish)Java WSDP 1.6 (use GlassFish)Use JAX-RPC if:Use JAX-RPC if:– Using simple requestsUsing simple requests– You control both the client/serverYou control both the client/server– You don’t need to publish WSDLYou don’t need to publish WSDL– Want to keep client-side parsing simpleWant to keep client-side parsing simple– But remember…using standards is a good thing for But remember…using standards is a good thing for

interoperability (your apps need to interact with other third interoperability (your apps need to interact with other third party apps)party apps)

Page 14: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1414

ResourcesResourcesXML-RPC spec: xml-rpc.com/specXML-RPC spec: xml-rpc.com/spec

SOAP: w3.org/TR/soapSOAP: w3.org/TR/soap

JAX-WS (JAX-RPC 2.0): JAX-WS (JAX-RPC 2.0): https://jax-rpc.dev.java.net/https://jax-rpc.dev.java.net/ (JSR 224: (JSR 224: http://www.jcp.org/en/jsr/detail?id=224)http://www.jcp.org/en/jsr/detail?id=224)

Apache XML-RPC: Apache XML-RPC: http://ws.apache.org/xmlrpc/http://ws.apache.org/xmlrpc/

UserLand Frontier (frontier.userland.com)UserLand Frontier (frontier.userland.com)

Many others…explore on your ownMany others…explore on your own

Page 15: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1515

Document vs. RPC StyleDocument vs. RPC StyleSOAP was originally designed to support SOAP was originally designed to support RPC styleRPC styleLater (starting with SOAP 1.0), the spec Later (starting with SOAP 1.0), the spec expanded to support RPC and unstructured expanded to support RPC and unstructured messages (document)messages (document)RPC style: SOAP Body must conform to a RPC style: SOAP Body must conform to a structure that indicates the method name structure that indicates the method name and a set of parametersand a set of parametersDocument style: SOAP Body can be Document style: SOAP Body can be structured in any way you likestructured in any way you like

Page 16: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1616

RPC vs. Document StyleRPC vs. Document Style

Source: Anne Thomas Manes Blog, atmanes.blogsport.comSource: Anne Thomas Manes Blog, atmanes.blogsport.com

Message encoding: literal means Body contents conform to a specific XML Message encoding: literal means Body contents conform to a specific XML Schema, SOAP encoding uses a set of rules based on XML Schema data Schema, SOAP encoding uses a set of rules based on XML Schema data types to encode the datatypes to encode the dataRPC: includes an operation name or place holder and document style RPC: includes an operation name or place holder and document style doesn’t (significant architectural style)doesn’t (significant architectural style)This document style example uses a state transfer styleThis document style example uses a state transfer styleSee more examples: See more examples: http://www-128.ibm.com/developerworks/webservices/library/ws-http://www-128.ibm.com/developerworks/webservices/library/ws-whichwsdlwhichwsdl//

Page 17: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1717

State Transfer StyleState Transfer StyleSuch as MOM (Message-Oriented Such as MOM (Message-Oriented Middleware), pipe-and-filterMiddleware), pipe-and-filterArchitectural constraint: all components Architectural constraint: all components expose the same application interfaceexpose the same application interface– Through a single operation such as “process Through a single operation such as “process

Data”Data”– If a server exposes this operation, any client can If a server exposes this operation, any client can

submit data to it for processingsubmit data to it for processing– Since there is one operation, its use is implicit Since there is one operation, its use is implicit

and doesn’t need to be included in the messageand doesn’t need to be included in the message

Page 18: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1818

RESTRESTREpresentational State TransferREpresentational State Transfer

– An architectural styleAn architectural style– Think of it as a design patternThink of it as a design pattern– Underlying concept for today’s Web architectureUnderlying concept for today’s Web architecture– Every distinguishable entity is a resourceEvery distinguishable entity is a resource– URLs identify resourcesURLs identify resources– An approach for creating Web servicesAn approach for creating Web services

Page 19: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 1919

RESTRESTSee the slides from See the slides from http://www.xfront.com/REST.ppthttp://www.xfront.com/REST.ppt

Page 20: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 2020

When to use REST or SOAP When to use REST or SOAP RESTREST– The web services are statelessThe web services are stateless– A caching infrastructure can be leveragedA caching infrastructure can be leveraged– Service’ producer and consumer have mutual understanding of the context and Service’ producer and consumer have mutual understanding of the context and

content being passed alongcontent being passed along– Bandwidth is limitedBandwidth is limited– Web service delivery into exiting web sites can be enabled easily with a RESTful Web service delivery into exiting web sites can be enabled easily with a RESTful

stylestyleSOASOA– A formal contract must be established to describe the interface that the Web A formal contract must be established to describe the interface that the Web

service offersservice offers– The architecture must address complex non-functional requirementsThe architecture must address complex non-functional requirements– The architecture needs to handle asynchronous processing and invocationThe architecture needs to handle asynchronous processing and invocation

See details at: See details at: http://java.sun.com/developer/technicalArticles/WebServices/restful/ (read http://java.sun.com/developer/technicalArticles/WebServices/restful/ (read the section the section When to use RESTWhen to use REST))

Page 21: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 2121

Web Services ArchitectureWeb Services Architecturehttp://www.w3.org/TR/ws-archhttp://www.w3.org/TR/ws-archProvides a common definition of a Web service, Provides a common definition of a Web service, and defines its place within a larger Web and defines its place within a larger Web services framework to guide the communityservices framework to guide the communityProvides a conceptual model and a context for Provides a conceptual model and a context for understanding Web services and the understanding Web services and the relationships between the components of this relationships between the components of this modelmodelDefines minimal characteristics common to all Defines minimal characteristics common to all Web services, and characteristics that are Web services, and characteristics that are needed by some but not all Web servicesneeded by some but not all Web servicesDoesn’t specify how Web services are Doesn’t specify how Web services are implementedimplemented

Page 22: CIS*6650.01 Service-Oriented Computing

Qusay H. MahmoudQusay H. Mahmoud CIS*6650.01CIS*6650.01 2222

Web Services ArchitectureWeb Services ArchitectureFour models: Message-Oriented, Service-Oriented, Four models: Message-Oriented, Service-Oriented, Resource-Oriented, Policy)Resource-Oriented, Policy)Core concepts and relationships of WSCore concepts and relationships of WS

Source: http://www.w3.org/TR/ws-archSource: http://www.w3.org/TR/ws-arch