m. adel serhani
TRANSCRIPT
-
8/3/2019 M. ADEL SERHANI
1/36
4/10/20
WEB SERVICE REVOLUTION: TRENDS ANDCHALLENGES
SECOND KUWAIT CONFERENCE ON E-SERVICES AND E-SYSTEMS
M. ADEL SERHANIFACULTY OF INFORMATION TECHNOLOGY
UAE UNIVERSITY
Outline Tutorial Objectives
Part I: Overview of Web Services Concepts
Introduction to SOA
On Demand Business
Main SOA standards: WSDL, SOAP, UDDI, and XML
Service Oriented architecture SOA and Business Challenges
Architectu ral features of SOA: the Webservice Gateway and the EnterpriseService Bus (ESB)
How to implement my fi rst Web Service
Using Netbeans. Web Service Composition
Business Process
BPEL
Service Integration
How to implement my first BPEL processusing Netbeans
Restful Web Services
REST Design Pattern
Restful Architecture
Restful vs. Web service
How to implement my first Restful
Web service using Netbeans.
Part II: Web Service Tools,
Development Platforms and
Applications
Web Services Development Platforms.
Web Services Tools.
Real world applications and casestudies.
Resources: References and online
resources.
2
-
8/3/2019 M. ADEL SERHANI
2/36
4/10/20
Tutorial Objectives
To learn the current state of the art in Web services, contrast and present tools
and techniques for the development of standard and RESTful Web services.
To acquire advanced concepts related Service Oriented Architecture (SOA)
and their standards.
To understand technologies those are involved and/or must be developed to
realize the advanced concepts.
To grasp the potential of Web service compositions.
To discuss and debate the main research challenges in Web services and SOA
adoption.
To learn detailed step-by-step examples of how to program Web services
both SOAP and Restful Web services in Java. And to learn how to build a BPEL composition process.
3
-
8/3/2019 M. ADEL SERHANI
3/36
4/10/20
The On Demand business
IBM defines an on demand business as an
enterprise whose business processes,
integrated end-to-end across the company
and with key partners, suppliers, and customers,
can respond with speed to any customer
demand, market opportunity, or external threat.
5
An on demand business must be:
Responsive can sense and respond to the market
Variable can adapt processes and cost structures
to reduce risk
Focused concentrates on its core business, not
infrastructure
Resilient manages changes and external threats
while keeping its constituents happy.
6
-
8/3/2019 M. ADEL SERHANI
4/36
4/10/20
The idea behind (Web) services
If youve got some code that does something useful
(an EJB or a legacy application, for example), you
can make that code available as a (Web) service.
Ejb, Legacy
Runtime wrapperSOAP, RMI, Java
Design time wrapperWSDL
7
Web Services
A Web service is an implementation of well-defined business
functionality
Are published, found and used through the Web.
It is promoted as a new way to build network applications from
distributed components that are language- and platform-
independent.
Help simple web applications publish their functions on the web
and make them available for integration with other applications.
8
-
8/3/2019 M. ADEL SERHANI
5/36
4/10/20
Web Service Sample Scenario
Consumer of Web Services
Inventory client:
Connect to Web Service
Query
Order
Ship
Deliver
9
Web Service Sample Scenarios (Cont.)
Consumer of Web Services
Road traffic information client
Connect to query conditions
Review options
10
-
8/3/2019 M. ADEL SERHANI
6/36
4/10/20
Web Services Basics
What You Should Know
HTML
XML
What are Web Services
Web services are application components
Web services communicate using open protocols
Web services are self-contained and self-describing
Web services can be discovered using UDDI
Web services can be used by other applications
XML is the basis for Web services
11
Web Services as a Business Asset
Combination of content, application code, process logic
Represented by an XML object
SOAP (Simple Object Access Protocol) protocol
WSDL (Web Services Description Language) description
UDDI (Universal Description, Discovery and Integration)registration
Standards based
Can be shared, combined, used, reused
Supporting heterogeneous users, organizations, firms
12
-
8/3/2019 M. ADEL SERHANI
7/36
4/10/20
Main Uses
Reusability
Help create web-based components that are used by several
applications
Examples:
Currency conversion, weather reports, language translation,
etc.
Integration
Allows different applications to exchange their data (even
when they are implemented in different platforms andprogramming tools).
13
Web Services Standards
JSR-101 (Web Services)
SOAP Definition
Lightweight protocol
XML based
Message elements
Envelope - defines framework fordescribing message contents
Processing options
Encoding rules data types,conventions, remote procedurecalls
Not suitable for pervasivedevices
Due to Resource demands
JSR-172 (J2ME Web Services)
Defines a standard interface to WebServices
Targets for J2ME platform
CDC and CLDC based profiles
Access to remote SOAP / XML basedWeb Service
Parsing XML data (optional)
Minimal memory footprint
14
-
8/3/2019 M. ADEL SERHANI
8/36
4/10/20
Web Service Protocols
transport
network
messaging
service description
service discovery
application
UDDI (Universal Description, Discovery,
and Integration)
WSDL (Web Service Description Language)
XML, SOAP (Simple Object Access Protocol)
TCP, HTTP, SMTP, Jabber
IP
15
-
8/3/2019 M. ADEL SERHANI
9/36
4/10/20
UDDI
UDDI - Universal Description, Discovery, and Integration
protocol.
UDDI is a directory service where businesses can
register and search for Web services.
A directory for storing information about web services
A directory of web service interfaces described by WSDL
Communicates via SOAP
OASIS driven standardization effort
17
UDDI Query and Response Example
The following query, whenplaced inside the body ofthe SOAP envelope, returnsdetails on Microsoft.
Microsoft
18
Microsoft Corporation
Empowering people through great software -any time, any place and on any device is Microsoft'svision. As the worldwide leader in software for personaland business computing, we strive to produce innovativeproducts and services that meet our customer's
Web s ervices for smart searching
Electronic Business Integration Services..
Query Response
-
8/3/2019 M. ADEL SERHANI
10/36
4/10/20
WSDL
WSDL - Web Services Description Language:
WSDL is an XML-based language for describing Web
services and how to access them.
Written in XML as an XML document
Used to describe Web services
Used to locate Web services
19
WSDL Skeleton
A WSDL document can be divided into six major elements
: Root WSDL Element
: What data types will be transmitted?
: What messages will be transmitted?
: What operations will be supported?
: How will the messages be transmitted
on the wire?
: Where is the service located?
20
-
8/3/2019 M. ADEL SERHANI
11/36
4/10/20
SOAP
SOAP - Simple Object Access Protocol:
A protocol for communication between applications
Platform independent and language independent
Simple and extensible
Applies XML for message exchange in support of remote method calls
(invocations) over the Internet (using HTTP).
Compared to remote method invocation and CORBA-based facilities:
SOAP is web-based or wired thus is not subject to firewall restrictions
SOAP is language-independent
SOAP can provide just-in-time service integration
SOAP is developed as a W3C standard
21
SOAP Building Blocks
A SOAP message is an ordinary XML document containing the
following elements:
A required Envelope element that identifies the XML document as a
SOAP message
An optional Header element that contains header information
A required Body element that contains call and response information
An optional Fault element that provides information about errors thatoccurred while processing the message
All the elements above are declared in the default namespacefor the SOAP envelope
22
-
8/3/2019 M. ADEL SERHANI
12/36
4/10/20
SOAP Messages
message body
SOAP body
header block
header block
SOAP header
SOAP envelope
optional
req
uired
23
Skeleton SOAP Message
SOAP Response:
Toptimate 3-PieceSet
827635
3-Piece luggage set. Black
Polyester.96.50
true
SOAP Request:
827635
24
-
8/3/2019 M. ADEL SERHANI
13/36
4/10/20
What is an SOA?
Architecture that leverages open standards to
represent software assets as services
Provides a standard way of representing and
interacting with software assets
Individual software assets become building blocks that
can be reused in developing other applications
The preferred method of building an SOA is (Web)services.
26
-
8/3/2019 M. ADEL SERHANI
14/36
4/10/20
Ordering at a Restaurant Diagram
27
Craig Duncan
Calling a Web service diagram28
Craig Duncan
-
8/3/2019 M. ADEL SERHANI
15/36
4/10/20
S.O.A
SOA uses the find-bind-executeparadigm
29
Benefits of SOA (I)
Applications can be built that are: Platform-independent
Distributed
Secure
Web services will become the common architecture forsystem and application integration Based on open industry standards
Companies and government agencies will be able toeasily communicate with customers and externalpartners
-
8/3/2019 M. ADEL SERHANI
16/36
4/10/20
Benefits of SOA (II)
Loosely-coupled and flexible systems are more usefulthan hard-wired and monolithic ones: Example World Wide Web
Service Oriented Architecture (SOA)
Companies and government agencies will be able toaccess software remotely that they or others havealready built (reuse)
Organizations will be able to extend the life andvalue of legacy systems by exposing existing data as
XML
More reasons to use Web services
Developers will be able to integrate applications: Quickly Easily Inexpensively
Software development and maintenance time will bereduced Increase efficiency 30% Gartner
Data can be secured using industry standard security
methods: Secure Socket Layer (SSL) protocol Public-key certificates WS-Security
-
8/3/2019 M. ADEL SERHANI
17/36
4/10/20
Two Important Concepts in SOA
SOAs are designed to integrate everything in your
enterprise.
Not everything understands SOAP, and not everything is
accessible by HTTP.
The Web services gateway and the Enterprise
service bus are two important architectural features
of an SOA.
33
Web Services Gateway
A Web services gateway is an intermediary
between a SOAP client and a service that doesn't
have a SOAP interface.
A Web service gateway is a front-end to another
type of service. It has two interfaces:
One that understands SOAP
One that understands the native protocol (or languageor data format and so forth) of the service.
Web serviceclient
Web servicesgateway
Legacyapplication
SOAP???
34
-
8/3/2019 M. ADEL SERHANI
18/36
4/10/20
The Web Services Gateway
ClientWeb Svcs.Gateway
SOAP
Service
Local JavaService
JMS
Service
JCAService
CICS
Service
WSDL URL,method name,
methodparameters
protocol-specificdetails
The Gateway:
Takes requests from Webservice clients
Figures out where the
requests should go
Handles the details of
getting it there.
It might convert a SOAPrequest to an MQ message,
for example.
It is an implementation of the
delegate pattern.
35
Managing Interoperability
You can get significant business value from a point-
to-point Web service:
Java client Java service
J2EE application
Packaged apps
B2B service
COBOL system
But what happens
when you have multiple
services?
36
-
8/3/2019 M. ADEL SERHANI
19/36
4/10/20
Managing Interoperability
With multiple clients and services, complexity
becomes a big issue
we need something to simplify this.
Java client Java service
.NET client J2EE application
Packaged apps
B2B service
COBOL system
COBOL client
Perl client
Python client
37
The ESB
IBMs vision is for the Enterprise Service Bus to
handle message routing between Web services.
EnterpriseService
Bus
Java client Java service
J2EE application
Packaged apps
B2B service
COBOL system
.NET client
COBOL client
Perl client
Python client
38
-
8/3/2019 M. ADEL SERHANI
20/36
4/10/20
The ESB
With the ESB, the requestors job is to build a
request according to the services WSDL.
Remember, this might use something other than SOAP,
something other than HTTP, and so forth.
The ESBs job is to figure out how to get the request
to the service, then get the response to the
requestor.
39
How to implement my first Web Service using Netbeans
Install Netbeans version 9.6.1 available under the following link: http://netbeans.org/ , Install the full
version that include the Glassfish Server.
Make sure that a java (JDK) is installed on your computer if not download it from:
http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html
Copy and unzip the file MyFirstWS file to a folder your create on your computer call it
MyFirstWSProject.
Open Netbeans IDE, then open a project from the folder above and use the file MyFirstWS.
Deploy/Run the project and Test the Web service.
Extend the Web service implementation by adding new methods: Multiplication, and division methods.
Redeploy/Run the project and test the new updated Web service.
Cerate another Web Service under the same project call it TimeWS.
Cerate the corresponding methods: methods that returns the time, date, year, etc.
Redeploy /Run the project and test the new Web service.
Try to extend your project by using other web services you created or those available online.
-
8/3/2019 M. ADEL SERHANI
21/36
4/10/20
Business Processes
No one implements an SOA without a businessjustification.
Flexible business processes are the ultimate goal ofan SOA. (On Demand!)
Business experts define the flow of a process (tasks,exceptions, data flows, and so forth).
Developers then associate the steps in the processwith resources.
Business experts and developers can work togethermuch more closely.
42
-
8/3/2019 M. ADEL SERHANI
22/36
4/10/20
Problem
To achieve a given objective sell my car, I may
need more than one Web Service:
Car Valuation service WS1
Car Auction Service WS2
Online Financial service WS3
All three WS need to interact seamlessly
To achieve my goal
43
Web Services Composition
Composed Web Services are:
Individual components implemented at different places
Execute in different contexts
But, need to communicate to yield desired behavior
Multiple approaches based on perspective:
StaticDynamic WS composition
Synchronous and Asynchronous
Industry solution Semantic Web solution
44
-
8/3/2019 M. ADEL SERHANI
23/36
4/10/20
Composition of Web Services: Synchronous
ClientService
CreditService
InventoryService
PurchaseOrder
InvoiceConsolidate
Results
45
Composition of Web Services: Asynchronous
ClientService
CreditService
InventoryService
PurchaseOrder
InvoiceConsolidate
Results
46
-
8/3/2019 M. ADEL SERHANI
24/36
4/10/20
BPEL
The Business Process Execution Language (BPEL)
defines a business process as a set of tasks.
BPEL is a high-level XML-based language for
stringing Web services calls (and other things)
together.
We can export our business process model as a BPEL
file.
BPEL makes it easy to change the way the process flows.
47
BPEL: Core Concepts
Peer-to-peer synchronous/asynchronous messageexchanges Request-response One way (e.g., notification, reply to callback interface) Sequence vs. parallel flow
Data handling: variables, property definition, dataextraction and assignment
Data-dependent behavior (conditional and timeoutconstructs)
Exception handling and recovery Cross-partner coordination (message correlation) Scope (group a set of activities)
48
-
8/3/2019 M. ADEL SERHANI
25/36
4/10/20
BPEL Example
Business Process Execution Language
Introduction to Web Services Technologies
49
Examples of Web Service composition implementation50
Netbeans SOA Tools, Composite Application, CASA
http://www.youtube.com/watch?v=a76RxkzB4Bg&feature=BF&list=QL&index=2
Oracle BPEL - Hello World Example
http://www.youtube.com/watch?v=XRzTySj-aak
Eclipse Web Service Composition
http://www.youtube.com/watch?v=q2PvBUev0Mk&feature=related
-
8/3/2019 M. ADEL SERHANI
26/36
4/10/20
What is REST?
REST stands for REpresentation State Transfer
A proven architectural style for building loosely-coupled, highly-scalable applications
REST is about accessing resources through a universalinterface
Conceived in 2000 as a doctoral dissertation by RoyFielding (a principal author of HTTP protocol).
NOT a standard You will not see the W3C putting out a REST specification.
You will not see IBM or Microsoft or Sun selling a REST developer's toolkit.
52
-
8/3/2019 M. ADEL SERHANI
27/36
4/10/20
REST defined
Resources are identified by uniform resource
identifiers (URIs)
Resources are manipulated through their
representations
Messages are self-descriptive and stateless
Multiple representations are accepted or sent
Hypertext is the engine of application state
53
REST Characteristics
Client-server
Stateless
Cached
Uniform interface
Layered system
Code on demand: Java script code can be loadedfrom the server to be executed by the browser.
54
-
8/3/2019 M. ADEL SERHANI
28/36
4/10/20
RESTful Implementation
Resources: Web Servers
Representation: Web pages
URI:
Web site address which is uniquely identified
Standard verbs like GET, PUT, POST, DELETE
Guess what?
All functions on the Web has till date been done with the use ofthese standard verbs
These verbs are general enough
State: Stateless interactions, as each hyperlink gets anew representation which changes client state
55
RESTful Architecture State
Resource
Representation
Unique Identification
Client1
Resource
Clientn
Representation
http://www.worldstock.com/MycroSoft/RateToday
RateToday.html
The Representation sent from the Resource transfers the state of the client.
Hence, Representational State Transfer (REST)
56
-
8/3/2019 M. ADEL SERHANI
29/36
4/10/20
RESTful Architecture (Cont.)
State
State is the representation of the values of the properties of a resource
Clients state changes when a representation is received from a resource
Resource
The source of information
All requests to resources must be stateless containing all the information necessary for that request without dependency on
previous requests
Representation
The information received from a source (resource): Can take differentformats
Unique Identification (URI: Uniform Resource Identification) Nouns, which identify what is required (e.g. Patient, Students )
Communication via a standardized interface Standard Verbs, which identify what is the action (e.g. Give, Remove....)
57
RESTful Web Services Every Resource can be identified by a URI
Defined as nouns and NOT verbs
http://UAEU/student/a122233
http://UAEU/students?name=sam
The resources are requested through HTTP Request
The representation is received as HTTP Response
Representation is got through standard interface (HTTP verbs)
GET : Retrieve
PUT : Update
POST : Create
DELETE : Delete
58
-
8/3/2019 M. ADEL SERHANI
30/36
4/10/20
RESTful Web Services
So why should we build Web services using REST?
REST leverages well know internet standards
The necessary infrastructure has already become pervasive
HTTP clients and servers available for all possible platforms
Inexpensive and very low adoption barrier
REST sees HTTP as an application level protocol
HTTPS provides the level of security
URLs provide unique identification and service description
59
SOAP vs. REST
REST web services are:
Lightweight - not a lot of extra xml markup
Human Readable Results
Easy to build - no toolkits required
SOAP also has some advantages:
Easy to consume - sometimes
Rigid - type checking, adheres to a contract
Development tools
60
-
8/3/2019 M. ADEL SERHANI
31/36
4/10/20
SOAP vs. REST
What the experts say
Each has its place
One cannot replace the other
REST is a good choice for exposing data while SOAP for
exposing logic
REST is simpler and can be used for applications on the
Internet while SOAP can be used for enterpriseapplications
61
REST applications The famous Twitter API is all REST.
Yahoo! offer most of their services using REST. Thisincludes Search API,
Maps,
Photos,
Traffic,
... and just about any other.
Amazon.com offer several REST services, e.g., for theirS3 storage solution
Atom is a RESTful alternative to RSS.
62
-
8/3/2019 M. ADEL SERHANI
32/36
4/10/20
RESTful Web Services Challenges
Absence of RESTful Web service Registry to allow:
Service providers to publish information about their services
Clients to look for these services
Absence of service description information (e.g.operation detail and parameters) to allow client tosearch within the service itself.
WADL is emerging but yet not rich enough.
Restful Web services does not adhere to a compositionscheme.
...
63
How to implement my first Restful Web Service using Netbeans
Copy and unzip the file MyFirstRESTWS file to a folder your create on yourcomputer call it MyFirstRESTWSProject.
Open Netbeans IDE.
Open Netbeans IDE, then open a project from the folder above and use the fileMyFirstRESTWS.
Deploy/Run the project and Test the Web service
Extend the Web service implementation by adding new methods: Multiplication,and Division methods.
Redeploy/Run the project and test the new updated Web service.
Cerate another Web Service under the same project call it TimeWS
Cerate the corresponding methods: methods that returns the time, date, year, etc.
Redeploy/Run the project and test the new Web service.
Try to extend your project by using other web services you created or thoseavailable online.
-
8/3/2019 M. ADEL SERHANI
33/36
4/10/20
Web Service Development Platforms
Platforms:
Sun J2EE (Netbeans, Eclipse, etc.)
IBM WebSphere
Microsoft .NET Framework
Oracle SOA Suite (Weblogic, JDeveloper, )
Management Frameworks:
IBM Tivoli (Integrated Service Management Software)
HP OpenView (Service Management Framework)
...
66
-
8/3/2019 M. ADEL SERHANI
34/36
4/10/20
Web Service organizations
Standards organizations: World Wide Web Consortium (W3C) Web Services Interoperability Organization (WS-I) Organization for the Advancement of Structured Information Standards
(OASIS)
Vendors: Microsoft IBM Sun Microsystems
Companies exposing data as Web services: Amazon.com Google
Companies writing Web services for theaviation industry C3D Aero
67
Web Service Tools
SOAP Engine
Apache AXIS
WSDL Editor
WSDL Designer
soapUI
XMLSpy
SOAPAgent
Crispy UDDI4J
Gomba
IBM alphaWorks Web Services Tools
68
-
8/3/2019 M. ADEL SERHANI
35/36
4/10/20
Real World applications
Healthcare
Connect Healthcare Enterprise using SOA
Mobile Web services for Health Monitoring
Habitat Monitoring and Green Building (Sensors + Web
Services)
AC, Light, Door monitoring and control
Marriage of Web services and Sensor Networks
Mobile Web Services
Traffic information
Digital Maps (Google Maps API Web Services)
Attraction services
69
Summary
Web Services provide controlled access to back-endapplications
Minimal devices can still consume web services
SOA drive the new trends in Service/Application Integration
Web Services expand your applications reach.
Web Service composition explore the full potential of WebServices.
Restful Web Service leverages well know internet standards. Restful Web Services A proven style for building loosely-coupled,
highly-scalable applications
Web Services Toolkit eases programming access to WebServices.
70
-
8/3/2019 M. ADEL SERHANI
36/36
4/10/20
References and resources used to develop this Tutorial
Francis Geysermans, IBM Tutorials, Service-oriented Architecture briefing,http://ibm.com/developerworks/offers/techbriefings/presentations/webservices.html
Craig Duncan, How Web Services Work, C3D AERO http://www.c3daero.com/presentations/HowWebServicesWork.ppt
Michael Stollberg and Armin Haller DERI Digital Enterprise Research Institute, Semantic Web Services Tutorial, ICWS2005.
http://javasoa.com/
http://www-01.ibm.com/software/solutions/soa/
http://www.alphaworks.ibm.com/webservices
http://ws.apache.org/
Java Web Serv ices Tutorial For Java Web Services Developer's Pack, v2.0:http://java.sun.com/webservices/docs/2.0/tutorial/doc/
RESTful Web Service Tutorial: http://rest.elkstein.org/2008/02/roa-vs-soa-rest-vs-soap.html
John Cowan, An introduction to building Web Services without tears (without SOAP or WSDL), http://www.ccil.org/~cowan
Web Services Tutorial: http://www.w3schools.com/webservices/
SOAP Tutorial: http://www.w3schools.com/soap/default.asp
Apache SOAP: http://www.ibm.com/developerworks/library/ws-peer2/
Apache SOAP for Java: http://www.soapuser.com/client2.html
BPEL Tutorials: http://soa.netbeans.org/soa/ Examples of Web services from (www.webservicex.net) and from NetBeans (http://netbeans.org/kb/trails/web.html)
Open Source Web Services Tools in Java (http://java-source.net/open-source/web-services-tools)
.
71