SOA Unit-II
SOA Unit-II
Permanent services are designed to provide long-term, stable, and reusable functionality
within an organization. They are typically core to the business operations and are expected to
be available indefinitely.
Characteristics of Permanent Services:
1. Long Lifespan:
o These services are intended to be long-lasting and are expected to be maintained
and updated over time.
2. Business-Critical:
o Permanent services often support essential business functions and processes that
are critical to the organization’s operations.
3. Rigorous Development:
o They go through thorough development, testing, and quality assurance processes
to ensure reliability and robustness.
4. High Reusability:
o These services are designed with reusability in mind, making them applicable
across different projects and business units.
5. Strict Governance:
o Governance, management, and monitoring of permanent services are usually
more comprehensive, ensuring compliance with organizational standards and
policies.
Examples of Permanent Services:
• Customer Management Services: Services that handle customer data, interactions, and
relationship management.
• Inventory Management Services: Services that manage inventory levels, orders, and
supply chain logistics.
• Payment Processing Services: Services that facilitate transactions and payment
processing across various business channels.
A temporary classification or service is defined based on roles, with a runtime of messages. A
permanent classification or service is defined based on application resources while also
providing service roles and service models, which can lead to solutions.
b) Service roles:
In SOA context, serve as the foundation for all web services, each of which maintains
distinct roles. However, services can be categorized based on their functions or the value they
provide.
• There are different kinds of service roles: initiator, relier, and recipient, which are
dependent on massagers.
• All service roles are not labelled client-server.
• A software environment with potential roles and responsibilities in service scenarios
influences all service roles.
• A service role functions as a service provider, capable of invoking various web services.
• Web services form the basis of a service role that has the ability to disseminate service
descriptions, complete with boundaries and future plans.
• A recipient receives the message, represents itself as a service provider, and functions as
a web service.
c) Service models:
When services are used to lead the classification of application logic, they provide business
solution tasks and are referred to as a service model.
Figure: Service composition consisting one master controller, one sub-Controller, four business
services and one utility service.
➢ Utility Service Model:
1. The utility model of web service design follows service agents, and potentially reuses
services.
2. This model enables all the characteristics of services
3. This model promotes intrinsic interoperability services.
4. This model possesses the maximum level of autonomy.
1. This model consists composition of services that execute and support various business
tasks.
2. This model also represents the implementation composition.
3. This model illustrates the potential for leveraging reuseable opportunities and possesses
the minimum degree of autonomy.
The categories of services are explained using an Order Service system as below:
Entity Services: This service handles services like Purchase order, order date, insurance
policy, create customer service, create product services. Service provider is an entity connects
with different organizational agilities.
Eg:- Create customer{ }, Get history{}, Get profile{}, Delete profile{}, Update profile{},
Update customer{}.
Task services: Services with various tasks which are dealing with multiple entities (more than
1 entity). Tasks like Customer purchase, creating purchase order number, validating customer
details.
Utility services [Reusable services]: These services belong to Technology oriented services to
build larger and higher-level services. Event logging, notifications to other domains etc.,
Eg., Send SMS{}, sene email{}.
Proxy:- Connection between members of system and service oriented and conflict subsystem.
Process:- This service creates application oriented services to implement business processes.
Acts as an interpreter between application and service.
Device:- Device service doesn’t include the API which is not well suited with service oriented
system. For example, a proxy server referred as network device to communicate between other
services.
Service Descriptions:
a. A service description can fall into one of the following two categories:
o Abstract Description
o Concrete Description
▪ Port-type
▪ message
▪ Operation
A port type is defined as sorting different kinds of messages based on services. A service is
always divided into functions, and then it is referred to as an operation.
4. The abstract interface always provides a concrete description, which connects technologies
through physical transmission. A concrete description can be described in three ways:
There is always a need for communication between technology and services. A model-based
system must describe a service in terms of both temporary and permanent classification.
Service Discovery
Service discovery is the process of locating and selecting appropriate services based on
consumer requirements. It involves searching for service descriptions in a service registry and
matching them with the consumer's needs.
Key aspects of service discovery:
• Search criteria: The parameters used to find suitable services (e.g., service name,
function, QoS).
• Discovery mechanism: The method used to search for services (e.g., UDDI, WS-
Discovery).
• Binding: Establishing a connection between the consumer and the selected service.
Application in SOA
In the context of SOA, both public and private registries can play a role:
• Service metadata: A private registry can store service descriptions, while a public
registry can be used for sharing common service interfaces.
• Service components: A private registry can store reusable components, while a public
registry can be used for acquiring third-party components.
• Artifacts: Both public and private registries can be used to store various artifacts like
libraries, configuration files, and deployment scripts.
A Universal Discover Describe Integration (UDDI) is a part of the registry that tracks all
services. A registry must be manually checked, and it searches for the for the new
programmatically standardized Application Programming Interface (API). All service registries
locate all centralized services that receive the solution of services and candidate services. A
public registry defines and accepts any organization that registers services and acts as a service
provider. A private registry establishes its acceptance within the services organization by
defining the boundaries for service development, leasing, and purchase. By effectively utilizing
both public and private registries, organizations can balance the benefits of collaboration and
innovation with the need for security and control.
Business Entities and Business Services:
Business Entities
In the context of SOA, business entities represent the core data objects within an organization.
They are the fundamental building blocks of the business domain and encapsulate information
essential to the business operations.
• Examples of business entities: Customer, Product, Order, Account, Employee.
• Characteristics:
o Represent real-world concepts.
o Have attributes and relationships with other entities.
o Are relatively stable over time.
Business Services
Business services are the operational units that encapsulate business logic and provide specific
functions to interact with business entities. They expose the capabilities of the business to
other systems or applications.
• Examples of business services: Customer management, order processing, product
catalogue, account inquiry.
• Characteristics:
o Provide a well-defined interface.
o Are loosely coupled to other services.
o Can be composed of multiple services.
o Often align with business processes.
All Public registries will track the record of organization and it acts as business entity and
it also provides profile information of an organization. All Business services may or may
not related as Web Services. A Business Entity is also a part of binding template, it defines
as registries must follow the logics to binding the information of services. Then it is called
Binding Template. All Register services must provide the pointer of services description
based on Web Services then it is called t model. Where t stands for template.
Relationship Between Business Entities and Business Services
• Business entities are the data foundation for business services.
• Business services manipulate and process business entities to fulfil specific business
requirements.
• A business service can operate on multiple business entities.
• A business entity can be accessed by multiple business services.
Example:- Online retail system:
• Business entities: Customer, Product, Order, Address.
• Business services:
o Customer management (create, update, delete customers)
o Product catalog (search, view product details)
o Order processing (place order, process payment, ship order)
Key Points
• Business entities and business services are fundamental concepts in SOA.
• Clear identification of business entities is crucial for designing effective business
services.
• Well-defined business services enhance reusability and agility.
Messaging:
Messaging is the cornerstone of communication in a Service-Oriented Architecture (SOA). It's
the mechanism through which services interact and exchange data.
o A message defines communication.
o A message is also a communication service with relevant formats and transport
protocols.
o A SOAP is a component of messaging that standardizes services through a transport
mechanism. Hence, all messages are processed by web services.
o A SOAP also describes the message's structure and how it moved from one node to
another. A SOAP also provides a nodal network between messages and services.
o SOAP stands for Simple Object Access, which can define all message formats.
o A SOAP-based structure can be categorized into three categories:
● Envelope
● Body
● Header
o An envelope in SOAP structure and its components also represent a metaphor. It is also
housing for all parts of the message.
o A body is also a part of the SOAP structure; all message formats must be discovered in
XML format. All XML formats define the actual content of messages. Hence, it is
called Message Payload.
o The header is another component of SOAP. All messages are allocated blocks. Hence, it
is a physical unit of communication for internal and external messages.
Messaging Technologies
• JMS (Java Message Service): A Java API for message-oriented middleware.
Example: Order Processing in SOA: In an order processing system, messaging can be used
to:
• Order placement: Customer places an order (request-reply).
• Inventory check: Order service sends a message to inventory service to check
availability (request-reply).
• Payment processing: Order service sends a message to payment service (request-
reply).
• Order confirmation: Order service sends a confirmation message to the customer
(fire-and-forget).
Atomic transactions typically adhere to the ACID properties, which ensure reliable transaction
processing:
• Atomicity: Ensures that all parts of the transaction are treated as a single, indivisible
operation. If any part fails, the entire transaction fails, and the system is left
unchanged.
• Consistency: Ensures that a transaction brings the system from one valid state to
another, maintaining all defined rules and constraints.
• Isolation: Ensures that transactions are executed independently of each other.
Intermediate states of a transaction are not visible to other transactions, preventing
interference.
• Durability: Ensures that once a transaction is committed, its results are permanent,
even in the case of a system failure.
2. Two-Phase Commit Protocol (2PC)
The Two-Phase Commit Protocol is a common mechanism for achieving atomic transactions
in distributed systems. It consists of two phases:
• Phase 1: Prepare: The coordinator sends a prepare message to all participating
services, asking them to confirm if they are ready to commit the transaction. Each
participant responds with a vote (yes or no).
• Phase 2: Commit/Rollback: If all participants vote yes, the coordinator sends a
commit message, and the transaction is finalized. If any participant votes no, the
coordinator sends a rollback message, and all participants undo any changes.
3. Transaction Coordinator
A transaction coordinator is a component that manages the coordination of the transaction,
ensuring that all participants agree on the outcome. It handles the communication between
services and manages the commit or rollback process.
4. Compensating Transactions
In some scenarios, it may not be possible to use strict atomic transactions due to the
distributed nature of services or the need for long-running processes. In such cases,
compensating transactions are used as a fallback mechanism. A compensating transaction is
an operation that reverses the effects of a previously completed transaction, essentially
"undoing" the transaction if something goes wrong later.
5. Distributed Transaction Management
In a distributed SOA environment, transactions often span multiple services and databases.
Managing distributed transactions requires careful handling of network latency, partial
failures, and resource locking. Middleware solutions, such as Enterprise Service Buses (ESBs)
or distributed transaction coordinators, can help manage these complexities.
6. Challenges
• Network Latency and Failures: Ensuring that all participants are synchronized and
agree on the transaction outcome can be challenging due to network issues.
• Scalability: The more participants in a transaction, the more complex and resource-
intensive the coordination becomes.
• Consistency Models: Different systems may have different consistency requirements,
making it challenging to enforce ACID properties universally.
7. Use Cases
• Financial Transactions: Ensuring that funds are transferred accurately between
accounts.
• Order Processing: Guaranteeing that inventory updates, payment processing, and
order confirmations are consistent.
• Data Synchronization: Keeping data consistent across multiple systems and services.
------------------------------------------------------------------------------------