2014 BSc-BIT-BPM-Service Oriented Architectures in a BPM Context
Programme: Bachelor of Science in Business Information Technology FHNW
Course: Business Process Management
Topic: Service Oriented Architectures in a BPM Context
FHNW Business Process Management Service Oriented Architectures in a BPM Context Andreas Martin Service Oriented Architectures in a BPM Context http://www.flickr.com/photos/dirk_hofmann/4200450207
gotta find a way to make this fit into the hole for this[…]” - Walter von Huene (NASA technician, Apollo 13) Service Oriented Architectures in a BPM Context
Case & Context … a very simple and suboptimal example indeed. This is what we have: a manual loan approval process. and two legacy system is an extremely suboptimal situation. Service Oriented Architectures in a BPM Context 1.1. Process Graph This is how the approver uses the systems:
… a very simple and suboptimal example indeed. This is what we want to have: So we have at least three options: Complete Restart Data Integration SOA-based Integration (sometimes called Application Integration, SOA is only one way to do that) Service Oriented Architectures in a BPM Context 1.2. Workflow Graph
Complete Restart … well optimal but often not feasible. The all in one nicely designed new system: Integrated DB schema Nicely designed services Service Oriented Architectures in a BPM Context
Data Integration … well but what happened with the logic? Data integration using a data integration middleware like OLAP, data transformation systems or data warehouses. Drawback: we have to re-implement the logic. Service Oriented Architectures in a BPM Context
SOA-based Integration … we have two common options: Direct service access: Enterprise Service Bus access: Service Oriented Architectures in a BPM Context Enterprise Service Bus (ESB)
Definition: “A component represents a modular part of a system that encapsulates its contents […]”. “A component defines its behavior in terms of provided and required interfaces”. From a developer perspective: A component can consists of several classes. From a general perspective: A component can be a place where certain computations can be made. Or it can even represent a server, databases or entire systems. Service Oriented Architectures in a BPM Context Source: OMG Unified Modeling Language (OMG UML), Superstructure Version 2.4.1
Definition: “An interface is a kind of classifier that represents a declaration of a set of coherent public features and obligations. An interface specifies a contract; any instance of a classifier that realizes the interface must fulfill that contract”. From a developer perspective: An interface can serve as a contract for certain implementations. The implementing class must contain the operations of the interface. From a general perspective: An interface is something where component (e.g. other system) can access certain features of another component. An interface is rigorously defined concerning parameters and result. Service Oriented Architectures in a BPM Context Source: OMG Unified Modeling Language (OMG UML), Superstructure Version 2.4.1
(SOA)? A Service Oriented Architecture, as the name it says, is basically a description of an architecture using the service concept. SOA is technology-independent. In essence: There is a SERVICE and may be a CONSUMER. And they are maybe embedded in different systems: Service Oriented Architectures in a BPM Context
Open Group” “Service-Oriented Architecture (SOA) is an architectural style that supports service-orientation”. “Service-orientation is a way of thinking in terms of services and service-based development and the outcomes of services.” “A service: Is a logical representation of a repeatable business activity that has a specified outcome (e.g., check customer credit, provide weather data, consolidate drilling reports) Is self-contained May be composed of other services Is a “black box” to consumers of the service” Service Oriented Architectures in a BPM Context Source: http://www.opengroup.org/soa/source-book/soa/soa.htm
(SOA)? In practice: SOA is implemented using Web Services. Goal of SOA: is the integration of heterogenic and distributed systems. Core concepts: Service-Provider Service-Consumer (Enterprise) Service Bus, Registry SOA relies on best practices and is more an evolution than a revolution. Service Oriented Architectures in a BPM Context
(Persistence Layer) … and what does SOA have to do with BPM? “BPM is SOA's killer application, and SOA is BPM's enabling infrastructure” (BPM pioneer, Ismael Ghalimi). Parts of the system will be made available as services. A business process can be represented using different service calls. A business process itself can be again a service. SOA provides the technological basis of an integration. Service Oriented Architectures in a BPM Context Service (Service Layer) Presentation (Presentation Layer) Service Consumer Process (Process Layer) Database User Service Provider SOA Adapted from: H. Wache, FHNW
make this work? 1. Service discovery: Where can we find the right services and where do I get it? 2. Service description: What does the service offer and how can I make use of the service (methods, attributes, etc.)? 3. Service transport and messaging: How can the communication (transport) between service and consumer be realized and is there a specific message format? 4. Service and consumer implementation: Is there a standardized way to implement services and consumers? Service Oriented Architectures in a BPM Context
A web service encapsulates well defined functionalities of a information system component. It is a technological framework for implementing and integrate distributed information systems. It is known since year 2000. Web services are only one possibility to implement a SOA. SOA is not equal to Web Services. Today two de-facto standards to implement web services: SOAP (Web) Services: the originally implementation and still more relevant in a BPM context. REST (Web) Services: sometimes classified to web oriented architectures (WOA) and not to SOA. But in practice it can be classified as web service. Service Oriented Architectures in a BPM Context
WSDL - Service description: Web Services Description Language (WSDL) describes the operations, parameters and return values of a service. SOAP - Service messaging: Simple Object Access Protocol (SOAP) is messaging protocol based on XML. The messages are exchanges using a transport protocol like HTTP, SMTP or JMS. UDDI - Service discovery: Universal Description Discovery, and Integration (UDDI) is an optional discovery mechanism for soap web services descriptions. UDDI is not widely adopted. Service Oriented Architectures in a BPM Context Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Example Service Oriented Architectures in a BPM Context import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.WebParam; @WebService(serviceName = "CustomerService") public class CustomerService { @WebMethod(operationName = "isAlreadyACustomer") public boolean isAlreadyACustomer(@WebParam(name = "firstName") String firstName, @WebParam(name = "lastName") String lastName) { //service logic return result; } } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
With the right container (application server or even a servlet container) and right development tools (e.g. NetBeans or Eclipse with JBoss Tools) it is extremely straight forward to create SOAP web service. Choose the right specifications: JAX-WS (2.2a): This is a set of API’s for building and consuming Web Services in Java. JSR 181 (Metadata 2.3): This specification defines certain @Annotations for developing SOAP web services. The annotations act as a mapping between the WSDL and a Java interface. Service Oriented Architectures in a BPM Context
called RESTful Web Services REST stands for REpresentational State Transfer and it is based on the hypermedia architecture style. The concept is based on RESOURCES, which will be addressed using ID’s. REST uses a limited range of standard methods. Resources are interlinked with other resources. Every resource can have different REPRESENTATIONS. It is a stateless communication. Service Oriented Architectures in a BPM Context Adapted from: R. Telesko, FHNW
called RESTful Web Services Service Oriented Architectures in a BPM Context Adapted from: http://wink.apache.org/documentation/1.0/html/1%20Introduction%20to%20Apache%20Wink.html Resource Representation 1 (text/xml) Representation 2 (text/html) Representation 3 (image/jpeg) Representation 4 (application/json) GET PUT POST DELTE URI (base URI, such as http://example.com/resources/) HTTP- Methods REST Web Service Representation (every Internet media type for the data possible)
Example REST web service needs more code (or annotations) compared to SOAP web services. The interface design is more complicated, because it has to be consistent to the HTTP- style. The main specification in the Java world is: JAX-RS (2.0): This is a set of API’s for building and consuming REST Web Services in Java. Service Oriented Architectures in a BPM Context import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @Path("CustomerService") public class CustomerService { @GET @Path("{lastName}/{firstName}") @Produces("text/plain") public String isAlreadyACustomer(@PathParam("firstName") String firstName, @PathParam("lastName") String lastName) { Boolean result = firstName.equals("Andreas")&&lastName.equals("Martin"); return result.toString(); } }
Resource- oriented Different representations HTTP- Protocol Interface description (WADL, but not widely accepted) SOAP: Service- oriented XML-based representation Different protocols Interface description (WSDL) Service Oriented Architectures in a BPM Context Sample REST SOAP Create an article PUT /article/{id} CreateArticleltem(int id, string title) Update an article PUT /article/{id} UpdateArticleltem(int id) Get an article GET /article/{id} GetArticle(int id) Get all articles GET /article/ GetAllArticles() Delete an article DELETE /article/{id} DeleteArticleltem(int id)
The idea is to describe business processes on a technical level. Basic idea is to support developers to develop business processes. This means that the activities are implemented as SOAP Web Services. BPEL is based on XML. block-oriented / structured (BPMN is graph-oriented). A BPEL process can be easily published as SOAP web service. Service Oriented Architectures in a BPM Context http://docs.jboss.org/savara/releases/1.1.x/userguide/html/bpel.html Adapted from: D. Wolff, FHNW
- Editors Most BPEL editors are graphical. The basic idea is to focus on the process modelling. But the process representation is not adequate for end-users. Technical details are encapsulated. Example - JBoss BPEL Editor: Service Oriented Architectures in a BPM Context Adapted from: D. Wolff, FHNW
Service Oriented Architectures in a BPM Context <bpel:process name="SayHello" targetNamespace="http://www.jboss.org/bpel/examples" suppressJoinFailure="yes" xmlns:tns="http://www.jboss.org/bpel/examples" xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"> <bpel:import location="SayHelloArtifacts.wsdl" namespace="http://www.jboss.org/bpel/examples" importType="http://schemas.xmlsoap.org/wsdl/" /> <bpel:partnerLinks> <bpel:partnerLink name="client" partnerLinkType="tns:SayHello" myRole="SayHelloProvider" /> </bpel:partnerLinks> <bpel:variables> <!-- Reference to the message passed as input during initiation --> <bpel:variable name="ReceiveSayHelloVar" messageType="tns:SayHelloRequestMessage" /> <!-- Reference to the message that will be returned to the requester --> <bpel:variable name="ReplySayHelloVar" messageType="tns:SayHelloResponseMessage" /> </bpel:variables> <bpel:sequence name="main"> <!-- Receive input from requester. Note: This maps to operation defined in SayHelloArtifacts.wsdl --> <bpel:receive name="ReceiveSayHello" partnerLink="client" portType="tns:SayHello" operation="sayHello" variable="ReceiveSayHelloVar" createInstance="yes" /> <bpel:assign validate="no" name="AssignName"> <!-- LOGIC --> </bpel:assign> <!-- Generate reply to synchronous request --> <bpel:reply name="ReplySayHello" partnerLink="client" portType="tns:SayHello" operation="sayHello" variable="ReplySayHelloVar" /> </bpel:sequence> </bpel:process> Import of the client WSDL. Partner links List of services participating in this BPEL process. Variables List of messages and XML documents used within this BPEL process. Orchestration Logic Set of activities coordinating the flow of messages across the services integrated within this business process. https://github.com/jboss-switchyard/quickstarts
service invoking Web Service Client Service Oriented Architectures in a BPM Context @Named @Stateless public class CustomerService { @Inject @ProcessVariable public Object customerId; @Inject private BusinessProcess businessProcess; @WebServiceRef(type=CustomerWebService_Service.class) private CustomerWebService customerWebService; public void loadCustomer() { Customer customer = customerWebService.findCustomerById(Long.valueOf((String) customerId)); if (customer != null) { businessProcess.setVariable("customerFirstName", customer.getFirstName()); businessProcess.setVariable("customerLastName", customer.getLastName()); } } }
Conceptual Example The basic idea is to avoid proprietary cross- connections over different applications: Service Oriented Architectures in a BPM Context Partner Systems HTTP Partner Systems FTP Inventory System JMS SAP JCA Mail System SMTP Java EE Application SOAP/HTTP .NET Application SOAP/HTTP File System File- Endpoint
Example The basic idea is to have one central bus with all necessary applications connected: Service Oriented Architectures in a BPM Context Enterprise Service Bus (ESB) (Messaging, Routing, Transformation) Partner Systems HTTP Partner Systems FTP Inventory System JMS SAP JCA Mail System SMTP Java EE Application SOAP/HTTP .NET Application SOAP/HTTP File System File- Endpoint
Send and receive messages synchronous and asynchronous communication possible Routing e.g. (1) first authentication, (2) then invoke a service. Mediation Translation of different protocols and formats. Security Management Service Oriented Architectures in a BPM Context Adapted from: D. Wolff, FHNW
Source Products Commercial Oracle Service Bus IBM WebSphere ESB Microsoft BizTalk Server Windows Azure Service Bus Red Hat JBoss Fuse Service Works … Open Source Mule ESB Talend ESB Apache ServiceMix Red Hat JBoss Fuse JBoss SwitchYard … Service Oriented Architectures in a BPM Context
Service Works Service Oriented Architectures in a BPM Context https://de.redhat.com/resourcelibrary/whitepapers/red-hat-jboss-fuse-service-works-technology-overview
view. 1. To get a feeling what an Enterprise Service Bus offers and how it works, the JBoss SwitchYard framework will be chosen as a starting point. 2. Using SwitchYard it is possible to create and configure Web Services – that is a core feature of an ESB. 3. Another core feature of an ESB is transformation and mediation based on Enterprise Integration Patterns. Service Oriented Architectures in a BPM Context https://de.redhat.com/resourcelibrary/whitepapers/red-hat-jboss-fuse-service-works-technology-overview
is an open source Enterprise Service Bus (ESB) from JBoss”. JBoss calls it the “next-generation ESB”. Actually it is a service development framework and tooling. It is 100 % open source and is built on open standards and established technologies – no commercial product specific interface. Service Oriented Architectures in a BPM Context http://design.jboss.org/jbossorg/branding/datasheets/pdf/datasheet_switchyard.pdf http://www.puzzle.ch/assets/632/Erfahrungsbericht_zu_JBoss_Enterprise_SOA_Platform_6.pdf
Routing Service Oriented Architectures in a BPM Context http://www.redhat.com/summit/2011/presentations/jbossworld/whats_new/wednesday/babo_w_1400_esb_reloaded.pdf
Routing Service Oriented Architectures in a BPM Context http://rhsummit.files.wordpress.com/2013/07/babo_loosely_coupled_reusable_and_interoperable.pdf
Visual Development Service Oriented Architectures in a BPM Context http://rhsummit.files.wordpress.com/2013/07/babo_loosely_coupled_reusable_and_interoperable.pdf
service invoking Web Service Client Service Oriented Architectures in a BPM Context @Named @Stateless public class CustomerService { @Inject @ProcessVariable public Object customerId; @Inject private BusinessProcess businessProcess; @WebServiceRef(type=LoanApprovalESBService_Service.class) private LoanApprovalESBService approvalESBService; public void loadCustomer() { Customer customer = approvalESBService.findCustomerById(Long.valueOf((String) customerId)); if (customer != null) { businessProcess.setVariable("customerFirstName", customer.getFirstName()); businessProcess.setVariable("customerLastName", customer.getLastName()); } } }