advertisement

Web services

50 %
50 %
advertisement
Information about Web services

Published on July 30, 2007

Author: mrw

Source: slideshare.net

Description

A pattern-based introduction to web services. Covers core web service standards, the Axis framework, data mapping and service composition.
advertisement

Web Services Michael Weiss Carleton University Web site for this tutorial: www.scs.carleton.ca/~weiss/talks/mcetech06

About Me • PhD (1993), U of Mannheim • Member of Strategic Technology Group, Mitel (1994-1999) • Assistant Professor, Carleton U (since 2000) • Areas of work: service-oriented architecture, feature interaction, patterns, business models, open source Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 2

Topics Covered • Service-Oriented Architecture • Core standards (WSDL, SOAP, UDDI) • Creating, deploying, and invoking web services with Apache Axis • Data mapping and business objects • Service composition • A look at some advanced issues Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 3

Web Services • What are web services? In essence, a technology for application integration based on open standards (HTTP, XML) • In what sense are they related to the Web (capital “W” to refer to the WWW)? • In fact, deploying web services over the web is more of an artefact than a necessity ... • What we care about is the web of services (services assembled from other services) Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 4

Application Integration User Portal Bus Applications Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 5

Defining Web Service • Loosely coupled, document-based • Application functionality packaged as a single unit and exposed to the network • Authentication service • Flight departure monitoring service • Mobile payment service • The first generation of web services were “simple”, in the sense of non-composite, and closed (over existing, trusted relationships) Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 6

Second Generation Services • Complex, and aggregated from web services provided by third parties (hence, open) Service Shipping Organizational <<uses>> Boundaries Print Shipping Rate Quotes Labels Duty and Transit Times Taxation Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 7

Web of Services Service user • In second generation Service provider services, applications are assembled from Composite services dynamically services • Roles of service user and provider blend into what others call Servent servents (eg in P2P) Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 8

Vision • Build your applications on demand • Dynamically discover and orchestrate the execution of services on the network • Will be able to choose between alternative implementations of the same service Application s ic Interface nt a m Se Implementation Services Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 9

Service-Oriented Architecture • Objectives • Implementation transparency (common structure, neutral service description) • Location transparency (no hard binding, web-service agnostic interfaces) • Roles • Service Provider • Service User • Service Registry Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 10

Service-Oriented Architecture UDDI Service Service Registry Registry Describe + Publish Find Service Service Service Service WSDL SOAP Provider Provider User User Bind + Invoke Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 11

Web Services Layers Application Services Application Services (transaction - eg ticket purchase, information - eg tourist guide) (transaction - eg ticket purchase, information - eg tourist guide) Collaboration Services Collaboration Services (orchestration, matchmaking, translation) (orchestration, matchmaking, translation) Utility Services Utility Services (security, billing, QoS, metering, routing, transactions, messaging) (security, billing, QoS, metering, routing, transactions, messaging) SOAP, WSDL, UDDI SOAP, WSDL, UDDI XML, HTTP XML, HTTP Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 12

Topics Covered • Service-Oriented Architecture • Core standards (SOAP, WSDL, UDDI) • Creating, deploying, and invoking web services with Apache Axis • Data mapping and business objects • Service composition • A look at some advanced issues Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 13

SOAP • Simple Object Access Protocol • Cross-platform remote calls (de facto, while technically also document exchange) • Remote calls (typically) using HTTP as the transport and XML as the encoding • Designed to be as simple as possible, so to make it easily understood and adopted • But also complete enough to allow complex data structures to be transmitted Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 14

SOAP Messages • SOAP messages are XML documents usually sent over HTTP with a certain format Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 15

SOAP Messages • Components of a SOAP message optional required (one) 1+ required (one or more) Envelope Body Header Payload Fault Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 16

SOAP Containers • Container accepts incoming requests and dispatches them to the service • Translates between SOAP and the native language of the service (Java, C#, ...) • Clients only need to know the address of the service, and messages it understands, but not what language, platform, or location Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 17

SOAP Containers Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 18

Binding to a Service • Clients get address and messages from a WSDL description of the service Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 19

Client Proxy • The binding process (dynamically) returns a proxy to the remote web service Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 20

WSDL • Web Service Description Language • Neutral format for services to advertise themselves on the network • In future, we can choose between competing providers of same service (price, ...) • Components of a WSDL description • Service > Ports > Operations > Messages • Generating a WSDL description Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 21

WSDL Decription • Components of a web service description optional Description required (one) 1+ required (one or more) 1+ 1+ 1+ 1+ Type Message Port Type Binding Service 1+ 1+ Operation Protocol Style Port Request Response Binding Endpoint Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 22

Interface • Consider the interface for a Caching service that allows users to cache content Caching findInCache cache public String findInCache(String key); public void cache(String key, String content) Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 23

Messages <wsdl:message name=quot;findInCacheRequestquot;> <wsdl:part name=quot;keyquot; type=quot;soapenc:stringquot;/> </wsdl:message> <wsdl:message name=quot;findInCacheResponsequot;> <wsdl:part name=quot;resultquot; type=quot;soapenc:stringquot;/> </wsdl:message> <wsdl:message name=quot;cacheRequestquot;> <wsdl:part name=quot;keyquot; type=quot;soapenc:stringquot;/> <wsdl:part name=quot;contentquot; type=quot;soapenc:stringquot;/> </wsdl:message> <wsdl:message name=quot;cacheResponsequot;/> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 24

Port Type <wsdl:portType name=quot;Cachingquot;> • Port Type <wsdl:operation name=quot;cachequot; parameterOrder=quot;key contentquot;> <wsdl:input name=quot;cacheRequestquot; message=quot;impl:cacheRequestquot;/> <wsdl:output name=quot;cacheResponsequot; message=quot;impl:cacheResponsequot;/> </wsdl:operation> <wsdl:operation name=quot;findInCachequot; parameterOrder=quot;keyquot;> <wsdl:input name=quot;findInCacheRequestquot; message=quot;impl:findInCacheRequestquot;/> <wsdl:output name=quot;findInCacheResponsequot; message=quot;impl:findInCacheResponsequot;/> </wsdl:operation> </wsdl:portType> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 25

Service Binding <wsdl:binding name=quot;CachingSoapBindingquot; type=quot;impl:Cachingquot;> <wsdlsoap:binding style=quot;rpcquot; • Port Type transport=quot;http://schemas.xmlsoap.org/soap/httpquot;/> <wsdl:operation name=quot;cachequot;> <wsdlsoap:operation soapAction=quot;quot;/> <wsdl:input name=quot;cacheRequestquot;> <wsdlsoap:body use=quot;encodedquot; encodingStyle=quot;http:// schemas.xmlsoap.org/soap/encoding/quot; namespace=quot;urn:Cachequot;/> </wsdl:input> <wsdl:output name=quot;cacheResponsequot;> <wsdlsoap:body use=quot;encodedquot; encodingStyle=quot;http:// schemas.xmlsoap.org/soap/encoding/quot; namespace=quot;urn:Cachequot;/> </wsdl:output> </wsdl:operation> <!-- SAME FOR findCache operation --> </wsdl:binding> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 26

Service • Service ties it all together: it defines one or more ports, with binding and endpoint <wsdl:service name=quot;CachingServicequot;> <wsdl:port name=quot;Cachingquot; binding=quot;impl:CachingSoapBindingquot;> <wsdlsoap:address location= quot;http://localhost:9090/axis/services/Cachingquot;/> </wsdl:port> </wsdl:service> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 27

UDDI • Universal Discovery and Directory Interface • Service discovery protocol • Kind of yellow pages which allows applications to obtain information about businesses and their web services • Helps potential business partners to find each others’ business services • A system will have some kind of directory, but not always need all UDDI features Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 28

Service Directory • A service directory allows publishers to publish information about their services, and users to locate them (and receive updates) User Directory Service Information publish delete update locate: ServiceInformation Service subscribe Provider Implementation Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 29

UDDI Structure • UDDI stores service information in the form of business entities, business services, binding templates and technical models Binding Technical Template Model 0,,* 0,,* 0,,* 0,,* Business Business 0,,* Entity Service Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 30

Topics Covered • Service-Oriented Architecture • Core standards (WSDL, SOAP, UDDI) • Creating, deploying, and invoking web services with Apache Axis • Data mapping and business objects • Service composition • A look at some advanced issues Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 31

Apache Axis • Open source web service framework • Client programming model of Axis provides components for client to invoke a service endpoint and receive the response message • Server programming model based on a listener for each transport protocol, a set of message handlers, and service handlers • A detailed discussion of its architecture can be found at http://ws.apache.org/axis Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 32

Apache Axis Architecture Tomcat Servlet Container Web Service 1 Apache Client Web Axis Service 2 Servlet Web Service 3 Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 33

Architecture Adapter • Frameworks such as Apache Axis allow you to be fully web service-agnostic: to access web services from Java use method calls via architecture adapters (eg Java2WS) Java B eg .Net Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 34

Step by Step Guide to Axis 1. Provide a Java interface or class that describes the service interface 2. Create WSDL using Java2WSDL tool 3. Create bindings through WSDL2Java tool 4. Implement the service interface 5. Deploy the service 6. Implement clients using generated stubs Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 35

Axis Artefacts and Flow Service Interface Java2WSDL WSDL WSDL2Java WSDL2Java (optional) Client-side files Server-side files Service Service Service Service Service Service Interface Locator Stub Skeleton Binding WSDD WSDD Deploy Undeploy User- Generated defined Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 36

Provide a Java Interface • Define the functionality you want to expose 1 as a web service using an interface package cache; public interface Caching { public String findInCache(String key); public void cache(String key, String content) } Caching findInCache cache Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 37

Interface Segregation • Achieve greater coherence by limiting your interfaces to related methods • Implement multiple ports in one service Retrieval ContentProvider Billing Retrieval Billing retrieveArticle processBilling Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 38

Create WSDL from Java • Create the WSDL (Caching.wsdl) from the 2 Java interface defined earlier • -o name of output file • -l location of web service • -n target namespace of the WSDL document • -p mapping of namespace to packages step2.sh java org.apache.axis.wsdl.Java2WSDL -o quot;cache/Caching.wsdlquot; -l quot;http://localhost:8080/axis/services/Cachingquot; -n quot;urn:Cachequot; -pquot;cachequot; quot;urn:Cachequot; cache.Caching Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 39

Create WSDL from Java • Conversion to WSDL will also generate XML types (using XML Schema) for all non- primitive types references in the interface • Supports bean classes, enumeration classes, arrays, and holder classes (inout) • No types in this simple example, but a more complex one will be presented later Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 40

Create Bindings from WSDL • While we can create our SOAP messages to 3 invoke a service at runtime (more later), ... • ... it is generally better to use WSDL2Java to convert a WSDL file into Java stubs Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 41

Create Bindings from WSDL • Create a (static) client-side architecture adapter using the WSDL2Java tool • -o name of output file • -N mapping of namespace to target package • Adapter classes created • public interface CachingService • public class CachingServiceLocator step3.sh java org.apache.axis.wsdl.WSDL2Java -o . -Nurn:Cache cache.stubs cache/Caching.wsdl Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 42

Implement Service Interface • Implement the service by implementing the 4 interface Caching public class Cache implements Caching { protected LinkedHashMap cache = LinkedHashMap(100); public String findInCache(String key) { return (String) cache.get(key); } public void cache(String key, String content) { cache.put(key, content); } } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 43

Interface-Implementation Separation • Separating interface from implementation is a core element of loose coupling Caching Client findInCache cache Dependency Inversion Principle Cache findInCache cache Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 44

Deploy the Service • In a Web Service Deployment Descriptor 5 (WSDD) tell Axis how to route requests to the correct target (service) class <deployment xmlns=quot;http://xml.apache.org/axis/wsdd/quot; xmlns: java=quot;http://xml.apache.org/axis/wsdd/providers/javaquot;> <service name=quot;Cachingquot; provider=quot;java:RPCquot;> <parameter name=quot;classNamequot; value=quot;cache.Cachequot;/> <parameter name=quot;scopequot; value=quot;Applicationquot;/> <parameter name=quot;allowedMethodsquot; value=quot;findInCache cachequot;/> </service> </deployment> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 45

Start the Axis Server • If the Axis engine is not running start it: • as a servlet from within a servlet engine (eg Tomcat): code in webapps/axis • or as a standalone server (here ... and for testing and simple applications) • Invoking the standalone SimpleAxisServer java org.apache.axis.transport.http.SimpleAxisServer -p 9090 axis.sh Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 46

AdminClient • Make the service available to clients by deploying it using the AdminClient • If deploying to the standalone Axis server, also supply the port number admin.sh > java org.apache.axis.client.AdminClient -p 9090 deploy.wsdd Processing file cache/deploy.wsdd <Admin>Done processing</Admin> • Now we are ready to invoke the service Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 47

Create the Client • There are two ways to invoke a service 5 • Dynamic client:atcreate a Call object for each method runtime • Static client: generate a static proxy from the WSDL description Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 48

Dynamic Client public class DirectCachingClient { public static void main(String[] args) { try { String endpoint = quot;http://localhost:9090/axis/services/Cachingquot;; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperation(quot;findCachequot;); call.setReturnType(XMLType.XSD_STRING); String ret = (String) call.invoke( new String[] {quot;theAnswerquot;}); System.out.println(quot;Received: quot; + ret); } catch (Exception e) { System.err.println(quot;Exception: quot; + e); } } } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 49

Static Client public class CachingClient { public static void main(String[] args) { try { CachingService service = new CachingServiceLocator(); Caching port = service.getCaching(); // to access the service at a different endpoint: // Caching port = service.getCaching(url); String answer = port.findInCache(quot;theAnswerquot;); if (answer == null) { port.cache(quot;theAnswerquot;, quot;42quot;); } answer = port.findInCache(quot;theAnswerquot;); System.out.println(answer); } catch (Exception e) { System.err.println(quot;Exception: quot; + e); } } } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 50

Setting up Axis • Download Apache Axis from website • http://ws.apache.org/axis • Latest stable release is axis-bin-1_4.zip • Install in a directory and put the .jar files in the axis/lib directory into your class path • In my Unix shell, I would say set AXIS_HOME=quot;$home/axisquot; set CLASSPATH=quot;${CLASSPATH}:$AXIS_HOME/lib/axis-ant.jarquot; set CLASSPATH=quot;${CLASSPATH}:$AXIS_HOME/lib/axis.jarquot; ... Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 51

http://ws.apache.org/axis/java/user-guide.html Axis User Guide for more information Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 52

Case Study: Bookstore • As a larger example, consider an application for ordering books from multiple stores • This application needs to provide a portal through which users can place orders • It invokes the (different?) order processing services provided by the bookstores • First, the big picture ... Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 53

Actors and Interactions 1 Invoke 4 Client Stubs WSDL Repository/ Portal UDDI Registry 2 Actual OrderProcessing 5 calls OrderProcessing Stub 1 OrderProcessing Stub 1 WSDL 1 Stub(s) Axis Engine Deploy 3 Bookstore Bookstore Bookstore 2 3 1 Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 54

Interface • The bookstore exposes an OrderProcessing interface through which to place orders • Orders can also be canceled given their OID OrderProcessing Bookstore processOrder cancel public interface OrderProcessing { public String processOrder(String customer, String[] isbns, int[] quantities); public void cancel(String oid); } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 55

WSDL and Stubs • Generate the WSDL from the interface step2.sh bookstore_v1 OrderProcessing Bookstore bookstore_v1 OrderProcessing.wsdl • Generate client stubs from the WSDL step3.sh bookstore_v1 OrderProcessing Bookstore bookstore_v1.stubs OrderProcessingServiceLocator OrderProcessingService OrderProcessing OrderProcessingStub Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 56

Service (1) • Much of the following code is stubbed out, as it is not related to web services public class Bookstore implements OrderProcessing { // ... public String processOrder(String customer, String[] isbns, int quantities[]) { String oid = generateOid(); Order order = new Order(customer, isbns, quantities); orders.put(oid, order); // do whatever else to initiate payment processing // and shipping (not shown ...) return oid; } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 57

Service (2) • And to finish off ... // ... public void cancel(String oid) { Order o = (Order) orders.get(oid); if (o != null) { orders.remove(oid); // do whatever is needed to cancel the order } } private String generateOid() { return quot;oquot; + nextOid++; } } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 58

Deploy the Service • Deployment descriptor for the bookstore is similar to that for the Caching service <deployment xmlns=quot;http://xml.apache.org/axis/wsdd/quot; xmlns:java=quot;http://xml.apache.org/axis/wsdd/providers/javaquot;> <service name=quot;OrderProcessingquot; provider=quot;java:RPCquot;> <parameter name=quot;classNamequot; value=quot;bookstore_v1.Bookstorequot;/> <parameter name=quot;scopequot; value=quot;Applicationquot;/> <parameter name=quot;allowedMethodsquot; value=quot;processOrder cancelquot;/> </service> </deployment> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 59

Client public class BookstoreClient { public static void main(String[] args) { try { OrderProcessingService service = new OrderProcessingServiceLocator(); OrderProcessing port = service.getOrderProcessing(); String oid = port.processOrder(quot;joe@doe.comquot;, new String[] {quot;123456quot;, quot;732541quot;}, new int[] {2, 1}); System.out.println(quot;order quot; + oid + quot; placedquot;); port.cancel(oid); System.out.println(quot;order quot; + oid + quot; canceledquot;); } catch (Exception e) { System.err.println(quot;Exception: quot; + e); } } } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 60

Topics Covered • Service-Oriented Architecture • Core standards (WSDL, SOAP, UDDI) • Creating, deploying, and invoking web services with Apache Axis • Data mapping and business objects • Service composition • A look at some advanced issues Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 61

Business Objects • Represent highly cohesive business concepts such as order, line item, or address • Also known as data objects or beans, ie they only contain data access operations • Business objects often collected in groups • But rich object structures are in conflict with the flat nature of web services • Focus of web services on loose coupling, so unlike CORBA or RMI no OO focus Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 62

Taking Orders now! • Business objects can contain primitive and complex data as in the Order example Order LineItem customer: String isbn: String lineItems: LineItem[] quantity: int * setIsbn setCustomer getCustomer: String getIsbn: String setLineItems setQuantity getLineItems: LineItem[] getQuantity: int Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 63

Data Mapping to XML • Basic mapping defined by JAX-RPC spec • Mapping of primitive types • Complex types that follow the JavaBeans convention (BeanSerializer) • Arrays and some Collection types • Exceptions • Key consideration is the interoperability between SOAP implementations ! Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 64

Mapping of Primitive Types • Primitive types defined in standard SOAP encoding Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 65

Complex Types • Axis can serialize and deserialize any classes that follow the JavaBeans convention ... • ... without requiring you to write any code ! • Simple properties • setAddress and getAddress • Indexed properties (arrays of values) • Customer[] • setCustomers and getCustomers Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 66

Bean Mapping • Need to define a bean mapping in WSDD by adding a <beanMapping> tag <beanMapping qname=quot;ns:Orderquot; xmlns:ns=quot;urn:Bookstorequot; languageSpecificType=quot;java:bookstore_v2.Orderquot;/> • Maps a Java bean to an XML qualified name (qname) associated with a namespace Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 67

Orders in XML • XML schema for the Order type <complexType name=quot;Orderquot;> <sequence> <element name=quot;customerquot; type=quot;soapenc:stringquot; .../> <element name=quot;lineItemsquot; type=quot;impl:ArrayOfLineItemquot; .../> </sequence> </complexType> <complexType name=quot;LineItemquot;> <sequence> <element name=quot;isbnquot; type=quot;soapenc:stringquot; .../> <element name=quot;quantityquot; type=quot;xsd:intquot; .../> </sequence> </complexType> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 68

Order (simple) • The Java Beans convention distinguishes simple and indexed properties public class Order { protected String customer; public String getCustomer() { return customer; } public void setCustomer(String customer) { this.customer = customer; } // ... Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 69

Order (indexed) • In the Order class, line items are indexed // ... private LineItem[] lineItems; public LineItem[] getLineItems() { return lineItems; } public void setLineItems(LineItem[] lineItems) { this.lineItems = lineItems; } } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 70

Arrays and Collections • Some Java collections (Vector, Hashtable, ...) have serializers, but interoperability between SOAP implementations in not guaranteed • Most reliable way, thus, is to use arrays <complexType name=quot;ArrayOfLineItemquot;> <complexContent> <restriction base=quot;soapenc:Arrayquot;> <attribute ref=quot;soapenc:arrayTypequot; wsdl:arrayType=quot;impl:LineItem[]quot;/> </restriction> </complexContent> </complexType> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 71

Bookstore • New interface to our bookstore that uses business objects (ie Order) public class Bookstore implements OrderProcessing { // ... public String processOrder(Order order) { String oid = generateOid(); orders.put(oid, order); // do whatever else to initiate payment processing // and shipping (not shown ...) return oid; } // ... } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 72

Bookstore Client public class BookstoreClient { public static void main(String[] args) { try { OrderProcessingService service = new OrderProcessingServiceLocator(); OrderProcessing port = service.getOrderProcessing(); Order order = new Order(quot;joe@doe.comquot;, new LineItem[] { new LineItem(quot;123456quot;, 2), new LineItem(quot;732541quot;, 1) }); String oid = port.processOrder(order); System.out.println(quot;order quot; + oid + quot; placedquot;); port.cancel(oid); System.out.println(quot;order quot; + oid + quot; canceledquot;); } catch (Exception e) { System.err.println(quot;Exception: quot; + e); } } } Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 73

WSDD for Bookstore • Define complex types on which the service implementation relies in the WSDD • namespace (urn:Bookstore) • serializers (beanMapping to ns:Order) <deployment xmlns=quot;http://xml.apache.org/axis/wsdd/quot; xmlns:java=quot;http://xml.apache.org/axis/wsdd/providers/javaquot;> <service name=quot;OrderProcessingquot; provider=quot;java:RPCquot;> <parameter name=quot;classNamequot; value=quot;bookstore_v2.Bookstorequot;/> <parameter name=quot;allowedMethodsquot; value=quot;processOrder cancelquot;/> <beanMapping qname=quot;ns:Orderquot; xmlns:ns=quot;urn:Bookstorequot; languageSpecificType=quot;java:bookstore_v2.Orderquot;/> <beanMapping qname=quot;ns:LineItemquot; xmlns:ns=quot;urn:Bookstorequot; languageSpecificType=quot;java:bookstore_v2.LineItemquot;/> </service> </deployment> Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 74

Topics Covered • Service-Oriented Architecture • Core standards (WSDL, SOAP, UDDI) • Creating, deploying, and invoking web services with Apache Axis • Data mapping and business objects • Service composition • A look at some advanced issues Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 75

Business Processes • Means by which one or more activities are accomplished in an operating business • Business process models include • Roles of users • Definition of activities • Can be represented diagrammatically as as activity diagrams, use case maps, ... • Concerned with structure and interfaces Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 76

Business Process Components • Business processes model business operation, vs business objects which model (data) entities within a business • Purely look at a business from the aspect of the activities the business conducts • Activities can be composed into larger business processes, and may be business processes themselves, or web services • We are concerned with composition Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 77

Ordering Process Customer Store Select Products to Order Enter Customer Information Submit Product Create Order Order Remove from Warehouse Receive Ship Products Products Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 78

Business Processes in Practice • Business process concepts overlap with existing architectures and styles • The tended to be part of the custom logic outside the business object model • Business process implementations differ largely between organizations • Large business processes often span multiple companies (need to integrate processes) • Motivates need to support fluidity Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 79

Business Process Modeling • Several standards for modeling and representing business processes • Business Process Execution Language (BPEL) • IBM, Microsoft, BEA • Business Process Modeling Language (BPML) • XML-based explicit representation of business process flow model Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 80

Marginalized Objects • We have discussed this before ... • Applied to business processes this means that business processes require a flat component model with interface definition and implementation • Each interface is implemented as the composition of web services • Also applied to flow logic by moving it out from the programming language (BPEL !) Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 81

Process Logic in BPEL BPEL Container invoke() receive() reply() Client Web Service businessProcess() wait() terminate() sequence() pick() flow() BPEL Flows Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 82

Business Process Pattern <<interface>> BusinessActivity run() Data BusinessActivityImpl <<interface>> ActivitySequence get() run() next() BusinessProcess run() set() get() BusinessProcessImpl run() Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 83

Participants • BusinessProcess • Interface to the business process • BusinessProcessImpl • Logic of the business process, which can be a simple ActivitySequence • ActivitySequence • Sequence of business activities that must occur before process is complete Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 84

More Participants • Data • Captures side effects of business activities (in this pattern: a shared data pool) • BusinessActivity • Unit of work in the business process, which may itself be a process, a service, or just a single method on an object Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 85

Ordering Process • Customer submits an order • Business process puts order into data pool • ... determines if products exist (success) in warehouse, and reserves them • ... checks state of data pool and launches create order business activity • ... notifies warehouse staff to ship • ... returns an order identifier to the user Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 86

Product Order Process <<interface>> BusinessActivity setData() run() isComplete() getReturnValue() isSuccessful() CreateOrder ActivitySequence RemoveProduct ShipProducts BusinessProcess run() next() run() run() Quantity run() get() Hashtable ProductOrderImpl createProductOrder() run() ProductOrderWeb Service createProductOrder() Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 87

Topics Covered • Service-Oriented Architecture • Core standards (WSDL, SOAP, UDDI) • Creating, deploying, and invoking web services with Apache Axis • Data mapping and business objects • Service composition • A look at some advanced issues Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 88

Advanced Issues Mobile Services Workflows QoS/Policy Web Services Semantics Security Coordination Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 89

Convergence Desktops 1990's Client-Server N-Tier Distributed Objects P2P Social Computing 2000's } Grids Utility } Semantic Grid Web services Semantic Web Agents } Spaces Coordination Media MirrorWorld Embedded Networks Ubiquitous Computing 20??'s Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 90

Summary • Concepts • Service-oriented architecture, core standards, data mapping, and business processes • Principles • Interface/implementation separation, top-down/ bottom-up design, interface segregation, ... • Patterns • SOA, Architecture Adapter, Service Directory, Business Object, Service Composition • Tools • Apache Axis Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 91

Further Reading • Taylor, From P2P to Web Services and Grids: Peers in a Client/Server World, Springer • Monday, Web Service Patterns, APress • Pashtan, Mobile Web Services, Cambridge • Sotomayor, Globus Toolkit 4: Programming Java Services, Morgan Kaufmann • Papazoglou, Web Services and Cross Enterprise Computing, Addison-Wesley Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 92

Add a comment

Related pages

Webservice – Wikipedia

Seiten des W3C über Web Services (englisch) Definition des Web Services beim W3C (englisch) Implementation eines WebServices in Java - Schritt-für ...
Read more

Web service - Wikipedia, the free encyclopedia

A Web service communication between two electronic devices over a network. It is a software function provided at a network address over the Web with the ...
Read more

Web Services

Web services extend the World Wide Web infrastructure to provide the means for software to connect to other software applications. Applications access Web ...
Read more

WEB.DE - E-Mail-Adresse kostenlos, FreeMail, De-Mail ...

Das beliebteste Internetportal Deutschlands mit Angeboten rund um Suche, Kommunikation, Information und Services.
Read more

Web Services Tutorial - W3Schools Online Web Tutorials

Web services are web application components. Web services can be published, found, and used on the Web. This tutorial introduces WSDL, SOAP, RDF, and RSS.
Read more

Jetzt aber ab ins Web!: Webdesign aus Bad Camberg

Jetzt aber ab ins Web! Webdesign aus Bad Camberg im Taunus mit den Content-Management-Systemen TYPO3 CMS, Wordpress oder Contao.
Read more

Web Services Activity - World Wide Web Consortium (W3C)

Web Services Activity. Groups · News · Documents · Wiki and tools · Technical discussion · Events. The World Wide Web is more and more used for ...
Read more

Introduction to Web Services - W3Schools Online Web Tutorials

Web Services take Web-applications to the Next Level. By using Web services, your application can publish its function or message to the rest of the world.
Read more

Amazon Web Services AWS – Server Hosting & Cloud Services

Amazon Web Services bietet zuverlässige, skalierbare und wirtschaftliche Cloud Computing-Services. Kostenlose Teilnahme, nutzungsabhängige Zahlung.
Read more

Web of Services - W3C - World Wide Web Consortium

Web of Services refers to message-based design frequently found on the Web and in enterprise software. The Web of Services is based on technologies such as ...
Read more