Lesson 11 - SOA and Web Services
Lesson 11 - SOA and Web Services
The software evolution has distinct phases. These layers are built up one by one over many years.
Software evolution begins with understanding the concept of 1 and 0 (bits) that gives rise to
machine language. This is followed by assembly, procedure oriented, object oriented, component
oriented, and service oriented languages.
Structured
Oriented/Procedure Object Component Service
Oriented Oriented Oriented Oriented
https://www.researchgate.net/publication/215571061
Phases of Software Evolution
STRUCTURE ORIENTED/PROCEDURE ORIENTED
Structure A procedural language is a type of computer programming language that specifies a series of
Oriented/Procedure
well-structured steps and procedures within its programming context to compose a program.
Oriented
It contains a systematic order of statements, functions, and commands to complete a
Object
computational task or program.
Oriented
Component
Oriented
Service
Oriented
Phases of Software Evolution
STRUCTURED ORIENTED/PROCEDURE ORIENTED LANGUAGE: LIMITATIONS
Structured
Oriented/Procedure • Structure/procedure oriented language is unable to model real world problems.
Oriented
• It uses global data concept and is thus accessed by all the functions.
Object
Oriented • It is difficult to maintain because the line of code is high.
Component
Oriented
Service
Oriented
Phases of Software Evolution
OBJECT ORIENTED
Structured
Oriented/Procedure It refers to a type of computer programming (software design) in which the
Oriented programmers define the data type of a data structure and the types of operations (functions)
that can be applied to the data structure.
Object
Oriented
Component
Oriented
Service
Oriented
Phases of Software Evolution
OBJECT ORIENTED: LIMITATIONS
Structured Although it offers better implementation, data security, code reusability, and flexibility, It is
Oriented/Procedure
difficult to manage complex applications.
Oriented
Object
Oriented
Component
Oriented
Service
Oriented
Phases of Software Evolution
COMPONENT ORIENTED
Component
Oriented
Service
Oriented
Phases of Software Evolution
COMPONENT ORIENTED: LIMITATIONS
Structured
Component development is a complex task and comes with the following limitations:
Oriented/Procedure
Oriented
• Component maintenance costs
Object
• Reliability and sensitivity to changes
Oriented
• Unsatisfied requirements
Component
Oriented
Service
Oriented
Phases of Software Evolution
SERVICE ORIENTED
Structured Web Services are self-describing services that will perform well-defined tasks and can be accessed
Oriented/Procedure through the Web.
Oriented
Service Oriented approach follows an architecture, called SOA (Service Oriented Architecture), that
Object focuses on building systems through the use of different Web Services and integrating them to
Oriented make up the whole system.
Component
Oriented
Service
Oriented
What is SOA?
AN ARCHITECTURAL SOLUTION
SOA is the architectural solution for integrating diverse systems by providing an architectural style that
promotes loose coupling reuse.
It is a programming model or paradigm where web service and contracts becomes a dominant design for
interoperability
SOA Architecture
Processes
Discovery, Aggregation, Choreography…
Messages
Management
Security
SOAP Extensions
Reliability, Correlation, Transactions….
SOAP
Communications
HTTP, SMTP, FTP, JMS, IIOP
What Is SOA?
A COLLECTION OF SERVICES
The following diagram shows how an Online Shopping website selling gadgets is involved with different
services like Ordering, Tracking, and Checkout to give service to its customers.
Ordering
Service
Tracking
Service
Customers
Online shopping website Checkout
selling gadget Service
What Is SOA?
ESTABLISHING COMMUNICATION
SOA
Service Consumer Service Provider
SOA is a solution for making
two software communicate to
each other
Advantages of SOA
Business
Enterprise Service Bus Process
Software Development Modeling
Workflow Presentation Service
Adapter Programming Tools
Engine App Servers SOA
In House Portal Services
DBMS Repository
apps Device Services
Modelling Tools
Messaging Services
SOA Testing Tools
Registry SOA App
Adapter
Testing
Packaged
Data Service
apps Service
Broker Data Federation SOA
ETL and Metadata
Data Archiving Governance
Adapter Infrastructure Service
Other SOA
Supervisor Message management
apps System management
Security management
Provisioning
Identity and Authentication
SOA Service Description
Directory
Service
Description
Service Service
Consumer Provider
Directory
Service
Description
Service Service
Consumer Provider
Implementation
Service Consumer Service Provider Web Service
Web Service is an
implementation of
SOA
SOA and Web Services
Topic 2—Web Services
1. Web applications enable interaction between an end user and a website. Web services are service-
oriented and enable application-to-application communication over the Internet and easy
accessibility to heterogeneous applications and devices.
2. Web services can be invoked through XML-based RPC mechanisms across firewalls.
4. Web services facilitate ease of application integration using a lightweight infrastructure without
affecting scalability.
• According to Gartner research (June 15, 2001), “Web services are loosely coupled software
components delivered over Internet standard technologies.”
• Web services are self-describing and modular business applications that expose the business logic as
services over the Internet. This is done through programmable interfaces and Internet protocols to
provide ways to find, subscribe, and invoke those services.
Web Services Operational Model
Web Service operational model can be conceptualized as a simple operational model that has a lot in
common with a standard communication model:
Service
Broker
Service Service
Requestor Provider
Invoke Service
Operations are conceived as involving three distinct roles and relationships that define the Web
Services provider and users.
Web Services: Example
1. A Travel service provider deploys its Web services by exposing the business applications obtained from
different travel businesses like airlines, car-rental, hotel accommodation, credit card payment, and so forth.
2. The service provider registers its business services with descriptions using a public or private registry. The
registry stores the information about the services exposed by the service provider.
3. The customer discovers the Web services using a search engine or by locating it directly from the registry
and then invokes the Web services to perform travel reservations and other functions over the Internet
using any platform or device.
4. In the case of large-scale organizations, the business applications consume these Web services to provide
travel services to their own employees through the corporate intranet.
Web Services: Example
Find Register
Services Services Rental car
Desktop Reservation
System
Invoke Services
Hotel
Service Requestor Travel Reservation Reservation
PDA
Services Provider System
Map and
Weather
Automobile Information
System
Credit card
Organization Payment
System
Types of Web Services
These technologies are interoperable at a core level as they use XML as data
Extensible representation layer for all web service protocols and technologies that are created
Markup
Language (XML) Process 1 Process 2
Universal
Description,
Discovery and
Integration
(UDDI)
XML Generator/ XML Generator/
Web Services Interpreter Interpreter
Description
Language (WSDL)
Simple Object
Access Protocol
(SOAP)
Communication Communication
Manager Manager
Types of Web Services
WEB SERVICES WITH XML
Extensible
Directory
Markup
Language (XML)
Service
Universal Description
Description,
Discovery and
Integration
(UDDI)
Web Services
Description XML
Service Service
Language (WSDL) Consumer Provider
Consumer formulates its message to
Simple Object the provider using tag-based
Access Protocol language called XML.
(SOAP)
Types of Web Services
UNIVERSAL DESCRIPTION, DISCOVERY AND INTEGRATION (UDDI)
UDDI provides a world-wide registry of web services for advertisements, discovery, and
Extensible integration purposes.
Markup
Language (XML) UDDI could be dynamic or static; Business Analysts and technologists could use UDDI to
search for available web services.
Universal
Description,
The UDDI Business Registry provides a place for a company to programmatically describe its
Discovery and
services and business processes and its preferred methods for conducting business.
Integration
(UDDI)
Web Services The directory is implicit
Web Services in web services
Description
Language (WSDL)
Simple Object
Access Protocol Any service producer
(SOAP) can also be a service
Service provider. So, the label Service
is changed to “Service”
Types of Web Services
WEB SERVICES DESCRIPTION LANGUAGE (WSDL)
Extensible WSDL describes the interface of the Web Service. It is comparable to the concept of “Remote
Markup Interface” of Java RMI or the “Interface Definition Language File (IDL)” of RPC.
Language (XML)
It standardizes how a web service represents the input and output parameters of an
Universal invocation externally, that is, the function structure, the nature of invocation (in, in/out,etc),
Description, and the service protocol binding.
Discovery and
Integration
(UDDI)
Web Services
Description
Language (WSDL)
Simple Object
Access Protocol
(SOAP)
Types of Web Services
WEB SERVICES WITH WSDL
Extensible
Markup WSDL Directory
Language (XML)
Universal Service
Description, Description
Discovery and
Integration Service description is written in a
(UDDI) special language called web service
Web Services description language (WSDL)
Description
Language (WSDL) Service Service
Simple Object Consumer Provider
Access Protocol
(SOAP)
Types of Web Services
USE OF WSDL
Extensible 2
Markup Directory
Directory
Language (XML)
Service queries
Query
Universal description response
Description, using WSDL
SOAP Messages using
Discovery and
1 WSDL
Integration
3
(UDDI)
4
Web Services XML service request based on WSDL
Description Service Service
Language (WSDL) Provider Consumer
Simple Object XML service response based on WSDL
Access Protocol
(SOAP) 5
Types of Web Services
SIMPLE OBJECT ACCESS PROTOCOL (SOAP)
Extensible SOAP is a simple XML-based protocol to let applications exchange information over HTTP.
Markup
Language (XML) It is a protocol for accessing a Web Service.
Universal
Description,
Discovery and
Integration
(UDDI)
Web Services
Description
Language (WSDL)
Simple Object
Access Protocol
(SOAP)
Types of Web Services
WHY USE SIMPLE OBJECT ACCESS PROTOCOL (SOAP)?
SOAP envelope
Extensible
Markup
Language (XML) Header
Universal
Description,
Discovery and Body
Integration
(UDDI) WSDL
Web Services
Description XML or other format
Language (WSDL)
Simple Object
Access Protocol
(SOAP)
HTTP or other protocol
Types of Web Services
WEB SERVICES WITH SOAP
Extensible
Markup WSDL Directory
Language (XML)
Universal Service
Description, Description Messages are sent
Discovery and and received in a
Integration SOAP SOAP directory through
(UDDI) SOAP language
Web Services
Description
Language (WSDL) Service Service
Simple Object Consumer Provider
Access Protocol
(SOAP)
Types of Web Services
SOAP ELEMENTS
Universal
Description,
Discovery and
Integration
(UDDI)
Web Services
Description
Language (WSDL)
Simple Object
Access Protocol
(SOAP)
Extensible • The optional SOAP Header element contains application-specific information (like
Markup authentication, payment, etc.) about the SOAP message.
Language (XML)
• If the Header element is present, it must be the first child element of the Envelope
Universal element.
Description,
Discovery and
Integration
(UDDI)
Web Services
Description
Language (WSDL)
Simple Object
Access Protocol All immediate child elements of the Header element must be namespace-
(SOAP) qualified.
Extensible • The required SOAP Body element contains the actual SOAP message intended for the
Markup ultimate endpoint of the message.
Language (XML)
• Immediate child elements of the SOAP Body element may be namespace-qualified.
Universal
Description, • This is the SOAP Fault element used to indicate error messages.
Discovery and
Integration
(UDDI)
Web Services
Description
Language (WSDL)
Simple Object
Access Protocol
(SOAP)
There are two main APIs defined by Java for developing web service applications (since Java EE 6):
• Axis
• Web Service in an Axis Environment
• Creating a SOAP based Web Service
Axis
Axis facilitates easy deployment and undeployment of services using XML-based Web services deployment
descriptors (WSDDs).
• It enables deploying and undeploying services and also Axis-specific resources like handlers and chains
using an administration utility ‘AdminClient’ provided as part of the Axis toolkit.
• It helps deploy a service, ensures that the AXIS CLASSPATH is set, and runs the following command:
• It helps undeploy a service, ensures that the AXIS CLASSPATH is set, and then runs the following command:
To create a Web service in an Axis environment, the following Models are used:
5. Click next
In service implementation text box, write the qualified class name of created class (HelloWorld.java),
move both above slider to maximum level (Test service and Test Client level), and click finish. You are
done. A new project named “SimpleSOAPExampleClient” will be created in your work space.
7. After clicking start server, eclipse will open test web service API. With this test API, you can test your
web service
Creating a SOAP based Web Service
STEP 1: Create a new dynamic web project and name it “SimpleSOAPExample”
Create a new dynamic
web project and name
it
“SimpleSOAPExample”’
Click next
Click next
Click next
Click next
Click next
Click next
RESTful web services are lightweight, highly scalable, and maintainable Web Services. They are basically
based on REST (Representational State Transfer) Architecture.
• A RESTful web service usually defines a URI (Uniform Resource Identifier), which is a service that provides
resource representation such as JSON and a set of HTTP Methods.
• There is no need to use XML data interchange format for request and response.
• The REST web services can be return XML, JSON, or even HTML format response.
Smartphone
Creating a RESTful Web Service
FUNCTIONALITIES
Create a web service called UserLog Management with the following functionalities:
4. Download the latest version of Jersey framework binaries from the following link:
https://jersey.java.net/download.html
4. Create a Web XML Configuration file to specify Jersey framework servlet for your application.
5. Export your application as a war file and deploy the same in tomcat.
Creating a RESTful Web Service
Writing User.Java class
Class User has id, name, and designation member variable, and it uses @XmlRootElement and
@XmlElement annotations.
It uses two methods to get user details. First, it checks for the file name User.dat. It it does not exist, it
adds one user data to UserList. It then opens User's file and reads data.
web-app>
<servlet>
<servlet-name>Jersey RESTful Application</servlet-name>
<servlet-
class>org.glassfish.jersey.servlet.ServletContainer</servletclass>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.tutorialspoint</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Jersey RESTful Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
SOAP RESTful
The main advantage of SOAP is that it provides a
In RESTful Web Services, clients have to know what to
mechanism for services to describe themselves to
send and what to expect.
clients and to advertise their existence.
SOAP brings its own protocol and focuses on
REST is focused on accessing named resources
exposing pieces of application logic (not data) as
through a single consistent interface.
services.
REST has better performance and scalability. REST
SOAP-based reads cannot be cached.
reads can be cached,
SOAP only permits XML. REST permits many different data formats
SOA and Web Services
DEMO—RESTful Web Services
Key Takeaways
Web applications enable interaction between an end user and a website. Web
services are service-oriented and enable application-to-application
communication over the Internet and easy accessibility to heterogeneous
applications and devices.
RESTful web services are lightweight, highly scalable, and maintainable Web
Services. They are basically based on REST (Representational State Transfer)
Architecture.
Quiz
QUIZ
UDDI stands for
1
b. WSDL definition describes how a web service can be accessed and what operations it
can perform
b. WSDL definition describes how a web service can be accessed and what operations it
can perform