Welcome!

Government Cloud Authors: Don MacVittie, Elizabeth White, Liz McMillan, Gopala Krishna Behara, Raju Myadam

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.

Conclusion
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.

References

  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
Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, discussed how they built...
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
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...
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...
The 22nd International Cloud Expo | 1st DXWorld Expo has announced that its Call for Papers is open. Cloud Expo | DXWorld Expo, to be held June 5-7, 2018, at the Javits Center in New York, NY, brings together Cloud Computing, Digital Transformation, Big Data, Internet of Things, DevOps, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
No hype cycles or predictions of a gazillion things here. IoT is here. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
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 ...
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 ...
DevOps at Cloud Expo – being held June 5-7, 2018, at the Javits Center in New York, NY – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Among the proven benefits,...
@DevOpsSummit at Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, is co-located with 22nd Cloud Expo | 1st DXWorld Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
SYS-CON Events announced today that T-Mobile exhibited at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on qua...
SYS-CON Events announced today that Cedexis will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Cedexis is the leader in data-driven enterprise global traffic management. Whether optimizing traffic through datacenters, clouds, CDNs, or any combination, Cedexis solutions drive quality and cost-effectiveness. For more information, please visit https://www.cedexis.com.
SYS-CON Events announced today that Google Cloud has been named “Keynote Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Companies come to Google Cloud to transform their businesses. Google Cloud’s comprehensive portfolio – from infrastructure to apps to devices – helps enterprises innovate faster, scale smarter, stay secure, and do more with data than ever before.
SYS-CON Events announced today that Vivint to exhibit at SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California. As a leading smart home technology provider, Vivint offers home security, energy management, home automation, local cloud storage, and high-speed Internet solutions to more than one million customers throughout the United States and Canada. The end result is a smart home solution that sav...
SYS-CON Events announced today that Opsani will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Opsani is the leading provider of deployment automation systems for running and scaling traditional enterprise applications on container infrastructure.
SYS-CON Events announced today that Nirmata will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Nirmata provides a comprehensive platform, for deploying, operating, and optimizing containerized applications across clouds, powered by Kubernetes. Nirmata empowers enterprise DevOps teams by fully automating the complex operations and management of application containers and its underlying ...
SYS-CON Events announced today that Opsani to exhibit at SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California. Opsani is creating the next generation of automated continuous deployment tools designed specifically for containers. How is continuous deployment different from continuous integration and continuous delivery? CI/CD tools provide build and test. Continuous Deployment is the means by which...