Doron Sherman

Subscribe to Doron Sherman: eMailAlertsEmail Alerts
Get Doron Sherman: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Related Topics: Java EE Journal, XML Magazine, SOA & WOA Magazine, ERP Journal on Ulitzer

J2EE Journal: Article

Delivering SOA

Delivering SOA

With the rapid adoption of Web services standards and increasing support for asynchronous and XML-based messaging in the J2EE specification (JMS, MDB, JAXM, JAXRPC), it's time to address the challenges involved in building business applications based on a service-oriented architecture.

This evolution impacts current practices for Web application development, which now need to support this new paradigm. It also presents challenges for application deployment and management, commonly addressed today through proprietary enterprise application integration (EAI) solutions. In essence, the notion of a business application is evolving into "orchestration" of services, as the lines between development and integration become blurred.

Service orchestration refers to the assembly of loosely coupled components and the coordination of multiple asynchronous conversations over coarse-grain communication protocols. Implementing orchestration logic in an application produces a consistent set of technical infrastructure requirements, such as managing non-linear state and long-lived application context, supporting parallel activities and sophisticated join patterns, handling exceptions and events generated by local and remote components, compensating for failed or cancelled business transactions, and graceful upgrading and management of application functionality.

In this article, I present a sample application demonstrating the orchestration of services implementing a loan procurement business process. I'll describe the technical requirements for orchestration raised by the sample application and how an implementation can leverage the capabilities of the WebLogic Server. Then I'll describe a J2EE-based container for service orchestration that packages the common infrastructure requirements. Finally, we'll show how Java developers can program the orchestration logic of the loan procurement application using a Java-based abstraction.

A New Face for Application Development
It's not an everyday event when multiple technological evolutions, seemingly independent of each other, join together to create sufficient synergy in the software industry to materially change the requirements for business application development as well as for the software platforms that deliver them. The last time something like this happened was in 1993, when a standard protocol (HTTP), a standard presentation markup language (HTML), a Web server, and a Web browser combined to create the ubiquitous publishing medium we know as the World Wide Web. Shortly thereafter, with the introduction and rapid adoption of Java as the language of choice for authoring server-side applications for this medium, the Web application server was born and took the driver seat as the primary mechanism for the delivery of business applications.

Since that time, application development has evolved and matured, in large part due to standardization through the J2EE architecture. This architecture provides an extensible foundation for component-based development of business applications using server-side Java and has facilitated the delivery of self-service applications and user-facing portals into the mainstream. Until recently, these business applications have been characterized by synchronous request/reply interactions with an emphasis on the creation and delivery of dynamic Web pages (presentation), use of encapsulated building blocks (EJB), and connectivity to back-end data stores (e.g., JDBC).

At the same time, organizations have still had to deal with the problem of connecting their information systems to one another, mostly using a variety of middleware technologies and proprietary EAI (enterprise application integration) tools. Even worse, this practice has typically remained separate from the mainstream application development domain and has normally been undertaken by consultants who possess specialized implementation skills. The methodology used for these implementations has continued to steer it away from that used for the delivery of mainstream business applications. However, the continued evolution of the enterprise computing platform and its rapid inroads into technologies such as XML Web services and asynchronous messaging is about to change all this.

Adoption of Web Services
"Businesses and people that work together need their applications and services to work together." This describes the need for interoperability in the heterogeneous enterprise computing environment. This need is driving the growing move toward Web services, an industry-standard interface and connectivity-technology stack layered on top of standard Internet protocols and a self-describing XML data format. Web services are the new building blocks that will enable application development to extend into and address the challenges of enterprise integration. As functional building blocks, Web services can encapsulate a variety of functionality, such as legacy applications, packaged applications (e.g., ERP, CRM, SCM), and Java components as well as .NET components. WSDL, the interface description language used by Web services, is self-describing, while SOAP, its messaging protocol, provides coarse-grain communication based on human-readable XML data file interchange.

Unlike earlier technologies, such as CORBA and DCOM, Web services are vendor-independent and provide true industry-standard interoperability. Web services can be deployed in various contexts, such as inside or across the firewall, using different transport protocols underlying SOAP (such as HTTP, SMTP, and JMS), and can be simple or composite, synchronous or asynchronous. Regardless of the context, Web services are accessible over SOAP and are introspected through their WSDL interface, making them interoperable. Most importantly, Web services provide for loosely coupled operation by separating the interface from the implementation. Thus, the consumer of a Web service need only rely upon the external contract describing the Web service, without assuming anything about its internal implementation.

The Need for Asynchrony
Integrating loosely coupled functionality into business applications inherently increases reliability and scalability requirements, because the underlying components are not under the direct control of the application and cannot be guaranteed to always be available. Synchronous access to such components would potentially create performance bottlenecks and severely limit the execution throughput of the application. In any case, application reliability under such circumstances is not possible since the application context resides in memory and is not persisted. Therefore, asynchronous messaging has been introduced in order to address these needs, thus resulting in both improved application throughput and increased overall reliability, by allowing independent execution.

Using asynchronous messaging in a business application opens a range of opportunities for integrating loosely coupled components but also introduces significant new challenges when compared to a synchronous (RPC) programming metaphor. For example, when making an asynchronous call to an external component, the caller doesn't know how long it will take to execute. Therefore, a message correlation mechanism has to be put in place to be able to receive replies and match them to their original invocations. A conversation with a loosely coupled component may fail due to communication or component execution problems (at either end). Therefore, the application has to store its context at the start of the conversation and re-activate it from a persistent store upon completion of the conversation before executing subsequent application logic.

Publishing and Orchestrating Web Services
Working with Web services as part of a service-oriented application comprises two steps. The first step involves taking the IT assets that need to be integrated into the application and making them available as Web services - "publishing" them. Publishing Web services is widely supported by the latest versions of the leading J2EE application servers and by a growing number of tools, such as Glue (The Mind Electric), CapeStudio (Cape Clear Software), and several others. With growing support for Web service publishing, EAI tools are quickly losing their traditional competitive edge, i.e., providing proprietary adapters for legacy connectivity.

Orchestration, the second step in working with Web services, entails a more complex set of challenges. Orchestration of Web services involves making the services work together, as well as integrating them into an application. From a development standpoint, orchestration means assembly of loosely coupled services and coordination of the asynchronous conversations in which they are involved into manageable business applications. Experience with orchestration of services as part of a business application reveals a consistent set of infrastructure requirements that repeats itself across such applications. These technical requirements are described in our loan procurement example.

Loan Procurement Example
To better understand the technical infrastructure requirements of service orchestration, let's consider an example in which a loan broker integrates people, internal applications, and external service providers using JMS and Web services. We'll use a simplified version of the loan procurement business process (see Figure 1).

    1. A customer submits the loan request through a portal that subsequently starts the execution of the Java orchestration logic.
    2. The orchestration logic (shown as a question mark) communicates with a customer information system (through a session bean) and with a credit rating application (through an asynchronous JMS call) to obtain the customer profile and a credit rating.
    3. The orchestration logic routes any business exceptions that may be encountered to a customer support rep for manual processing of the application.
    4. The orchestration logic then initiates two asynchronous conversations with trading partners UnitedLoan and StarLoan to obtain loan offers that will be presented to the customer as they become available.
    5. Once the customer selects a loan offer, the orchestration logic obtains a loan policy from the selected provider and cancels the other loan requests. The loan policy is then issued to the customer.
Requirements of Orchestration Logic
Let's summarize the primary issues involved in developing, deploying, and managing orchestration logic and the technical requirements that need to be addressed in the context of the sample loan procurement application described above.
    1. Open standards (Java/J2EE, JMS, XML, SOAP, WSDL): How do you leverage your existing investment in, and developer knowledge of, Java and J2EE? How is each conversation marshaled into SOAP/XML and JMS messages?
    2. State and context management: How do you coordinate, store, and manage the state of each conversation while utilizing asynchronous messaging? How do you correlate responses to the business transaction that initiated them?
    3. Loosely coupled services: How do you model each conversation to allow for easy adoption of the application as business conditions change? How easily can you add a new loan processor or handle a change in interface?
    4. Parallel processing: How do you design and coordinate parallel conversations (e.g., submit the loan application to UnitedLoan and StarLoan in parallel)? How do you implement sophisticated join patterns ("Cancel the conversation with UnitedLoan if the user selects the offer from StarLoan")?
    5. Exception management: System- and business-level exceptions increase the variability and complexity of orchestration logic tremendously. What happens if UnitedLoan refuses to process the loan application because the information provided is invalid?
    6. Events and notifications: Conversations can span a long period of time and include multiple responses. How do you handle notifications such as loan approval and intermediate progress events? How do you specify and handle timeouts?
    7. Open nested transactions: How do you combine multiple nonlinear conversations into a business transaction? How do you track the history of activities to allow for compensation, if necessary (since you can't roll back someone else's database...)? 8. Scalability and performance: What happens when the scope of the application increases and you need to support more services, more complex types of conversations, and a higher transaction volume?
    9. Distributed administration: What happens if customer support decides to cancel a submitted loan application request? What happens if a change request occurs in the middle of a conversation?
    10. Business visibility: How do you provide visibility into the state of the conversations? How easily can a business user obtain information on the number of loan requests processed per day or on a particular loan application?
    11. Version control: How do you update the orchestration logic to reflect new business rules? How do you gracefully phase in new versions when 10,000 loan requests are pending?
    12. Audit trailing: Can you trace the history of all conversations related to a specific loan request? Can you provide nonrepudiation for the application?
The CGI Lesson
Time-to-market and cost pressures, efficient utilization of available developer skills, and management of application delivery risks are the constant elements in the changing world of enterprise software. Similar forces were in effect during the mid-'90s when just about every company was hard pressed to deliver a dynamic Web presence to its customers. To address this need, the static content publishing medium was augmented with a Common Gateway Interface (CGI) that enabled publication of dynamic content on the Web.

The delivery of simple Web applications that quickly grew in complexity introduced a common set of technical requirements. Developers found delivering those requirements in a custom, one-off fashion to be a significant impediment to cost-effective development and management of those applications. Session management, resource pooling (e.g., database connections) and multithreading, to name a few of these requirements, were then embedded in a new piece of infrastructure software that provided a compelling buy-versus-build option for IT decision makers and developers. This new piece of software, which became known as the application server, saved developers from repeatedly implementing (and maintaining) the same application infrastructure. Developers could now focus on authoring the application business logic, saving valuable time and increasing productivity.

In addition, this class of self-service and customer-facing applications became easier to deploy and manage in production with the use of an application server. The CGI lesson, i.e. encapsulating application infrastructure and plumbing and enabling developers to focus on the application business logic, is directly applicable to the problem domain of service orchestration.

Extending J2EE into Orchestration
As we observe the ongoing evolution of the J2EE computing platform, we get a clear indication of how orchestration fits in as J2EE expands to support asynchronous messaging and XML Web services.

From JDBC to EJB
Prior to the introduction of JDBC as a Java API, most application logic was coded using proprietary 4GLs (e.g., Oracle's PL/SQL) and stored procedures. The introduction of JDBC enabled developers to access tabular data sources (most notably SQL databases) in a standard fashion and caused a major shift in business logic programming to the middle-tier.

The widespread adoption of JDBC allowed a layer of data access components to be included in the J2EE application server, eventually standardizing as EJB component technology deployed using an EJB container and providing the underlying database access services and infrastructure. This evolution not only made coding at the JDBC API level unnecessary, but it also elevated the programming abstraction and enabled developers to focus on coding logic and avoid dealing with mundane application infrastructure and plumbing complexities.

The JSP Analogy
Java is an extremely flexible and powerful programming language and is particularly useful for authoring server-side logic for Web-based business applications. Since many business applications were intended to provide self-service functionality to end users, developers have sought ways to streamline development of the front-end or presentation-logic tier of these applications. The key to streamlining such development has been congruence - finding a straightforward mapping between the problem domain and the solution domain. JavaServer Pages (JSP) was created as part of the J2EE architecture (see Figure 2) to become the Java-based abstraction-enabling congruence for the development of presentation logic.

JSP technology allows Web developers and designers to rapidly develop, and easily maintain, information-rich, dynamic Web pages. JSP separates the user interface from content generation, thus enabling developers to alter page layout without changing the underlying dynamic content. This separation of page logic from UI design and display, and a reusable component-based design is made possible with the use of XML-like tags combined with Java scriptlets. With these features, JSP has simplified and accelerated the process of building Web-based applications.

The Impact of Messaging
Recently, JMS, JAXM, and related APIs and protocols have been introduced into J2EE to provide access from Java to asynchronous messaging and XML Web services. This is expected to induce a similar shift in how asynchronous business logic handling of loosely coupled services is programmed. Currently, coding to JMS and JAXM APIs is being hailed as the enabling access layer but it's expected that developers will eventually look for higher-level programming abstractions. Abstracting orchestration logic will leverage JMS and JAXM in much the same way that EJB leveraged JDBC and JTS. This migration of orchestration logic from proprietary EAI solutions (aka Businessware, BPM, Workflow, etc.) into the middle tier has already started and is expected to accelerate as effective and easy-to-learn means for programming orchestration logic become available.

The Orchestration Container
As is the case with EJB technology, orchestration requires a runtime environment, or container, for deployment. The orchestration container (see Figure 3) implements the complex plumbing and technical requirements (detailed in the earlier example) that don't need to be exposed to developers. A matching component model, called here the JSB, or Java Scenario Bean, enables effective programming for authoring orchestration logic. JSB is a powerful abstraction that assembles loosely coupled services and sequences the conversations among those services. Since these conversations involve asynchronous communication, JSB enables authoring long-lived, multistep orchestration logic across these services. Furthermore, JSB becomes a natural extension of the J2EE architecture since it is fully interoperable with its components, such as JSP, servlets, and EJB. The orchestration container provides a seamless bridge to XML messaging so developers don't need to deal with cumbersome Java-to-XML (and XML-to-Java) datatype mapping.

Leveraging WebLogic Server
As we've demonstrated above, implementing the complex requirements of orchestration can naturally fit as an extension of the J2EE architecture. The orchestration container, based on J2EE, needs to provide a scalable execution environment for the functional components involved in orchestration logic. The orchestration container is then deployed on top of a robust and scalable J2EE application server such as BEA's WebLogic Server. In addition to leveraging the runtime environment of a J2EE application server, orchestration logic also coordinates transactions among loosely coupled components and, through JMS, provides support for asynchronous messaging. Finally, the orchestration container uses the WebLogic Server two-phase commit (XA) transaction capabilities and its high-performance JMS implementation.

The code for this article can be found on the Web at Listing 1 shows the Scenario Bean source code for the example loan procurement application. Listing 2 shows the associated XML-based deployment descriptor for the JSB.

As you've seen here, building enterprise applications that integrate functionality represented as loosely coupled services produces the need for orchestration. Orchestration involves the assembly of services and the coordination of asynchronous conversations across loosely coupled communication protocols. There is a need to effectively address the complex technical requirements of orchestration, highlighted through the loan procurement example. With the continued advance of J2EE, which provides API access to asynchronous and XML messaging, we demonstrate a nonintrusive approach that naturally extends the J2EE architecture and provides an open application model.

The illustrated solution is composed of an orchestration container that takes care of the infrastructure and plumbing requirements and a JSP-like abstraction that enables powerful, yet easy, authoring of orchestration logic by Java developers. Finally, the use of an orchestration container allows for versatile debugging, monitoring, reporting, and management of the resulting application.

More Stories By Doron Sherman

Doron Sherman is the CTO of Collaxa, Inc., a Web Service Orchestration Server vendor and a BEA Partner located in Redwood Shores, California. He has been involved with Java since its early days and pioneered application server technology while being a founder and chief scientist at NetDynamics.

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.