Last week we introduced you to the idea of using existing Web services to build more complex web services. This week, we're going to take a closer look at business processes and their role in constructing Web services. This article 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 and Web Services - WSDL Extensions for Interactions with a Business Process (Page 2 of 4 )
A business process can invoke Web services provided by other partners, provide Web services invoked by other partners, or both. The latter case can be an asynchronous response or a complex conversation that involves multiple messages flowing in both directions.
Each side of such a conversation provides Web services that are invoked by the other side. In order to describe the relationship between the two Web services, BPEL introduces a WSDL extension called partnerLinkTypes. PartnerLinkTypes contain one or two roles, which define the responsibilities of each side of the conversation. If only one partner offers a service and the other partner is only consuming this service without offering a callback operation, then the partnerLinkType only contains one role.
The role element of the partnerLinkType refers to a WSDL portType, where one partner provides one-way or request-response operations that are consumed by the other partner. Notification or solicit-response operations, described in Chapter 4, aren't supported; they're modeled by using one-way or request-response operations provided by the other side.
The following example shows the partnerLinkType for the SkatesTown portType discussed previously. This partnerLinkType has only one role: seller. The buyer role only initiates the process and doesn't offer Web service interfaces. Therefore, it isn't needed here:
The seller role references the portType of the Web service provided to customers by SkatesTown. The implementation of this service is a BPEL process. The process refers to the portTypes that are named in the partnerLinkType roles.
In the next snippet, a partnerLinkType is shown that has two roles pointing to different portTypes. In this example, two partners are interacting with each other, and the portTypes of both partners are respectively referred to by the two roles. The portType of the seller role is another interface provided by the SkatesTown business process. It's used for asynchronous callbacks associated with an operation provided by the supplier role: