Government Cloud Authors: Liz McMillan, Gopala Krishna Behara, Raju Myadam, Kevin Jackson, Carmen Gonzalez

Related Topics: Government Cloud, Java IoT, Microservices Expo, Open Source Cloud

Government Cloud: Article

Showcasing the Key Design Principles of SOA

A Case Study: Orchestrating Services Using Open Source BPEL

b. Creating Process Flow Directives
A BPEL process runtime life-cycle in its most basic form involves receiving a SOAP message, working with the message data in the form of variables, invoking partner web services either in sequence or in parallel to complete different steps in the process, aggregating the response from the various partner services into an outbound message and then replying to the invoker. Let's go over how this can be modeled in the BPEL process definition document.

The <sequence> activity defines a collection of activities that should be executed sequentially. There can be multiple <sequence> activities, each representing an individual collection of sub-activities needing to be executed in sequence, embedded within the root <sequence> node (refer to the Listing 6 snippet of the BPEL process definition document). The <flow> activity describes parallel paths of execution and as shown in Listing 6 and embeds the partner sequences both of which will be executed concurrently at runtime. The <receive> activity is the port of entry for a process. It represents the first item in a process that will be invoked when a message arrives. Essentially, the process waits for the message to arrive that matches the definition in the <receive> activity particularly with regards to the port type and related operation, input, output and fault messages metadata (in our case the BPEL process will consist of a second <receive> activity defined to capture the asynchronous callback message on the process callback port imagingCallbackPT). This activity captures the incoming message into a global variable "WFRequest" that is available for the remainder of the process (refer to Listing 6). It's important to point out that variables used within a BPEL process must be WSDL message types described or imported within the process context, which once defined can be assigned, queried upon using XPath expressions, transformed or used as input to subsequent service invocations.

Listing 7 is a section of the BPEL document showing the process sequence for the conversation with the Forms service endpoint as described in Listing 1. The <assign> activity consists of copying variable data and can also be used to extract or create new data off message schemas based on XPath expressions. In the assignment PrepareFormsVariables the process is simply copying the message part from the global variable "WFRequest", defined earlier, into the message part of a new variable "formRenderRequest" that is used as the parameter message to that service. The <invoke> activity is what the name suggests, it invokes a partner service defined via the partner links construct as was described earlier. Listing 7 shows an example <invoke> activity in the flow sequence for the BPEL process to converse with the external Forms system that was described earlier as a partner link. The port type "frm:FormsPT" indicates the port type on the partner to use (described in the FormsPTService.wsdl document that was imported earlier), the operation "renderPDF" specifies the operation to invoke on the service while the inputVariable and outputVariable point to a variable containing the message or message part data that is used as parameter and response, respectively, from the service during invocation.

One of the message parts of the output variable "formRenderResponse" from the forms system <invoke> activity contains the PDF form content of the pre-populated form as a binary byte array. This needs to be assigned to a message part of the global variable "imagingRequest" that is of WSDL message type "img:ImagingPT_performImageArchival" and used as a parameter to the actual invocation of the Imaging service partner link (refer to Listing 8). Since the binary stream data (PDF) needs to be available before it gets imaged, the <invoke> activity to the forms system needs to be complete prior to the invocation on the Imaging system. Since both the "FormRendering" and "Imaging" <sequence> activities are defined to be part of the parallel <flow> activity, we cannot be absolutely certain that the "RequestFormRender" invocation be complete first. Therefore, we use a BPEL <link> activity "forms-to-imaging" within the <flow> to express this dependency exclusively. The elements <sources> and <targets> respectively contain <source> and <target> elements, which are used to establish this flow relationship for synchronizing the related activities (refer to Listings 7 and 8). Listing 8 also features a <receive> activity receiving the callback message on the callback port type defined by the partner links mechanism in the BPEL document (refer to Listings 3, 4 and 5).

The <reply> activity is usually the final activity within the BPEL process. Once the message has been received and the various intermediary partner links (forms, imaging) have been invoked, the callback has been received, in essence the entire message exchange processing is complete and you would want to send back a response of some kind aggregated with the message responses from the partner systems. This is done using the <reply> activity that is similar in definition to the process's root <receive> activity with regards to the port type and operation but happens in the opposite direction in replying to the calling client of the BPEL process.

Deploying the BPEL Process Definition
A BPEL process definition is comprised of the BPEL process document, the related WSDL contract defining the process port types/operations and partner links, the partner WSDL documents, and other relevant schema files. This mass of files, also called Process Archive, need to be bundled into a .ZIP file and deployed to the jBPM-BPEL runtime under your application server. jBPM provides an automatic discovery mechanism that looks for files under the zipped process archive for the .bpel process document that internally indicates the location of the interface WSDL and schema document. The jBPM DeploymentServlet will deploy the process definition by registering the process service endpoint and publishing the process WSDL files. The deployed process definitions are available under the jBPM-BPEL console http://<machine>:8080/jbpm-bpel/processes.jsp. At this point, the BPEL process is fully available to external clients as a composite service, aptly called WorkflowOrderService (please refer to Listing 5).

Imaging System Callback
In an earlier section I had mentioned the Imaging system responding in an asynchronous manner on a JMS message queue with the status of the image archival process. A MessageDrivenBean (MDB) listening on that particular JMS queue will upon receipt of the javax.jms.Message trigger a callback into the imagingCallbackPT (shown in Listing 5) of the deployed composite service (identified in the program listing by JNDI context "service/WorkflowOrder" and "WorkflowOrderService" in the generated composite service's WSDL document). Listing 9 describes how that works. The MessageDrivenBean is created in the standard J2EE 1.4 manner along with the required ejb-jar.xml descriptor (containing bean definitions, the message desination it must listen on and the JNDI service reference context that includes the WSDL document of the composite service) and deployed on the same server as the Imaging endpoint.

Developing the Client Assembly for the Process
There are a few different approaches in developing the clients for the composite service assembly we just created and deployed to the BPEL runtime engine. If you set up a JAX-RPC Web service endpoint, which our orchestration service eventually ends up as upon deployment to the server, you can leverage the J2EE 1.4 client programming model using any of the JAX-RPC implementing frameworks like JBossWS or the Java Web Services Developer Pack (JWSDP). The J2EE 1.4 platform supports the WS-I Basic Profile that basically ensures that the Web services developed are portable across any JAX-RPC implementation and interoperable with other Web services (like those created using .NET or other competing platforms) supporting the same profile.

For the purpose of illustrating this, I have described a client assembly developed using the JWSDP's wscompile tool to create the required client artifacts like SEIs, User Types, Exception Types, Serializers and the WSDL/Java mapping meta data jaxrpc-mapping.xml file (as stated earlier, you could just as well have used the JBossWS wstools utility to do the same). Essentially there are three types of Web service clients: Static Stubs, Dynamic Proxy and Dynamic Invocation Interface (DII) [10]. A static stub is essentially a Java class that is statically bound to an SEI. The stub, or client proxy object, is generated using the wscompile (or wstools) utility with the aid of a configuration file and defines all the methods that the SEI defines. Both utilities read the composite service's WSDL file (the location of which is specified in the configuration file) and generate the runtime files based on information in the WSDL file. I like the fact that the static stub approach requires less effort to create the plumbing in order to talk to Web service endpoints even though we must regenerate the stub and other infrastructure files each time our composite service's WSDL contract changes.

Among the mass of files that the wscompile tool generates is the stub (WorkflowPT_Stub) and Implementation WorkflowOrderService_Impl class. Listing 10 shows a simple Java client for our WorkflowPT composite service. Note that a stub object is created using the WorkflowOrderService_Impl object that maps Java to XML and assembles the SOAP message to be sent. The endpoint address that the stub uses to access the service is set and then the stub is cast to the WorkflowPT SEI. Next, the input and return parameter objects to the service are then defined and set. Last, the initiateWorkflow() method is called on the stub, passing in the input parameter objects, to begin the runtime process of assemblying the SOAP message to to be passed on to the appropriate SOAP handler and thereby on to the endpoint service implementation by the BPEL runtime which triggers the process workflow that was defined earlier.

BPEL is typically used for complex processes that require coordinating between multiple services to fulfill a centralized business goal and is currently the most portable way to integrate complex interactions by using a standard process integration model. BPEL supports some of the commonly used features of a WS-* process language construct such as XML and WSDL typed variables, property based message correlations, expressions and queries using XPath, transformations using XSLT, fault/event handlers along with structured logic constructs and flow directives and support for robust workflow features such as parallel execution, flow sequencing and chaining. The JBoss jBPM platform provides the runtime infrastructure and persistence model on which the compositions can be deployed and executed. Building composite services this way, abstracted into message interactions baked into platform-independent XML, all working towards the fulfillment of a common business goal showcases the key design principles of SOA: cohesiveness, loose coupling, interoperability and reusability.


  1. "An SOA Case Study: Integrating Adobe LiveCycle Forms using JBossWS" by Rizwan Ahmed, SOA Magazine July 2009.
  2. "RESTful SOA with Open Source" by Rizwan Ahmed, SOA Magazine August 2009.
  3. "Business Process Execution Language", Wikipedia.org.
  4. "Web Services Business Process Execution Language version 2.0", OASIS Standard.
  5. "Introduction to jBPM-BPEL", JBoss.com User documentation.
  6. "jBPM User Guide - Chapter 7: Persistence".
  7. "JBossWS- JAX RPC User Guide", JBoss.org.
  8. "JBossWS - User Guide", JBoss.org.
  9. "Java SOA Cookbook" by Eben Hewitt, O'Reilly Media Inc.
  10. "Developing Web Services with Java Enterprise Edition 1.4 Platform".

More Stories By Rizwan Ahmed

Rizwan Ahmed is an IT Systems Architect and author. He has about 10 years of experience in the public and private sector architecting technology, systems and security solutions. He holds Bachelor's and Master's degrees from the Indian Institute of Technology and the Florida State University, respectively. Passionate about open source as contributor and evangelist, he is also a frequent speaker at Java user groups, conferences and sponsored workshops. He holds the Sun Certified Java Programmer, Certified Information Systems Security Professional (CISSP), Certified Secure Software Lifecycle Professional (CSSLP) and the Project Management Professional (PMP) credentials. He lives with his wife and two kids in Columbia, SC.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

@ThingsExpo Stories
DX World EXPO, LLC, a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
"Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, and Brandon Crowfeather, Product Manager, at Vivint Smart Home, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that Conference Guru has been named “Media Sponsor” of the 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. A valuable conference experience generates new contacts, sales leads, potential strategic partners and potential investors; helps gather competitive intelligence and even provides inspiration for new products and services. Conference Guru works with conference organizers to pass great deals to gre...
The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform. In his session at @ThingsExpo, Craig Sproule, CEO of Metavine, demonstrated how to move beyond today's coding paradigm and shared the must-have mindsets for removing complexity from the develop...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
Large industrial manufacturing organizations are adopting the agile principles of cloud software companies. The industrial manufacturing development process has not scaled over time. Now that design CAD teams are geographically distributed, centralizing their work is key. With large multi-gigabyte projects, outdated tools have stifled industrial team agility, time-to-market milestones, and impacted P&L stakeholders.
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"IBM is really all in on blockchain. We take a look at sort of the history of blockchain ledger technologies. It started out with bitcoin, Ethereum, and IBM evaluated these particular blockchain technologies and found they were anonymous and permissionless and that many companies were looking for permissioned blockchain," stated René Bostic, Technical VP of the IBM Cloud Unit in North America, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Conventi...
In his session at 21st Cloud Expo, Carl J. Levine, Senior Technical Evangelist for NS1, will objectively discuss how DNS is used to solve Digital Transformation challenges in large SaaS applications, CDNs, AdTech platforms, and other demanding use cases. Carl J. Levine is the Senior Technical Evangelist for NS1. A veteran of the Internet Infrastructure space, he has over a decade of experience with startups, networking protocols and Internet infrastructure, combined with the unique ability to it...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
"Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offer guided learning experiences on AWS, Azure, Google Cloud and all the surrounding methodologies and technologies that you need to know and your teams need to know in order to leverage the full benefits of the cloud," explained Alex Brower, VP of Marketing at Cloud Academy, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clar...
Gemini is Yahoo’s native and search advertising platform. To ensure the quality of a complex distributed system that spans multiple products and components and across various desktop websites and mobile app and web experiences – both Yahoo owned and operated and third-party syndication (supply), with complex interaction with more than a billion users and numerous advertisers globally (demand) – it becomes imperative to automate a set of end-to-end tests 24x7 to detect bugs and regression. In th...
"MobiDev is a software development company and we do complex, custom software development for everybody from entrepreneurs to large enterprises," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
"There's plenty of bandwidth out there but it's never in the right place. So what Cedexis does is uses data to work out the best pathways to get data from the origin to the person who wants to get it," explained Simon Jones, Evangelist and Head of Marketing at Cedexis, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.