8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 1/44
COMP206
Architecture Guidelines for
Composite Applications
Volker Stiehl, SAP NetWeaver Product Management Composition
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 2/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 2
Disclaimer
This presentation outlines our general product direction and should not be
relied on in making a purchase decision. This presentation is not subject to
your license agreement or any other agreement with SAP. SAP has no
obligation to pursue any course of business outlined in this presentation or to
develop or release any functionality mentioned in this presentation. This
presentation and SAP's strategy and possible future developments are
subject to change and may be changed by SAP at any time for any reasonwithout notice. This document is provided without a warranty of any kind,
either express or implied, including but not limited to, the implied warranties
of merchantability, fitness for a particular purpose, or non-infringement. SAP
assumes no responsibility for errors or omissions in this document, except if
such damages were caused by SAP intentionally or grossly negligent.
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 3/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 3
Goal
Composite Applications require a change inthinking from an architect‘s as well as from adeveloper‘s point of view.
Learn how to successfully architect a compositeapplication and apply the principles to your ownprojects!
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 4/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 4
1. Anatomy of composite applications
2. Patterns for the service design
3. Patterns for the service composition and business object layer
4. Patterns for the UI layer
5. Patterns for the process layer
6. Summary
Agenda
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 5/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 5
Definition of a Composite Application
Wikipedia: A Composite Application is an application built by
combining multiple existing functions into a new application.
Extended Definition: Composite Applications are user centric applications supporting highly collaborative and dynamic
business processes which span beyond functional, system,
and organizational boundaries by using data and functions
provided as services by platforms and applications.
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 6/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 6
Anatomy of Composite Applications
Business Objects
Local Remote
C O
M P O S I T E A P P L I C A T I O
N
CRM BW ERP Systems B A C K E N D
Workcenter
Composite Process
Role 1 Role 2
Step 1 Step 2 Step 3 Step 4
Service EnablementServices Services Services
Enterprise Service Bus
(optional)
Remote
Services
Local
Services
Business Objects,
Services
UI UI UI User Interfaces
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 7/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 7
Example: Investment Approval Process
PurchaseRequester
• Enter requirements
External ITProvider
• Derive product from requirements,create purchase request
Business
rule
• Derive necessity for approval based oninvestment volume and country
• Ensure company policies
Purchase Approver
• Review order, approve or reject and incase of rejection add reason andpropose acceptable solution
PurchaseRequester
• Update purchase order or terminateprocess
CorporatePurchasing
• Create PO in ERP including supplierintegration
TrackChanges
• Fulfill compliance requirements
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 8/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 8
Artifacts of a Composite Application
Storage
Local Persistency
History Data
Business
Object
History DataMaterial
Roles
Purchase Requester Purchase Approver
Process
UI
Interface
Enter Purchase
Request
Review Manager
Decision
View Purchase
Order Confirmation
Approve Purchase
Request
Service
Read Material
Details Approval
Needed
Service
Save Change
History
Create
Purchase
Order Find Material
System
SCMERP
Primary Secondary
Corporate Purchaser
Purchase
RequestPurchase Order
Investment Approval
Process
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 9/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 9
Composite Application Design Patterns
Composite Application Design Patterns
Describe a typical problem, which regularly occurs in composite applicationdesign
Describes Best Practices on solving that problem, mostly aiming at
Consistency
Completeness
Pragmatics while keeping appropriate architecture
Design Patterns consist of
Name (Catch Phrase, e.g. Backend Abstraction Layer)
Problem Description
Solution Description
Consequences (Trade offs, use with other patterns…)
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 10/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 10
1. Anatomy of composite applications
2. Patterns for the service design
3. Patterns for the service composition and business object layer
4. Patterns for the UI layer
5. Patterns for the process layer
6. Summary
Agenda
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 11/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 11
Global Data Types I
Problem description Arbitrary definition of data types may cause
inconsistencies/redundancies for same business
semantics
unnecessary data mapping overhead
missing coverage of business semantics
Automatic web service generation based on existing artifacts
may not leverage type system capabilities (e.g. Java™
technology vs. XSD)
may cause namespace and packaging problems
are dependent on the quality of those ‗legacy‘ artifacts
may not comply with industry standards
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 12/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 12
Global Data Types II
Solution description
Maintain a (company-) global repository of data types for your services
interfaces.
Compose your data types from core data types defined in the international
standards ISO 15000-5 and UN/CEFACT CCTS
(http://xml.coverpages.org/ni2007-04-20-a.html)
Provide tools for developers and non-developers to design and discover globaldata types
Consequences
Need for a governance process
Need for naming conventions and design documents
The repository can be extended for services and reusable UI components
based on Global Data Types
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 13/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 13
Compensation Service I
Problem description
Enterprise Services are mostly stateless and atomic Stateless: no state is kept at service provider
(‗Backend‘) between service calls Implication: no pessimistic locking of data inBackend
Atomic: each service updating the databasedoes its own commit
No generic support for distributed ACID transactionsbetween a composite and its backends
Rollback of preceding successful calls is notpossible.
Solution description
Provide a compensation service for each modifying-service operation (e.g. create reservation cancelreservation)
Success
Success
Success
Failure
Failure
Failure
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 14/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 14
Compensation Service II
Consequences A compensation service for modifying-services may be difficult to implement or
impossible.
Service calls can trigger other business related activities, that are hard or
expensive to stop (e.g. purchase order triggers supplier involvement)
Consider also using the ‗Check Service Pattern‘
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 15/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 15
Check Service I
Problem description (Similar to Compensation Service)Enterprise Services are stateless and atomic
There is no generic support for distributed ACID transactions between a
composite and its backends
If one modifying service in a sequence of modifying service call fails, there is
no rollback possibility
Solution description
Implement a check service for each modifying service
Call it like a prepare commit in distributed transactions, i.e. as data validation
step directly preceding the modifying service (e.g. create reservation check
availability)
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 16/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 16
Check Service II
Consequences
Successful call of check service does not guarantee that the subsequent
modifying service will also succeed.
Typically used in combination with ‗Compensation Service‗ Pattern reduce
probability that compensation call will be needed.
Process
ContextParameters
Step 1
UI
Service Service
Check Update
Step 2
Error handling
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 17/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 17
1. Anatomy of composite applications
2. Patterns for the service design
3. Patterns for the service composition and business object layer
4. Patterns for the UI layer
5. Patterns for the process layer
6. Summary
Agenda
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 18/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 18
Service Adaptation I
Problem description
Enterprise Services design is business driven, not consumer tools driven
Existing services are often too complex or not fitting the need of the
consumer in a composite application (e.g. UI, process)
Typical adaptations required
Projection of types (discarding parts by defaulting or completely omitting
them)
‗Flattening‘ nested types
filtering/sorting/truncating collections
Type ‚casts‗ (e.g. ISO 8601 timestamp to java.util.Date)
Service chaining Pass results of service A to subsequent service B
Merge/Join results of A and B
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 19/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 19
Service Adaptation II
Solution description
Implement a service adaptation layer tailoring backend services to the needs its
consumers
Use frameworks such as the Composite Application Framework (CAF),
Enterprise JavaBeans™ specification, or Spring
Strive for type re-use (i.e. leveraging parts of service types for target types)
Expose the adapted services as Web Services
Be transparent to the inner logic of the composite application
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 20/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 20
Service Adaptation III
Claim
----------------------
- claimId- salesOrderID
- salesOrderPosition
- reason
- …
SalesOrder
---------------------- salesOrderID
- …
- …
Claim
---------------------
- claimId
- salesOrderID
- material
- reason
- …..
SalesOrderItem
---------------------
- material
- …
- …
1 n
Find Claim By ID Find Sales Order By ID
Find Claim By ID
Service Adaptation Layer
Backend
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 21/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 21
Service Adaptation IV
Consequences
In service chains with iteration, try to parallelize service calls
Iterate on results of service A, calling service B sequentially is sub-optimal
If B doesn‘t allow for mass input data, perform calls in parallel threads
Note: if B can be changed for mass input data, it‘s the preferred option
Regarding performance, executing service adaptation in backend would beoptimal
May reduce network traffic between backend and composite
May allow for easier parallelization of calls
May allow more efficient/convenient (mass-)data processing
No hard coding of default values: expose via configuration UI
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 22/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 22
Service Adaptation IV
Consequences
In service chains with iteration, try to parallelize service calls
Iterate on results of service A, calling service B sequentially is sub-optimal
If B doesn‘t allow for mass input data, perform calls in parallel threads
Note: if B can be changed for mass input data, it‘s the preferred option
Regarding performance, executing service adaptation in backend would beoptimal
May reduce network traffic between backend and composite
May allow for easier parallelization of calls
May allow more efficient/convenient (mass-)data processing
No hard coding of default values: expose via configuration UI
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 23/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 23
Backend Abstraction Layer I
Problem description
A composite application should be decoupled from the backend system(s) it is
operating on during runtime.
Allow for exchange of backend system or services without modification of
‗inner‘ composite logic
Precondition: Replacement provides same business-data/-semantics
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 24/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 24
Backend Abstraction Layer II
Solution description
Define an interface fitting the needs of the inner logic of the composite.
This interface is called Backend Abstraction Layer interface or BAL
interface shortly.
The BAL interface is the stable ―contract‖ defining the expected business
functionality
all potential combinations of backend services have to fulfill the contract or
be adapted to it
Switching backend services should be a configuration task, i.e. only redirecting
a ―pointer‖ in the composite‘s customizing data.
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 25/44© SAP 2008 / SAP TechEd 08 / COMP206 Page 25
Backend Abstraction Layer III
Defines stable interface
Defines required business functionality
Defines behavior for error handling
Backend Abstraction Layer
Business Logic Layer
Service Adaptation
Platform independent
Service Interface
Platform independent
Service Adaptation
Platform dependent
Service Interface
Platform dependent
Service Adaptation
Platform dependent
Service Interface
Platform dependent
Switch between implementations
via Configuration
Backend Backend
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 26/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 26
Backend Abstraction Layer IV
Consequences
By using EJBs, switching can be done by Java Naming and Directory
Interface™ (JNDI) name exchange in configuration
Within the SAP NetWeaver Composition Environment the Composite
Application Framework (CAF) fulfills these requirements
Can be used for transition from ‗legacy‘ services to Web Services, which is
especially important if service provisioning runs in parallel to compositeapplication development.
Abstraction of connectivity protocols
Abstraction of data syntax (e.g. leading zeros in return values)
Abstraction of data semantics (mapping to Global Data Types)
Note: this pattern can be combined with Service Adaptation pattern
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 27/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 27
1. Anatomy of composite applications
2. Patterns for the service design
3. Patterns for the service composition and business object layer
4. Patterns for the UI layer
5. Patterns for the process layer
6. Summary
Agenda
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 28/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 28
Object Work List I
Problem Description
The end user wants to search and retrieve business objects to be processed byhim. Based on the query results, he wants to execute further actions.
Solution description
If the Object Work List is not provided by the server or a framework, create a UIfor selection criteria and a result table.
The selection criteria should support intervals, operators/wildcards, multiple
values per criteriaSupport persistency for user queries so the user does not have to re-create
them every new session.
The result table has to support features like filtering, sorting, column movingand hiding
Since user queries may take long to execute depending on selection criteria
values, query result caching should be implemented.Due to the same reason, queries should be executed asynchronously (i.e.
without blocking the UI), allowing to work with other queries while refresh isperformed.
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 29/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 29
Object Work List II
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 30/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 30
Object Work List II
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 31/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 31
Object Work List III
Consequences
A similar alternative pattern is Workflow Inbox populated with work items of
the current user in a push mode (allows only filtering after population, but no
direct influence to item retrieval by the user)
Consequently, Workflow Inbox doesn‗t offer selection criteria to the user.
Workflow Inbox is the typical pattern when working process-based only (i.e.
process runtime pushes work items according to process-step – users/rolesassignments)
Object Work List is typically suitable for expert workers responsible for their
workload on their own, while the Workflow Inbox also fits to non-experts.
Other indicator for Object Work List (but no strict implication necessarily):
working with mass data
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 32/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 32
Wizard UI
Problem descriptionSequential steps that are to be executed by one role ―in one go‖
Solution description
Use a Wizard UI component in one step of the process model
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 33/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 33
1. Anatomy of composite applications
2. Patterns for the service design
3. Patterns for the service composition and business object layer
4. Patterns for the UI layer
5. Patterns for the process layer
6. Summary
Agenda
D l d W it O ti I
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 34/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 34
Delayed Write Operation I
Problem description
A service write operation is called directly from
the user interface
There is no possibility to add additional steps,
like approval or checks by other users
If the write operation succeeds and the update of
the process status fails, the process is in aninconsistent state
Solution description
Store the user input in the process context and
perform the write operation in a subsequent step
Process
ContextParameters
Step 1
UI
Service Service
Check Update
Step 2
Error handling
D l d W it O ti II
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 35/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 35
Delayed Write Operation II
Consequences Separating service calls into dedicated process steps causes additional effort,
e.g. for error handling.
Do only separate the modifying service call into a subsequent process
step; no further separations should be done (e.g. check services can be called
by UI component directly).
The service call will be repeated periodically until a success or failure message
is received by some process runtimes.
Works best in combination with idempotent services (see next slide)
Id t
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 36/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 36
Idempotency
Idea: identify a service call uniquely, only executing it exactly once.
pass unique ID with service request message the server will process this message and cache its results on first receipt
in case of subsequent requests with same ID, cached result is returned
java.util.UUID.randomUUID() conveniently generates UUIDs
Service
Consumer
Service
Provider
Input Message
(query / request)
Return Message
(response / confirmation)
Undelivered Response
Service
Consumer
Service
Provider
Input Message
(query / request)
Return Message
(response / confirmation)
Successful Call
Service
Consumer
Service
Provider
Input Message
(query / request)
Undelivered Request
Note: Idempotency becomes less important when EOIO-messaging (e.g. WS-RM compliant) is ensured
But more sophisticated infrastructure required both on server and client
E t li d R l (R l E i ) I
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 37/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 37
Externalized Rules (Rules Engine) I
Problem description
Business rules change more frequently than the rest of the application code
The same rule may be applied in many processes
Solution description
Use a rules engine (JSR-94 compliant or proprietary implementation) that
allows central creation and management of your business rulesSeparate condition and action
The conditions should be handled by the rules engine
The actions should be defined in the process flow
The process model should not be affected by a rule modification
A d
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 38/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 38
1. Anatomy of composite applications
2. Patterns for the service design
3. Patterns for the service composition and business object layer
4. Patterns for the UI layer
5. Patterns for the process layer
6. Summary
Agenda
S
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 39/44
Summary
Use Composite Application Design Patterns to improvethe architecture of your applications
Use them with common sense
Adapt them to your own needs
Existing frameworks or server infrastructure may already
provide them out of the box
Recommended Reading
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 40/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 40
Recommended Reading
Jan Rauscher, Volker Stiehl
Programmierhandbuch
SAP NetWeaver
Composition Environment
The Developer‘s Guide to the SAP
NetWeaver CompositionEnvironment
ISBN 978-3-8362-1129-1
(German)
ISBN 978-1-59229-171-7
(English)
http://www.sap-press.de/1655 (de)
http://www.sap-press.de/1671 (en)
Building Your Business with
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 41/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 41
SDN Subscriptions offers developers and consultants like you,
an annual license to the complete SAP NetWeaver platformsoftware, related services, and educational content, to keepyou at the top of your profession.
SDN Software Subscriptions: (currently available in U.S. and Germany)
A one year low cost, development, test, and commercializationlicense to the complete SAP NetWeaver software platform
Automatic notification for patches and updates
Continuous learning presentations and demos to buildexpertise in each of the SAP NetWeaver platform components
A personal SAP namespace
SAP NetWeaver Content Subscription: (available globally)
An online library of continuous learning content to help build skills.Starter Kit
Building Your Business with
SDN Subscriptions
To learn more or to get your own SDN Subscription, visit us at the
Community Clubhouse or at www.sdn.sap.com/irj/sdn/subscriptions
Further Information
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 42/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 42
Further Information
Related Workshops/Lectures at SAP TechEd 2008
COMP101, Building Custom Applications with SAP NetWeaver CE,
Lecture
COMP164, Developing Composite Applications With SAP NetWeaver
CE, Lecture
COMP201, Deep Dive Into Real-World Composite Applications,
Lecture
COMP261, Creating Service Mashups With the SAP Composite
Application Framework, Hands-On
Related SAP Education and Certification Opportunities
http://www.sap.com/education/
SAP Public Web:
SAP Developer Network (SDN): www.sdn.sap.com/irj/sdn/nw-ce www.sdn.sap.com/irj/sdn/nw-composition
Business Process Expert (BPX) Community: www.bpx.sap.com
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 43/44
© SAP 2008 / SAP TechEd 08 / COMP206 Page 43
Thank you!
8/12/2019 COMP206 Print
http://slidepdf.com/reader/full/comp206-print 44/44
Please complete your session evaluation.
Be courteous — deposit your trash,and do not take the handouts for the following session.
Thank You !
Feedback