You can use existing Web services to construct more complex Web services. It involves a certain amount of choreography, however. This article gets you started. It is excerpted from chapter 12 of Building Web Services with Java: Making sense of XML, SOAP, WSDL, and UDDI, written by Steve Graham et al. (Sams; ISBN: 0672326418).
Business processes are increasingly important in both enterprise application integration and B2B scenarios. When business processes are using Web services and also exposed as Web services, they provide a powerful recursive aggregation model.
In this chapter, you'll see how existing Web services can be used to construct complex Web services. This process includes defining the business logic in terms of execution order and conditions for the invocation of orchestrated Web services.
Web services choreography languages provide the means to compose services into new complex services. We'll also introduce the Business Process Execution Language for Web Services.
Why Are We Composing Web Services?
In the previous chapters, we looked at the concepts of Web services, examined the Web Services Description Language (WSDL), and discussed various quality of service (QoS) aspects. In most real-world scenarios, a Web service provider isn't just exposing simple and stateless services like a credit card check: Web services are reused and combined into more complex services that provide a higher value to the customer. Some services may provide multiple interactions with the customer for a single business application. In Chapter 8, "Web Services and Stateful Resources," you saw that a running instance of a service may be stateful. In many cases, business processes are stateful Web services.
Consider a business process that implements the processing of a purchase order. It's desirable to be able to not only initiate a purchase order, but also modify or cancel a running order in certain situations. Another example is a service for a loan application, where it may become necessary to ask the customer for additional information at well-defined points during the processing of the service. As you can see, you need to compose existing service into new services and also describe the order of steps and conditions for their execution.
Business processes describe service invocation and interaction patterns and are the basis for creating heterogeneous and distributed applications, also referred to as workflow-based applications. The aggregation of Web services to new, higher-level Web services by means of process composition allows for more flexibility. Such compositions can more quickly adapt to changing business needs, compared to hard-coded applications.
The following sections provide additional motivation for Web service composition and briefly explain the business process language evolution towards BPEL.