SlideShare a Scribd company logo
Web Services
Michael Weiss
Carleton University
Web site for this tutorial:
www.scs.carleton.ca/~weiss/talks/mcetech06
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
2
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
3
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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)
4
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Application Integration
5
Bus
Portal
Applications
User
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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)
6
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Second Generation Services
• Complex, and aggregated from web services
provided by third parties (hence, open)
7
Rate Quotes
Transit Times Duty and
Taxation
Print Shipping
Labels
Shipping
<<uses>> Organizational
Boundaries
Service
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Web of Services
• In second generation
services, applications
are assembled from
services dynamically
• Roles of service user
and provider blend
into what others call
servents (eg in P2P)
Service user
Service provider
Composite
services
8
Servent
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Vision
• Build your applications
• Dynamically discover and orchestrate the
execution of services on the network
• Will be able to choose between alternative
implementations of the same service
Application
Services
Implementation
Interface
9
Semantics
on demand
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
10
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Service-Oriented Architecture
11
Service
User
Service
User
Service
Registry
Service
Registry
Service
Provider
Service
Provider
Find
Bind + Invoke
Describe + Publish
UDDI
WSDLSOAP
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Web Services Layers
12
Application Services
(transaction - eg ticket purchase, information - eg tourist guide)
Application ServicesApplication Services
((transactiontransaction -- egeg ticket purchase,ticket purchase, informationinformation -- egeg tourist guide)tourist guide)
SOAP, WSDL, UDDISOAP, WSDL, UDDISOAP, WSDL, UDDI
XML, HTTPXML, HTTPXML, HTTP
Collaboration Services
(orchestration, matchmaking, translation)
Collaboration ServicesCollaboration Services
(orchestration, matchmaking, translation)(orchestration, matchmaking, translation)
Utility Services
(security, billing, QoS, metering, routing, transactions, messaging)
Utility ServicesUtility Services
(security, billing,(security, billing, QoSQoS, metering, routing, transactions, messaging), metering, routing, transactions, messaging)
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
13
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
14
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
SOAP Messages
• SOAP messages are XML documents usually
sent over HTTP with a certain format
15
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
SOAP Messages
• Components of a SOAP message
16
Envelope
Header Body
Payload Fault
1+
optional
required (one)
required (one or more)
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
17
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
SOAP Containers
18
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Binding to a Service
• Clients get address and messages from a
WSDL description of the service
19
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Client Proxy
• The binding process (dynamically) returns a
proxy to the remote web service
20
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
21
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
WSDL Decription
• Components of a web service description
22
Description
Type
1+
Message
1+
Port Type
1+
Operation
1+
Binding
Style
1+
Service
Protocol Port
1+
Binding EndpointRequest Response
1+
optional
required (one)
required (one or more)
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Interface
• Consider the interface for a Caching service
that allows users to cache content
23
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
Messages
24
<wsdl:message name="findInCacheRequest">
<wsdl:part name="key" type="soapenc:string"/>
</wsdl:message>
<wsdl:message name="findInCacheResponse">
<wsdl:part name="result" type="soapenc:string"/>
</wsdl:message>

 <wsdl:message name="cacheRequest">
<wsdl:part name="key" type="soapenc:string"/>
<wsdl:part name="content" type="soapenc:string"/>
</wsdl:message>
<wsdl:message name="cacheResponse"/>
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Port Type
• Port Type
25
<wsdl:portType name="Caching">
<wsdl:operation name="cache" parameterOrder="key content">
<wsdl:input name="cacheRequest"

 
 
 
 message="impl:cacheRequest"/>
<wsdl:output name="cacheResponse"

 
 
 
 message="impl:cacheResponse"/>
</wsdl:operation>
<wsdl:operation name="findInCache" parameterOrder="key">
<wsdl:input name="findInCacheRequest"

 
 
 
 message="impl:findInCacheRequest"/>
<wsdl:output name="findInCacheResponse"

 
 
 
 message="impl:findInCacheResponse"/>
</wsdl:operation>
</wsdl:portType>
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Service Binding
• Port Type
26
<wsdl:binding name="CachingSoapBinding" type="impl:Caching">
<wsdlsoap:binding style="rpc"

 
 transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="cache">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="cacheRequest">
<wsdlsoap:body use="encoded" encodingStyle="http://
schemas.xmlsoap.org/soap/encoding/" namespace="urn:Cache"/>
</wsdl:input>
<wsdl:output name="cacheResponse">
<wsdlsoap:body use="encoded" encodingStyle="http://
schemas.xmlsoap.org/soap/encoding/" namespace="urn:Cache"/>
</wsdl:output>
</wsdl:operation>
<!-- SAME FOR findCache operation -->
</wsdl:binding>
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Service
• Service ties it all together: it defines one or
more ports, with binding and endpoint
27
<wsdl:service name="CachingService">
<wsdl:port name="Caching"

 
 
 
 binding="impl:CachingSoapBinding">
<wsdlsoap:address location=

 
 
 
 "http://localhost:9090/axis/services/Caching"/>
</wsdl:port>
</wsdl:service>
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
28
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Service Directory
• A service directory allows publishers to
publish information about their services, and
users to locate them (and receive updates)
29
User
Provider
Directory
publish
delete
update
locate: ServiceInformation
subscribe
Service
Information
Service
Implementation
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
UDDI Structure
• UDDI stores service information in the
form of business entities, business services,
binding templates and technical models
30
Business
Entity
0,,*
Business
Service
Binding
Template
0,,*
0,,*
Technical
Model
0,,*0,,*
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
31
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
32
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Apache Axis Architecture
33
Tomcat Servlet Container
Apache
Axis
Servlet
Web
Service 1
Web
Service 2
Web
Service 3
Client
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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)
34
Java B
eg .Net
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
35
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Axis Artefacts and Flow
36
Service
Interface
WSDL
Java2WSDL
Service
Interface
Service
Locator
Service
Stub
WSDL2Java
Client-side files Server-side files
WSDD
Deploy
Service
Binding
Service
Skeleton
Service
WSDD
Undeploy
WSDL2Java
(optional)
Generated User-
defined
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Provide a Java Interface
• Define the functionality you want to expose
as a web service using an interface
package cache;
public interface Caching {
public String findInCache(String key);
public void cache(String key, String content)
}
37
Caching
findInCache
cache
1
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Interface Segregation
• Achieve greater coherence by limiting your
interfaces to related methods
• Implement multiple ports in one service
38
ContentProviderRetrieval
Billing
Billing
processBilling
Retrieval
retrieveArticle
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Create WSDL from Java
• Create the WSDL (Caching.wsdl) from the
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
java org.apache.axis.wsdl.Java2WSDL
-o "cache/Caching.wsdl"
-l "http://localhost:8080/axis/services/Caching"
-n "urn:Cache" -p"cache" "urn:Cache"
cache.Caching
39
2
step2.sh
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
40
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Create Bindings from WSDL
• While we can create our SOAP messages to
invoke a service at runtime (more later), ...
• ... it is generally better to use WSDL2Java to
convert a WSDL file into Java stubs
41
3
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
java org.apache.axis.wsdl.WSDL2Java -o . 
-Nurn:Cache cache.stubs cache/Caching.wsdl
42
step3.sh
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Implement Service Interface
• Implement the service by implementing the
Caching interface
43
4
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
• Separating interface from implementation is a
core element of loose coupling
Cache
findInCache
cache
Caching
findInCache
cache
Client
Interface-Implementation
Separation
44
Dependency Inversion
Principle
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Deploy the Service
• In a Web Service Deployment Descriptor
(WSDD) tell Axis how to route requests to
the correct target (service) class
45
5
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:
java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Caching" provider="java:RPC">
<parameter name="className" value="cache.Cache"/>
<parameter name="scope" value="Application"/>
<parameter name="allowedMethods"
value="findInCache cache"/>
</service>
</deployment>
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
46
java org.apache.axis.transport.http.SimpleAxisServer 
-p 9090
axis.sh
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
• Now we are ready to invoke the service
47
> java org.apache.axis.client.AdminClient 
-p 9090 deploy.wsdd
Processing file cache/deploy.wsdd
<Admin>Done processing</Admin>
admin.sh
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Create the Client
• There are two ways to invoke a service
• Dynamic client: create a Call object for
each method at runtime
• Static client: generate a static proxy from
the WSDL description
48
5
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Dynamic Client
49
public class DirectCachingClient {

 public static void main(String[] args) {

 
 try {

 
 
 String endpoint =

 
 
 
 "http://localhost:9090/axis/services/Caching";

 
Service service = new Service();

 
 Call call = (Call) service.createCall();

 
 call.setTargetEndpointAddress(new java.net.URL(endpoint));

 
 call.setOperation("findCache");

 

 call.setReturnType(XMLType.XSD_STRING);

 
 String ret = (String) call.invoke(

 
 
 
 new String[] {"theAnswer"});

 
System.out.println("Received: " + ret);

 
 } catch (Exception e) {

 
 System.err.println("Exception: " + e);

 
 }

 }
}
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Static Client
50
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("theAnswer");
if (answer == null) {
port.cache("theAnswer", "42");
}
answer = port.findInCache("theAnswer");
System.out.println(answer);
} catch (Exception e) {
System.err.println("Exception: " + e);
}
}
}
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
51
set AXIS_HOME="$home/axis"
set CLASSPATH="${CLASSPATH}:$AXIS_HOME/lib/axis-ant.jar"
set CLASSPATH="${CLASSPATH}:$AXIS_HOME/lib/axis.jar"
...
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Axis User Guide
http://ws.apache.org/axis/java/user-guide.html
52
for more information
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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 ...
53
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
WSDL Repository/
UDDI Registry
Bookstore
1
Bookstore
2
Bookstore
3
Axis Engine
OrderProcessing
Stub 1
OrderProcessing
Stub 1
WSDL
Client
Stubs
Portal
OrderProcessing
Stub(s)
Deploy
Invoke
Actual
calls
1
1
2
3
4
5
Actors and Interactions
54
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Interface
• The bookstore exposes an OrderProcessing
interface through which to place orders
• Orders can also be canceled given their OID
55
public interface OrderProcessing {
public String processOrder(String customer, String[] isbns,

 
 int[] quantities);
public void cancel(String oid);
}
Bookstore
processOrder
cancel
OrderProcessing
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
WSDL and Stubs
• Generate the WSDL from the interface
• Generate client stubs from the WSDL
56
step2.sh bookstore_v1 OrderProcessing Bookstore 
bookstore_v1
OrderProcessing.wsdl
step3.sh bookstore_v1 OrderProcessing Bookstore 
bookstore_v1.stubs
OrderProcessingServiceLocator
OrderProcessingService
OrderProcessing
OrderProcessingStub
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Service (1)
• Much of the following code is stubbed out,
as it is not related to web services
57
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
Service (2)
• And to finish off ...
58

 // ...
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 "o" + nextOid++;
}
}
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Deploy the Service
• Deployment descriptor for the bookstore is
similar to that for the Caching service
59
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="OrderProcessing" provider="java:RPC">
<parameter name="className" value="bookstore_v1.Bookstore"/>
<parameter name="scope" value="Application"/>
<parameter name="allowedMethods" value="processOrder cancel"/>
</service>
</deployment>
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Client
60
public class BookstoreClient {
public static void main(String[] args) {

 try {

 OrderProcessingService service =

 
 
 
 new OrderProcessingServiceLocator();

 OrderProcessing port = service.getOrderProcessing();

String oid = port.processOrder("joe@doe.com",


 new String[] {"123456", "732541"},

 
 
 
 new int[] {2, 1});

System.out.println("order " + oid + " placed");

port.cancel(oid);

System.out.println("order " + oid + " canceled");
} catch (Exception e) {

System.err.println("Exception: " + e);
}
}
}
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
61
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
62
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Taking Orders now!
• Business objects can contain primitive and
complex data as in the Order example
63
Order
customer: String
lineItems: LineItem[]
setCustomer
getCustomer: String
setLineItems
getLineItems: LineItem[]
LineItem
isbn: String
quantity: int
setIsbn
getIsbn: String
setQuantity
getQuantity: int
*
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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 !
64
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Mapping of Primitive Types
• Primitive types
defined in
standard SOAP
encoding
65
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
66
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Bean Mapping
• Need to define a bean mapping in WSDD by
adding a <beanMapping> tag
• Maps a Java bean to an XML qualified name
(qname) associated with a namespace
<beanMapping qname="ns:Order" xmlns:ns="urn:Bookstore"
languageSpecificType="java:bookstore_v2.Order"/>
67
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Orders in XML
• XML schema for the Order type
68
<complexType name="Order">
<sequence>
<element name="customer" type="soapenc:string" .../>
<element name="lineItems" type="impl:ArrayOfLineItem" .../>
</sequence>
</complexType>
<complexType name="LineItem">
<sequence>
<element name="isbn" type="soapenc:string" .../>
<element name="quantity" type="xsd:int" .../>
</sequence>
</complexType>
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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;

 }
// ...
69
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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;
}
}
70
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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="ArrayOfLineItem">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="impl:LineItem[]"/>
</restriction>
</complexContent>
</complexType>
71
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Bookstore
• New interface to our bookstore that uses
business objects (ie Order)
72
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
Bookstore Client
public class BookstoreClient {
public static void main(String[] args) {
try {

 OrderProcessingService service =

 
 
 
 new OrderProcessingServiceLocator();

 OrderProcessing port = service.getOrderProcessing();

 Order order = new Order("joe@doe.com", new LineItem[] {

 
 
 new LineItem("123456", 2),

 
 
 new LineItem("732541", 1)

 
 });
String oid = port.processOrder(order);
System.out.println("order " + oid + " placed");
port.cancel(oid);
System.out.println("order " + oid + " canceled");
} catch (Exception e) {
System.err.println("Exception: " + e);
}
}
}
73
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="OrderProcessing" provider="java:RPC">

<parameter name="className" value="bookstore_v2.Bookstore"/>

<parameter name="allowedMethods" value="processOrder cancel"/>

<beanMapping qname="ns:Order" xmlns:ns="urn:Bookstore"

 
 languageSpecificType="java:bookstore_v2.Order"/>

 
 <beanMapping qname="ns:LineItem" xmlns:ns="urn:Bookstore"

 
 languageSpecificType="java:bookstore_v2.LineItem"/>
</service>
</deployment>
74
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
75
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
76
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
77
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Ordering Process
78
Select Products
to Order
Enter Customer
Information
Submit Product
Order
Create Order
Remove from
Warehouse
Ship ProductsReceive
Products
Customer Store
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
79
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
80
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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 !)
81
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Process Logic in BPEL
Client Web Service
businessProcess()
BPEL Container
invoke()
receive()
reply()
wait()
terminate()
sequence()
pick()
flow()
BPEL Flows
82
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Business Process Pattern
<<interface>>
BusinessActivity
run()
BusinessActivityImpl
run()
<<interface>>
BusinessProcess
run()
ActivitySequence
next()
get()
Data
get()
set()
BusinessProcessImpl
run()
83
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
84
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
85
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
86
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Product Order Process
<<interface>>
BusinessActivity
setData()
run()
isComplete()
getReturnValue()
isSuccessful()
CreateOrder
run()
RemoveProduct
Quantity
run()
ActivitySequence
next()
get()
ProductOrderImpl
createProductOrder()
run()
ShipProducts
run()
BusinessProcess
run()
ProductOrderWeb
Service
createProductOrder()
Hashtable
87
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
88
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Advanced Issues
89
Workflows
Mobile
Services
QoS/Policy
Security
Coordination
Semantics
Web
Services
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Client-Server
Desktops
N-Tier
Spaces
Embedded Networks
Agents
Web services
Grids
P2P
Distributed Objects
}
Social Computing
Utility
Semantic Web
Coordination Media
} Semantic Grid
} MirrorWorld
1990's
2000's
20??'sUbiquitous Computing
Convergence
90
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
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
91
Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006
Further Reading
• Taylor, From P2P toWeb 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
92

More Related Content

What's hot

Java Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIJava Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDI
IMC Institute
 
Introduction to webservices
Introduction to webservicesIntroduction to webservices
Introduction to webservices
Gagandeep Singh
 
Web services SOAP
Web services SOAPWeb services SOAP
Web services SOAP
princeirfancivil
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service Introduction
Madhukar Kumar
 
Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentation
guest0df6b0
 
Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Martin Necasky
 
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
ecosio GmbH
 
SOA - From Webservices to APIs
SOA - From Webservices to APIsSOA - From Webservices to APIs
SOA - From Webservices to APIs
Holger Reinhardt
 
Understanding Web services
Understanding Web servicesUnderstanding Web services
Understanding Web services
Fabricio Epaminondas
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web servicesNeil Ghosh
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
Peter R. Egli
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdl
princeirfancivil
 
WSDL
WSDLWSDL
Introduction to web services and how to in php
Introduction to web services and how to in phpIntroduction to web services and how to in php
Introduction to web services and how to in php
Amit Kumar Singh
 
Wsdl
WsdlWsdl
SOAP, UDDI, WSDL. XML definitions
SOAP, UDDI, WSDL. XML definitions SOAP, UDDI, WSDL. XML definitions
SOAP, UDDI, WSDL. XML definitions
Wish Mrt'xa
 
Web Service
Web ServiceWeb Service
Web Service
Ashwani kumar
 
web service technologies
web service technologiesweb service technologies
web service technologies
Yash Darak
 

What's hot (20)

Java Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIJava Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDI
 
Introduction to webservices
Introduction to webservicesIntroduction to webservices
Introduction to webservices
 
Web services SOAP
Web services SOAPWeb services SOAP
Web services SOAP
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service Introduction
 
Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentation
 
Web Services - WSDL
Web Services - WSDLWeb Services - WSDL
Web Services - WSDL
 
Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)
 
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
 
SOA - From Webservices to APIs
SOA - From Webservices to APIsSOA - From Webservices to APIs
SOA - From Webservices to APIs
 
Understanding Web services
Understanding Web servicesUnderstanding Web services
Understanding Web services
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web services
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdl
 
WSDL
WSDLWSDL
WSDL
 
Web service introduction
Web service introductionWeb service introduction
Web service introduction
 
Introduction to web services and how to in php
Introduction to web services and how to in phpIntroduction to web services and how to in php
Introduction to web services and how to in php
 
Wsdl
WsdlWsdl
Wsdl
 
SOAP, UDDI, WSDL. XML definitions
SOAP, UDDI, WSDL. XML definitions SOAP, UDDI, WSDL. XML definitions
SOAP, UDDI, WSDL. XML definitions
 
Web Service
Web ServiceWeb Service
Web Service
 
web service technologies
web service technologiesweb service technologies
web service technologies
 

Viewers also liked

Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
Angelin R
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
Lorna Mitchell
 
O Plano Tecnologico e a Seguranca Informatica
O Plano Tecnologico e a Seguranca InformaticaO Plano Tecnologico e a Seguranca Informatica
O Plano Tecnologico e a Seguranca InformaticaConferencias FIST
 
Getting started with MySQL on Amazon Web Services
Getting started with MySQL on Amazon Web ServicesGetting started with MySQL on Amazon Web Services
Getting started with MySQL on Amazon Web Services
Ronald Bradford
 
Xml interview questions
Xml interview questionsXml interview questions
Xml interview questions
Siddharth Pandey
 
Java Colombo: Developing Highly Scalable Apps
Java Colombo: Developing Highly Scalable AppsJava Colombo: Developing Highly Scalable Apps
Java Colombo: Developing Highly Scalable AppsAfkham Azeez
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)Arjun Shanka
 
Unleashing the Power of XSLT: Catalog Records in Batch
Unleashing the Power of XSLT: Catalog Records in BatchUnleashing the Power of XSLT: Catalog Records in Batch
Unleashing the Power of XSLT: Catalog Records in Batchc7002593
 
The Mystical Principles of XSLT: Enlightenment through Software Visualization
The Mystical Principles of XSLT: Enlightenment through Software VisualizationThe Mystical Principles of XSLT: Enlightenment through Software Visualization
The Mystical Principles of XSLT: Enlightenment through Software Visualization
evanlenz
 
Applying an IBM SOA Approach to Manual Processes Automation
Applying an IBM SOA Approach to Manual Processes AutomationApplying an IBM SOA Approach to Manual Processes Automation
Applying an IBM SOA Approach to Manual Processes Automation
Prolifics
 
XML - Displaying Data ith XSLT
XML - Displaying Data ith XSLTXML - Displaying Data ith XSLT
XML - Displaying Data ith XSLT
Dudy Ali
 
Xml part4
Xml part4Xml part4
Xml part4
NOHA AW
 
Xml part5
Xml part5Xml part5
Xml part5
NOHA AW
 
Webservices(or)SoapUI Interview Questions
Webservices(or)SoapUI Interview QuestionsWebservices(or)SoapUI Interview Questions
Webservices(or)SoapUI Interview Questions
H2kInfosys
 
SOA Governance and WebSphere Service Registry and Repository
SOA Governance and WebSphere Service Registry and RepositorySOA Governance and WebSphere Service Registry and Repository
SOA Governance and WebSphere Service Registry and Repository
IBM Sverige
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
Carol McDonald
 
Open Id, O Auth And Webservices
Open Id, O Auth And WebservicesOpen Id, O Auth And Webservices
Open Id, O Auth And Webservices
Myles Eftos
 
XSLT for Web Developers
XSLT for Web DevelopersXSLT for Web Developers
XSLT for Web Developers
Sanders Kleinfeld
 

Viewers also liked (20)

Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
 
Web Services
Web ServicesWeb Services
Web Services
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
O Plano Tecnologico e a Seguranca Informatica
O Plano Tecnologico e a Seguranca InformaticaO Plano Tecnologico e a Seguranca Informatica
O Plano Tecnologico e a Seguranca Informatica
 
Getting started with MySQL on Amazon Web Services
Getting started with MySQL on Amazon Web ServicesGetting started with MySQL on Amazon Web Services
Getting started with MySQL on Amazon Web Services
 
Xml interview questions
Xml interview questionsXml interview questions
Xml interview questions
 
Java Colombo: Developing Highly Scalable Apps
Java Colombo: Developing Highly Scalable AppsJava Colombo: Developing Highly Scalable Apps
Java Colombo: Developing Highly Scalable Apps
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
Unleashing the Power of XSLT: Catalog Records in Batch
Unleashing the Power of XSLT: Catalog Records in BatchUnleashing the Power of XSLT: Catalog Records in Batch
Unleashing the Power of XSLT: Catalog Records in Batch
 
Web Services
Web ServicesWeb Services
Web Services
 
The Mystical Principles of XSLT: Enlightenment through Software Visualization
The Mystical Principles of XSLT: Enlightenment through Software VisualizationThe Mystical Principles of XSLT: Enlightenment through Software Visualization
The Mystical Principles of XSLT: Enlightenment through Software Visualization
 
Applying an IBM SOA Approach to Manual Processes Automation
Applying an IBM SOA Approach to Manual Processes AutomationApplying an IBM SOA Approach to Manual Processes Automation
Applying an IBM SOA Approach to Manual Processes Automation
 
XML - Displaying Data ith XSLT
XML - Displaying Data ith XSLTXML - Displaying Data ith XSLT
XML - Displaying Data ith XSLT
 
Xml part4
Xml part4Xml part4
Xml part4
 
Xml part5
Xml part5Xml part5
Xml part5
 
Webservices(or)SoapUI Interview Questions
Webservices(or)SoapUI Interview QuestionsWebservices(or)SoapUI Interview Questions
Webservices(or)SoapUI Interview Questions
 
SOA Governance and WebSphere Service Registry and Repository
SOA Governance and WebSphere Service Registry and RepositorySOA Governance and WebSphere Service Registry and Repository
SOA Governance and WebSphere Service Registry and Repository
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
Open Id, O Auth And Webservices
Open Id, O Auth And WebservicesOpen Id, O Auth And Webservices
Open Id, O Auth And Webservices
 
XSLT for Web Developers
XSLT for Web DevelopersXSLT for Web Developers
XSLT for Web Developers
 

Similar to Web services

WebServices Basics
WebServices BasicsWebServices Basics
WebServices Basics
Rajkattamuri
 
AJAX the Great: The Origin and Development of the Dynamic Web (2007)
AJAX the Great: The Origin and Development of the Dynamic Web (2007)AJAX the Great: The Origin and Development of the Dynamic Web (2007)
AJAX the Great: The Origin and Development of the Dynamic Web (2007)
Fran Fabrizio
 
Microservices bell labs_kulak_final
Microservices bell labs_kulak_finalMicroservices bell labs_kulak_final
Microservices bell labs_kulak_final
Ty Le
 
Towards a Web of Services
Towards a Web of ServicesTowards a Web of Services
Towards a Web of Services
Carlos Pedrinaci
 
End to-end W3C - JS.everywhere(2012) Europe
End to-end W3C - JS.everywhere(2012) EuropeEnd to-end W3C - JS.everywhere(2012) Europe
End to-end W3C - JS.everywhere(2012) EuropeAlexandre Morgaut
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and development
ishmecse13
 
key research challenges in cloud computing
key research challenges in cloud computingkey research challenges in cloud computing
key research challenges in cloud computingIgnacio M. Llorente
 
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
Chanaka Fernando
 
International Journal on AdHoc Networking Systems (IJANS)
International Journal on AdHoc Networking Systems (IJANS)International Journal on AdHoc Networking Systems (IJANS)
International Journal on AdHoc Networking Systems (IJANS)
pijans
 
Introduction to WSO2 Integration Platform
Introduction to WSO2 Integration PlatformIntroduction to WSO2 Integration Platform
Introduction to WSO2 Integration Platform
Kasun Indrasiri
 
Cloud Native Computing Foundation: How Virtualization and Containers are Chan...
Cloud Native Computing Foundation: How Virtualization and Containers are Chan...Cloud Native Computing Foundation: How Virtualization and Containers are Chan...
Cloud Native Computing Foundation: How Virtualization and Containers are Chan...
Experfy
 
O2 platform and ASP.NET MVC, by Michael Hidalgo
O2 platform and ASP.NET MVC, by Michael HidalgoO2 platform and ASP.NET MVC, by Michael Hidalgo
O2 platform and ASP.NET MVC, by Michael Hidalgo
Dinis Cruz
 
SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule Esb
Anand kalla
 
Hva er SOA og Web services?
Hva er SOA og Web services?Hva er SOA og Web services?
Hva er SOA og Web services?
Brian Elvesæter
 
Moxon discovery platform
Moxon discovery platformMoxon discovery platform
Moxon discovery platformAmanda Carlson
 
Cosa 2010 discovery platform moxon
Cosa 2010 discovery platform moxonCosa 2010 discovery platform moxon
Cosa 2010 discovery platform moxonsirsidynix
 
Concurrency at Scale: Evolution to Micro-Services
Concurrency at Scale:  Evolution to Micro-ServicesConcurrency at Scale:  Evolution to Micro-Services
Concurrency at Scale: Evolution to Micro-Services
Randy Shoup
 
Linked Services for the Web of Data
Linked Services for the Web of DataLinked Services for the Web of Data
Linked Services for the Web of Data
Carlos Pedrinaci
 

Similar to Web services (20)

WebServices Basics
WebServices BasicsWebServices Basics
WebServices Basics
 
AJAX the Great: The Origin and Development of the Dynamic Web (2007)
AJAX the Great: The Origin and Development of the Dynamic Web (2007)AJAX the Great: The Origin and Development of the Dynamic Web (2007)
AJAX the Great: The Origin and Development of the Dynamic Web (2007)
 
Ntg web services
Ntg   web servicesNtg   web services
Ntg web services
 
Microservices bell labs_kulak_final
Microservices bell labs_kulak_finalMicroservices bell labs_kulak_final
Microservices bell labs_kulak_final
 
Towards a Web of Services
Towards a Web of ServicesTowards a Web of Services
Towards a Web of Services
 
End to-end W3C - JS.everywhere(2012) Europe
End to-end W3C - JS.everywhere(2012) EuropeEnd to-end W3C - JS.everywhere(2012) Europe
End to-end W3C - JS.everywhere(2012) Europe
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and development
 
key research challenges in cloud computing
key research challenges in cloud computingkey research challenges in cloud computing
key research challenges in cloud computing
 
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
 
International Journal on AdHoc Networking Systems (IJANS)
International Journal on AdHoc Networking Systems (IJANS)International Journal on AdHoc Networking Systems (IJANS)
International Journal on AdHoc Networking Systems (IJANS)
 
Introduction to WSO2 Integration Platform
Introduction to WSO2 Integration PlatformIntroduction to WSO2 Integration Platform
Introduction to WSO2 Integration Platform
 
Wcf v1-day1
Wcf v1-day1Wcf v1-day1
Wcf v1-day1
 
Cloud Native Computing Foundation: How Virtualization and Containers are Chan...
Cloud Native Computing Foundation: How Virtualization and Containers are Chan...Cloud Native Computing Foundation: How Virtualization and Containers are Chan...
Cloud Native Computing Foundation: How Virtualization and Containers are Chan...
 
O2 platform and ASP.NET MVC, by Michael Hidalgo
O2 platform and ASP.NET MVC, by Michael HidalgoO2 platform and ASP.NET MVC, by Michael Hidalgo
O2 platform and ASP.NET MVC, by Michael Hidalgo
 
SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule Esb
 
Hva er SOA og Web services?
Hva er SOA og Web services?Hva er SOA og Web services?
Hva er SOA og Web services?
 
Moxon discovery platform
Moxon discovery platformMoxon discovery platform
Moxon discovery platform
 
Cosa 2010 discovery platform moxon
Cosa 2010 discovery platform moxonCosa 2010 discovery platform moxon
Cosa 2010 discovery platform moxon
 
Concurrency at Scale: Evolution to Micro-Services
Concurrency at Scale:  Evolution to Micro-ServicesConcurrency at Scale:  Evolution to Micro-Services
Concurrency at Scale: Evolution to Micro-Services
 
Linked Services for the Web of Data
Linked Services for the Web of DataLinked Services for the Web of Data
Linked Services for the Web of Data
 

Recently uploaded

ModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdfModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
fisherameliaisabella
 
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
taqyed
 
Premium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern BusinessesPremium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern Businesses
SynapseIndia
 
BeMetals Presentation_May_22_2024 .pdf
BeMetals Presentation_May_22_2024   .pdfBeMetals Presentation_May_22_2024   .pdf
BeMetals Presentation_May_22_2024 .pdf
DerekIwanaka1
 
anas about venice for grade 6f about venice
anas about venice for grade 6f about veniceanas about venice for grade 6f about venice
anas about venice for grade 6f about venice
anasabutalha2013
 
Project File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdfProject File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdf
RajPriye
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
creerey
 
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n PrintAffordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Navpack & Print
 
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-indiafalcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
Falcon Invoice Discounting
 
What is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdfWhat is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdf
seoforlegalpillers
 
Exploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social DreamingExploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social Dreaming
Nicola Wreford-Howard
 
Digital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and TemplatesDigital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and Templates
Aurelien Domont, MBA
 
The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...
balatucanapplelovely
 
The-McKinsey-7S-Framework. strategic management
The-McKinsey-7S-Framework. strategic managementThe-McKinsey-7S-Framework. strategic management
The-McKinsey-7S-Framework. strategic management
Bojamma2
 
Buy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star ReviewsBuy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star Reviews
usawebmarket
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
Cynthia Clay
 
Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111
zoyaansari11365
 
Improving profitability for small business
Improving profitability for small businessImproving profitability for small business
Improving profitability for small business
Ben Wann
 
5 Things You Need To Know Before Hiring a Videographer
5 Things You Need To Know Before Hiring a Videographer5 Things You Need To Know Before Hiring a Videographer
5 Things You Need To Know Before Hiring a Videographer
ofm712785
 
What are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdfWhat are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdf
HumanResourceDimensi1
 

Recently uploaded (20)

ModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdfModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
 
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
 
Premium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern BusinessesPremium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern Businesses
 
BeMetals Presentation_May_22_2024 .pdf
BeMetals Presentation_May_22_2024   .pdfBeMetals Presentation_May_22_2024   .pdf
BeMetals Presentation_May_22_2024 .pdf
 
anas about venice for grade 6f about venice
anas about venice for grade 6f about veniceanas about venice for grade 6f about venice
anas about venice for grade 6f about venice
 
Project File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdfProject File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdf
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
 
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n PrintAffordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n Print
 
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-indiafalcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
 
What is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdfWhat is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdf
 
Exploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social DreamingExploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social Dreaming
 
Digital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and TemplatesDigital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and Templates
 
The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...
 
The-McKinsey-7S-Framework. strategic management
The-McKinsey-7S-Framework. strategic managementThe-McKinsey-7S-Framework. strategic management
The-McKinsey-7S-Framework. strategic management
 
Buy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star ReviewsBuy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star Reviews
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
 
Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111
 
Improving profitability for small business
Improving profitability for small businessImproving profitability for small business
Improving profitability for small business
 
5 Things You Need To Know Before Hiring a Videographer
5 Things You Need To Know Before Hiring a Videographer5 Things You Need To Know Before Hiring a Videographer
5 Things You Need To Know Before Hiring a Videographer
 
What are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdfWhat are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdf
 

Web services

  • 1. Web Services Michael Weiss Carleton University Web site for this tutorial: www.scs.carleton.ca/~weiss/talks/mcetech06
  • 2. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 2
  • 3. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 3
  • 4. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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) 4
  • 5. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Application Integration 5 Bus Portal Applications User
  • 6. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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) 6
  • 7. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Second Generation Services • Complex, and aggregated from web services provided by third parties (hence, open) 7 Rate Quotes Transit Times Duty and Taxation Print Shipping Labels Shipping <<uses>> Organizational Boundaries Service
  • 8. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Web of Services • In second generation services, applications are assembled from services dynamically • Roles of service user and provider blend into what others call servents (eg in P2P) Service user Service provider Composite services 8 Servent
  • 9. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Vision • Build your applications • Dynamically discover and orchestrate the execution of services on the network • Will be able to choose between alternative implementations of the same service Application Services Implementation Interface 9 Semantics on demand
  • 10. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 10
  • 11. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Service-Oriented Architecture 11 Service User Service User Service Registry Service Registry Service Provider Service Provider Find Bind + Invoke Describe + Publish UDDI WSDLSOAP
  • 12. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Web Services Layers 12 Application Services (transaction - eg ticket purchase, information - eg tourist guide) Application ServicesApplication Services ((transactiontransaction -- egeg ticket purchase,ticket purchase, informationinformation -- egeg tourist guide)tourist guide) SOAP, WSDL, UDDISOAP, WSDL, UDDISOAP, WSDL, UDDI XML, HTTPXML, HTTPXML, HTTP Collaboration Services (orchestration, matchmaking, translation) Collaboration ServicesCollaboration Services (orchestration, matchmaking, translation)(orchestration, matchmaking, translation) Utility Services (security, billing, QoS, metering, routing, transactions, messaging) Utility ServicesUtility Services (security, billing,(security, billing, QoSQoS, metering, routing, transactions, messaging), metering, routing, transactions, messaging)
  • 13. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 13
  • 14. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 14
  • 15. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 SOAP Messages • SOAP messages are XML documents usually sent over HTTP with a certain format 15
  • 16. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 SOAP Messages • Components of a SOAP message 16 Envelope Header Body Payload Fault 1+ optional required (one) required (one or more)
  • 17. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 17
  • 18. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 SOAP Containers 18
  • 19. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Binding to a Service • Clients get address and messages from a WSDL description of the service 19
  • 20. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Client Proxy • The binding process (dynamically) returns a proxy to the remote web service 20
  • 21. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 21
  • 22. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 WSDL Decription • Components of a web service description 22 Description Type 1+ Message 1+ Port Type 1+ Operation 1+ Binding Style 1+ Service Protocol Port 1+ Binding EndpointRequest Response 1+ optional required (one) required (one or more)
  • 23. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Interface • Consider the interface for a Caching service that allows users to cache content 23 public String findInCache(String key); public void cache(String key, String content) Caching findInCache cache
  • 24. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Messages 24 <wsdl:message name="findInCacheRequest"> <wsdl:part name="key" type="soapenc:string"/> </wsdl:message> <wsdl:message name="findInCacheResponse"> <wsdl:part name="result" type="soapenc:string"/> </wsdl:message> <wsdl:message name="cacheRequest"> <wsdl:part name="key" type="soapenc:string"/> <wsdl:part name="content" type="soapenc:string"/> </wsdl:message> <wsdl:message name="cacheResponse"/>
  • 25. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Port Type • Port Type 25 <wsdl:portType name="Caching"> <wsdl:operation name="cache" parameterOrder="key content"> <wsdl:input name="cacheRequest" message="impl:cacheRequest"/> <wsdl:output name="cacheResponse" message="impl:cacheResponse"/> </wsdl:operation> <wsdl:operation name="findInCache" parameterOrder="key"> <wsdl:input name="findInCacheRequest" message="impl:findInCacheRequest"/> <wsdl:output name="findInCacheResponse" message="impl:findInCacheResponse"/> </wsdl:operation> </wsdl:portType>
  • 26. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Service Binding • Port Type 26 <wsdl:binding name="CachingSoapBinding" type="impl:Caching"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="cache"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="cacheRequest"> <wsdlsoap:body use="encoded" encodingStyle="http:// schemas.xmlsoap.org/soap/encoding/" namespace="urn:Cache"/> </wsdl:input> <wsdl:output name="cacheResponse"> <wsdlsoap:body use="encoded" encodingStyle="http:// schemas.xmlsoap.org/soap/encoding/" namespace="urn:Cache"/> </wsdl:output> </wsdl:operation> <!-- SAME FOR findCache operation --> </wsdl:binding>
  • 27. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Service • Service ties it all together: it defines one or more ports, with binding and endpoint 27 <wsdl:service name="CachingService"> <wsdl:port name="Caching" binding="impl:CachingSoapBinding"> <wsdlsoap:address location= "http://localhost:9090/axis/services/Caching"/> </wsdl:port> </wsdl:service>
  • 28. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 28
  • 29. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Service Directory • A service directory allows publishers to publish information about their services, and users to locate them (and receive updates) 29 User Provider Directory publish delete update locate: ServiceInformation subscribe Service Information Service Implementation
  • 30. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 UDDI Structure • UDDI stores service information in the form of business entities, business services, binding templates and technical models 30 Business Entity 0,,* Business Service Binding Template 0,,* 0,,* Technical Model 0,,*0,,*
  • 31. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 31
  • 32. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 32
  • 33. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Apache Axis Architecture 33 Tomcat Servlet Container Apache Axis Servlet Web Service 1 Web Service 2 Web Service 3 Client
  • 34. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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) 34 Java B eg .Net
  • 35. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 35
  • 36. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Axis Artefacts and Flow 36 Service Interface WSDL Java2WSDL Service Interface Service Locator Service Stub WSDL2Java Client-side files Server-side files WSDD Deploy Service Binding Service Skeleton Service WSDD Undeploy WSDL2Java (optional) Generated User- defined
  • 37. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Provide a Java Interface • Define the functionality you want to expose as a web service using an interface package cache; public interface Caching { public String findInCache(String key); public void cache(String key, String content) } 37 Caching findInCache cache 1
  • 38. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Interface Segregation • Achieve greater coherence by limiting your interfaces to related methods • Implement multiple ports in one service 38 ContentProviderRetrieval Billing Billing processBilling Retrieval retrieveArticle
  • 39. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Create WSDL from Java • Create the WSDL (Caching.wsdl) from the 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 java org.apache.axis.wsdl.Java2WSDL -o "cache/Caching.wsdl" -l "http://localhost:8080/axis/services/Caching" -n "urn:Cache" -p"cache" "urn:Cache" cache.Caching 39 2 step2.sh
  • 40. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 40
  • 41. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Create Bindings from WSDL • While we can create our SOAP messages to invoke a service at runtime (more later), ... • ... it is generally better to use WSDL2Java to convert a WSDL file into Java stubs 41 3
  • 42. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 java org.apache.axis.wsdl.WSDL2Java -o . -Nurn:Cache cache.stubs cache/Caching.wsdl 42 step3.sh
  • 43. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Implement Service Interface • Implement the service by implementing the Caching interface 43 4 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); } }
  • 44. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 • Separating interface from implementation is a core element of loose coupling Cache findInCache cache Caching findInCache cache Client Interface-Implementation Separation 44 Dependency Inversion Principle
  • 45. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Deploy the Service • In a Web Service Deployment Descriptor (WSDD) tell Axis how to route requests to the correct target (service) class 45 5 <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns: java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="Caching" provider="java:RPC"> <parameter name="className" value="cache.Cache"/> <parameter name="scope" value="Application"/> <parameter name="allowedMethods" value="findInCache cache"/> </service> </deployment>
  • 46. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 46 java org.apache.axis.transport.http.SimpleAxisServer -p 9090 axis.sh
  • 47. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 • Now we are ready to invoke the service 47 > java org.apache.axis.client.AdminClient -p 9090 deploy.wsdd Processing file cache/deploy.wsdd <Admin>Done processing</Admin> admin.sh
  • 48. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Create the Client • There are two ways to invoke a service • Dynamic client: create a Call object for each method at runtime • Static client: generate a static proxy from the WSDL description 48 5
  • 49. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Dynamic Client 49 public class DirectCachingClient { public static void main(String[] args) { try { String endpoint = "http://localhost:9090/axis/services/Caching"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperation("findCache"); call.setReturnType(XMLType.XSD_STRING); String ret = (String) call.invoke( new String[] {"theAnswer"}); System.out.println("Received: " + ret); } catch (Exception e) { System.err.println("Exception: " + e); } } }
  • 50. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Static Client 50 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("theAnswer"); if (answer == null) { port.cache("theAnswer", "42"); } answer = port.findInCache("theAnswer"); System.out.println(answer); } catch (Exception e) { System.err.println("Exception: " + e); } } }
  • 51. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 51 set AXIS_HOME="$home/axis" set CLASSPATH="${CLASSPATH}:$AXIS_HOME/lib/axis-ant.jar" set CLASSPATH="${CLASSPATH}:$AXIS_HOME/lib/axis.jar" ...
  • 52. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Axis User Guide http://ws.apache.org/axis/java/user-guide.html 52 for more information
  • 53. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 ... 53
  • 54. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 WSDL Repository/ UDDI Registry Bookstore 1 Bookstore 2 Bookstore 3 Axis Engine OrderProcessing Stub 1 OrderProcessing Stub 1 WSDL Client Stubs Portal OrderProcessing Stub(s) Deploy Invoke Actual calls 1 1 2 3 4 5 Actors and Interactions 54
  • 55. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Interface • The bookstore exposes an OrderProcessing interface through which to place orders • Orders can also be canceled given their OID 55 public interface OrderProcessing { public String processOrder(String customer, String[] isbns, int[] quantities); public void cancel(String oid); } Bookstore processOrder cancel OrderProcessing
  • 56. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 WSDL and Stubs • Generate the WSDL from the interface • Generate client stubs from the WSDL 56 step2.sh bookstore_v1 OrderProcessing Bookstore bookstore_v1 OrderProcessing.wsdl step3.sh bookstore_v1 OrderProcessing Bookstore bookstore_v1.stubs OrderProcessingServiceLocator OrderProcessingService OrderProcessing OrderProcessingStub
  • 57. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Service (1) • Much of the following code is stubbed out, as it is not related to web services 57 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; }
  • 58. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Service (2) • And to finish off ... 58 // ... 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 "o" + nextOid++; } }
  • 59. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Deploy the Service • Deployment descriptor for the bookstore is similar to that for the Caching service 59 <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="OrderProcessing" provider="java:RPC"> <parameter name="className" value="bookstore_v1.Bookstore"/> <parameter name="scope" value="Application"/> <parameter name="allowedMethods" value="processOrder cancel"/> </service> </deployment>
  • 60. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Client 60 public class BookstoreClient { public static void main(String[] args) { try { OrderProcessingService service = new OrderProcessingServiceLocator(); OrderProcessing port = service.getOrderProcessing(); String oid = port.processOrder("joe@doe.com", new String[] {"123456", "732541"}, new int[] {2, 1}); System.out.println("order " + oid + " placed"); port.cancel(oid); System.out.println("order " + oid + " canceled"); } catch (Exception e) { System.err.println("Exception: " + e); } } }
  • 61. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 61
  • 62. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 62
  • 63. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Taking Orders now! • Business objects can contain primitive and complex data as in the Order example 63 Order customer: String lineItems: LineItem[] setCustomer getCustomer: String setLineItems getLineItems: LineItem[] LineItem isbn: String quantity: int setIsbn getIsbn: String setQuantity getQuantity: int *
  • 64. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 ! 64
  • 65. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Mapping of Primitive Types • Primitive types defined in standard SOAP encoding 65
  • 66. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 66
  • 67. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Bean Mapping • Need to define a bean mapping in WSDD by adding a <beanMapping> tag • Maps a Java bean to an XML qualified name (qname) associated with a namespace <beanMapping qname="ns:Order" xmlns:ns="urn:Bookstore" languageSpecificType="java:bookstore_v2.Order"/> 67
  • 68. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Orders in XML • XML schema for the Order type 68 <complexType name="Order"> <sequence> <element name="customer" type="soapenc:string" .../> <element name="lineItems" type="impl:ArrayOfLineItem" .../> </sequence> </complexType> <complexType name="LineItem"> <sequence> <element name="isbn" type="soapenc:string" .../> <element name="quantity" type="xsd:int" .../> </sequence> </complexType>
  • 69. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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; } // ... 69
  • 70. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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; } } 70
  • 71. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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="ArrayOfLineItem"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:LineItem[]"/> </restriction> </complexContent> </complexType> 71
  • 72. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Bookstore • New interface to our bookstore that uses business objects (ie Order) 72 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; } // ... }
  • 73. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Bookstore Client public class BookstoreClient { public static void main(String[] args) { try { OrderProcessingService service = new OrderProcessingServiceLocator(); OrderProcessing port = service.getOrderProcessing(); Order order = new Order("joe@doe.com", new LineItem[] { new LineItem("123456", 2), new LineItem("732541", 1) }); String oid = port.processOrder(order); System.out.println("order " + oid + " placed"); port.cancel(oid); System.out.println("order " + oid + " canceled"); } catch (Exception e) { System.err.println("Exception: " + e); } } } 73
  • 74. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="OrderProcessing" provider="java:RPC"> <parameter name="className" value="bookstore_v2.Bookstore"/> <parameter name="allowedMethods" value="processOrder cancel"/> <beanMapping qname="ns:Order" xmlns:ns="urn:Bookstore" languageSpecificType="java:bookstore_v2.Order"/> <beanMapping qname="ns:LineItem" xmlns:ns="urn:Bookstore" languageSpecificType="java:bookstore_v2.LineItem"/> </service> </deployment> 74
  • 75. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 75
  • 76. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 76
  • 77. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 77
  • 78. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Ordering Process 78 Select Products to Order Enter Customer Information Submit Product Order Create Order Remove from Warehouse Ship ProductsReceive Products Customer Store
  • 79. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 79
  • 80. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 80
  • 81. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 !) 81
  • 82. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Process Logic in BPEL Client Web Service businessProcess() BPEL Container invoke() receive() reply() wait() terminate() sequence() pick() flow() BPEL Flows 82
  • 83. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Business Process Pattern <<interface>> BusinessActivity run() BusinessActivityImpl run() <<interface>> BusinessProcess run() ActivitySequence next() get() Data get() set() BusinessProcessImpl run() 83
  • 84. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 84
  • 85. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 85
  • 86. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 86
  • 87. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Product Order Process <<interface>> BusinessActivity setData() run() isComplete() getReturnValue() isSuccessful() CreateOrder run() RemoveProduct Quantity run() ActivitySequence next() get() ProductOrderImpl createProductOrder() run() ShipProducts run() BusinessProcess run() ProductOrderWeb Service createProductOrder() Hashtable 87
  • 88. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 88
  • 89. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Advanced Issues 89 Workflows Mobile Services QoS/Policy Security Coordination Semantics Web Services
  • 90. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Client-Server Desktops N-Tier Spaces Embedded Networks Agents Web services Grids P2P Distributed Objects } Social Computing Utility Semantic Web Coordination Media } Semantic Grid } MirrorWorld 1990's 2000's 20??'sUbiquitous Computing Convergence 90
  • 91. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 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 91
  • 92. Michael Weiss • Montreal Conference on eTechnologies • May 17-19, 2006 Further Reading • Taylor, From P2P toWeb 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 92