220 likes | 375 Views
CIS*6650.01 Service-Oriented Computing. Qusay H. Mahmoud, Ph.D. qmahmoud@uoguelph.ca. 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.
E N D
CIS*6650.01Service-Oriented Computing Qusay H. Mahmoud, Ph.D. qmahmoud@uoguelph.ca CIS*6650.01
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 CIS*6650.01
XML-RPC • A specification and implementation that enable applications running in a heterogeneous environment to make procedure calls over the Internet • Defined at UserLand Software in 1998 • Uses HTTP as the transport protocol and XML for encoding • Designed to be as simple as possible, allowing complex data structures to be transmitted, processed, and returned CIS*6650.01
XML-RPC • Not a solution to every problem. • Simple and effective mean for exchanging information (spec is less than 10 pages with examples and FAQ) • "We wanted a clean, extensible format that's very simple. It should be possible for an HTML coder to be able to look at a file containing an XML-RPC procedure call, understand what it's doing, and be able to modify it and have it work on the first or second try... We also wanted it to be an easy to implement protocol that could quickly be adapted to run in other environments or on other operating systems." - xmlrpc.com • Simplicity makes it limited CIS*6650.01
Sample • XML-RPC request • testcase.getMonthName(3) CIS*6650.01
Sample • XML-RCP Response CIS*6650.01
XML-RPC to Java Mapping • Explore mapping to other languages CIS*6650.01
SOAP • A Lightweight XML-based protocol for exchanging information in a distributed environment • More complex than XML-RPC (over 40 pages) • Makes extensive use of XML namespaces and attribute specification tags in every element of a message • Adds features that don’t exist in XML-RPC: user-defined data types, specify recipient, message specific processing control, and others CIS*6650.01
Sample • See Week2 slides CIS*6650.01
Comparison • XML-RPC vs. SOAP CIS*6650.01
XML-RPC vs. SOAP • SOAP supports request routing and pre-processing of requests via SOAP headers • XML-RPC is lighter, taking up less bandwidth, and requiring less processing power • SOAP is namespace-aware (in fact every element must be namespace-qualified) • SOAP has a heavy-weight, robust data typing mechanism based on XML Schemas • XML-RPC is easily sent and consumed, and is easily readable by humans • SOAP messages have a considerable amount of packaging contained in the envelope, but this allows for flexibility in the messaging paradigm used (publish-subscribe, point-to-point, etc.) CIS*6650.01
JAX-RPC • The push for Java API started in 2001 as JSR-101 (jcp.org) • V1.0 released in 2003 • Java primitives are tied to XML schema types • Supports more Java standard library objects (e.g. BigInteger) • Architects of JAX-RPC has XML-RPC and SOAP in mind CIS*6650.01
JAX-WS • Next version of the spec is known as JAX-WS (JSR-224) Java API for XML-based Web Services • Aims to reduce the complexity of web service development • Java WSDP 1.6 (use GlassFish) • Use JAX-RPC if: • Using simple requests • You control both the client/server • You don’t need to publish WSDL • Want to keep client-side parsing simple • But remember…using standards is a good thing for interoperability (your apps need to interact with other third party apps) CIS*6650.01
Resources • XML-RPC spec: xml-rpc.com/spec • SOAP: w3.org/TR/soap • JAX-WS (JAX-RPC 2.0): https://jax-rpc.dev.java.net/ (JSR 224: http://www.jcp.org/en/jsr/detail?id=224) • Apache XML-RPC: http://ws.apache.org/xmlrpc/ • UserLand Frontier (frontier.userland.com) • Many others…explore on your own CIS*6650.01
Document vs. RPC Style • SOAP was originally designed to support RPC style • Later (starting with SOAP 1.0), the spec expanded to support RPC and unstructured messages (document) • RPC style: SOAP Body must conform to a structure that indicates the method name and a set of parameters • Document style: SOAP Body can be structured in any way you like CIS*6650.01
RPC vs. Document Style Source: Anne Thomas Manes Blog, atmanes.blogsport.com • Message encoding: literal means Body contents conform to a specific XML Schema, SOAP encoding uses a set of rules based on XML Schema data types to encode the data • RPC: includes an operation name or place holder and document style doesn’t (significant architectural style) • This document style example uses a state transfer style • See more examples: http://www-128.ibm.com/developerworks/webservices/library/ws-whichwsdl/ CIS*6650.01
State Transfer Style • Such as MOM (Message-Oriented Middleware), pipe-and-filter • Architectural constraint: all components expose the same application interface • Through a single operation such as “process Data” • If a server exposes this operation, any client can submit data to it for processing • Since there is one operation, its use is implicit and doesn’t need to be included in the message CIS*6650.01
REST • REpresentational State Transfer • An architectural style • Think of it as a design pattern • Underlying concept for today’s Web architecture • Every distinguishable entity is a resource • URLs identify resources • An approach for creating Web services CIS*6650.01
REST • See the slides from http://www.xfront.com/REST.ppt CIS*6650.01
When to use REST or SOAP • REST • The web services are stateless • A caching infrastructure can be leveraged • Service’ producer and consumer have mutual understanding of the context and content being passed along • Bandwidth is limited • Web service delivery into exiting web sites can be enabled easily with a RESTful style • SOA • A formal contract must be established to describe the interface that the Web service offers • The architecture must address complex non-functional requirements • The architecture needs to handle asynchronous processing and invocation • See details at: http://java.sun.com/developer/technicalArticles/WebServices/restful/ (read the section When to use REST) CIS*6650.01
Web Services Architecture • http://www.w3.org/TR/ws-arch • Provides a common definition of a Web service, and defines its place within a larger Web services framework to guide the community • Provides a conceptual model and a context for understanding Web services and the relationships between the components of this model • Defines minimal characteristics common to all Web services, and characteristics that are needed by some but not all Web services • Doesn’t specify how Web services are implemented CIS*6650.01
Web Services Architecture • Four models: Message-Oriented, Service-Oriented, Resource-Oriented, Policy) • Core concepts and relationships of WS Source: http://www.w3.org/TR/ws-arch CIS*6650.01