0% found this document useful (0 votes)
23 views23 pages

Ch-1 - Web Services Overview

Chapter 1 provides an overview of web services, detailing their architecture, benefits, and comparison with other technologies like RPC and CORBA. It explains key protocols such as SOAP and REST, their respective advantages, and the role of Java APIs like JAX-RPC, JAX-WS, and JAX-RS in building web services. The chapter emphasizes the importance of interoperability, reusability, and loose coupling in service-oriented architecture (SOA).

Uploaded by

dabihaile00
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views23 pages

Ch-1 - Web Services Overview

Chapter 1 provides an overview of web services, detailing their architecture, benefits, and comparison with other technologies like RPC and CORBA. It explains key protocols such as SOAP and REST, their respective advantages, and the role of Java APIs like JAX-RPC, JAX-WS, and JAX-RS in building web services. The chapter emphasizes the importance of interoperability, reusability, and loose coupling in service-oriented architecture (SOA).

Uploaded by

dabihaile00
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Chapter 1: Web Services Overview

Contents:
• Web Service Architecture
• Web Service vs. Other Technologies
• Web service benefits
• Interoperable applications with SOA
o Designing an SOA integration architecture
o Implementing SOAs with web services
• Java standard APIs for web services
o JAX-RPC
o Building SOAP–based services with JAX–WS
o Developing RESTful services with JAX–RS

1
Web Services Overview
• Web services provide a standardized way for applications to communicate over a
network.
• They enable software from different platforms (Windows, Linux, Mac, etc.) and
languages (Java, Python, C#, etc.) to interact with one another through well-defined
protocols.
Key Protocols in Web Services:
i. SOAP (Simple Object Access Protocol): A highly structured protocol that defines a
messaging framework.
• SOAP messages are XML-based, making them platform-independent.
2
Cont’d…
• SOAP uses standards like WSDL (Web Services Description Language) to describe
the service and UDDI (Universal Description, Discovery, and Integration) for
service discovery.
• SOAP is often used in scenarios requiring high security and complex transactions,
such as financial services.
ii. REST (Representational State Transfer): An architectural style that uses standard web
protocols like HTTP to interact with resources.
• RESTful web services rely on HTTP methods (GET, POST, PUT, DELETE) to
perform operations on resources, which can be represented in multiple formats
3
such as JSON, XML, or plain text.
Cont’d…
• REST is often favored for its simplicity, scalability, and flexibility, especially in
web and mobile applications.

4
Web Service Architecture
• The architecture of a web service facilitates interaction between different applications
via standard communication protocols and message formats.
Components of Web Service Architecture:

1. Service Provider: The entity that offers the web service. It hosts the web service and
makes it available over the network. In Java, this could be a server-side application
5
running on an application server like GlassFish or Tomcat.
Cont’d…
• WSDL: An XML-based language that defines the operations, messages, and endpoints
of a web service.
• UDDI: A registry for publishing and discovering web services, enabling businesses to
find and integrate services.
• Binding: The process of linking a web service’s abstract definitions to specific
communication protocols like SOAP or HTTP.

6
Cont’d…

2. Service Requester(Client): The entity (application or system) that consumes the web
service. For example, a mobile app or web app that requests data from a remote service.
3. Service Registry (Optional): A directory where web services are registered so that they
can be discovered by clients.
• This component is often used in large enterprise systems, where services are
dynamically discovered and invoked. The registry typically uses UDDI for SOAP-
based services..

7
Cont’d…

Layers in Web Service Architecture:


• Service Layer: Contains the business logic exposed by the web service. For instance, it
could offer services like "Order Processing" or "Payment Processing“
• Message Layer: Handles the messaging formats and protocols (SOAP/XML, JSON
over HTTP).
• Transport Layer: Manages communication between the service requester and service
provider, usually through HTTP/HTTPS, but could also include other protocols like
SMTP, FTP, etc.

8
Web Services vs. Other Technologies

Web services have several unique advantages over traditional distributed computing
models like RPC, CORBA, and EJB.
• Web Services vs. RPC (Remote Procedure Call):
• RPC: Typically language-dependent. It involves a client calling a procedure (or
function) on a remote server.
• This model is tightly coupled and may require both the client and server to use the
same programming language.
• Web Services: More loosely coupled. They enable clients and servers to be
implemented in different languages and platforms, communicating through
9
standardized protocols like HTTP and data formats like XML or JSON.
Cont’d…
• Web Services vs. CORBA (Common Object Request Broker Architecture):
• CORBA: A legacy technology used for integrating distributed systems.
• It is complex, requires a steep learning curve, and has tight coupling between
systems.
• Web Services: Simpler and easier to use.
• They use lightweight and widely understood protocols like HTTP and are more
loosely coupled, allowing for greater flexibility and scalability.

10
Cont’d…
• Web Services vs. EJB (Enterprise JavaBeans):
• EJB: Java-specific, typically used within the context of Java EE applications.
• EJBs are tightly integrated with other Java components and require a Java-
based application server.
• Web Services: Platform-independent.
• Web services can be implemented in any language and communicate with non-
Java clients.

11
Web Service Benefits

Key Benefits of Web Services:


• Interoperability: Web services allow different applications to talk to each other, even
if they are developed in different programming languages or running on different
operating systems.
• Reusability: Web services can be reused in various applications. For instance, a web
service that provides weather data can be consumed by different mobile apps, websites,
or desktop applications.
• Loose Coupling: Systems interact through well-defined interfaces. Each service is
self-contained and can be modified independently without affecting the overall system,
12
which improves flexibility.
Cont’d…
• Scalability: Web services can easily scale to accommodate increasing numbers of
users or higher transaction volumes. For example, a RESTful API can scale
horizontally by distributing the load across multiple servers.
• Availability: Web services can be accessed over the internet from any location,
making them ideal for distributed systems. A service can be consumed by clients
across geographical locations.

13
Interoperable Applications with SOA
• SOA (Service-Oriented Architecture) is a design pattern where software components
(services) are made available to other components over a network.
Designing an SOA Integration Architecture:
• In SOA, each service performs a specific business function and is loosely coupled,
meaning it can be reused in multiple applications.
• Services in an SOA architecture communicate over standardized protocols (often
HTTP/HTTPS) and use well-defined interfaces like WSDL (for SOAP) or a URI (for
REST).

14
Cont’d…

Key principles in designing SOA:


• Loose Coupling: Services should be independent of each other.
• Reusability: Services should be designed to be reusable across different contexts.
• Discoverability: Services should be discoverable via a registry or endpoint.

15
Cont’d…

Implementing SOAs with Web Services:


• Web services are one of the most common implementations of SOA because they are
standardized, interoperable, and platform-agnostic.
• SOAP-based web services are widely used in SOA implementations for secure,
transactional business processes.
• RESTful web services are commonly used in SOA for lightweight, stateless, and
simple interactions between services.

16
Java Standard APIs for Web Services

Java provides APIs to help build both SOAP-based and RESTful web services.
• JAX-RPC (Java API for XML-Based RPC): allows Java applications to invoke remote
procedures over the internet using XML-based messages.
• It supports both synchronous and asynchronous communication.
• Use Case: It was primarily used to build SOAP-based web services where the server
exposes a WSDL file, and the client can generate a proxy to call remote methods.
• However, it is mostly outdated and replaced by JAX-WS.

17
Cont’d…
• JAX-WS (Java API for XML Web Services): it is the modern API for building SOAP-
based web services.
• It simplifies the development of web services by using annotations such as
@WebService and @WebMethod.
• It supports asynchronous processing, allowing services to return responses to
clients at a later time.
• WSDL Generation: JAX-WS automatically generates WSDL for the services. It
provides a binding mechanism between the WSDL and Java code, allowing Java
objects to be easily converted to XML and vice versa.
18
Cont’d…

Example:

@WebService
public class MyWebService {
@WebMethod
public String sayHello(String name) {
return "Hello " + name;
}
}

19
Cont’d…
• JAX-RS (Java API for RESTful Web Services):
• JAX-RS is the standard API for building RESTful services in Java. It leverages
annotations such as @Path, @GET, @POST, etc., to map HTTP requests to Java
methods. Example:

@Path("/hello")
public class HelloResource {
@GET

@Produces(MediaType.TEXT_PLAIN)
public String sayHello() {
return "Hello, World!";
} 20
Cont’d…
• HTTP Methods: RESTful services expose resources that can be manipulated using
HTTP methods (GET to retrieve, POST to create, PUT to update, DELETE to
remove resources).
• Data Format: While XML is supported, JSON is more common in RESTful web
services, especially for modern web and mobile apps due to its lightweight nature.

21
SOAP vs. REST - A Detailed Comparison
Aspect SOAP REST
REST is an
SOAP is a protocol that
Protocol architectural style,
defines messaging rules.
not a protocol.
Message Uses XML for message Can use JSON, XML, or
Format exchange. other formats.
Stateless, meaning
State Stateful or stateless. each request is
independent.
Typically HTTP but can use Uses only
Transport
others (SMTP, JMS). HTTP/HTTPS.
Built-in standards like WS-
Relies on HTTPS and
Security Security for secure
OAuth for security.22
transactions.
THE END!!
23

You might also like