The BizTalk Server BPEL Import Wizard provides tool support for contract-driven orchestration development today. You access this wizard when creating new BizTalk Server projects in Microsoft Visual Studio .NET. There is a BizTalk Server project template named BizTalk Server BPEL Import Project (see Figure 5). When you select this template, Visual Studio .NET launches the BPEL Import Wizard that walks you through specifying the contracts to generate the new orchestration.
You can specify complete BPEL definitions describing an entire orchestration or just WSDL and schema definitions for generating the orchestration's port types. Although the full-BPEL approach is quite compelling, it's not the most common scenario today. The scenario focused on here is how to handle dealing with a stand-alone WSDL definition that you've been given to implement.
A typical WSDL definition contains two main types of information:
-
The abstract interface (type, message, portType)
-
The concrete binding details (binding, service)
A Web service that dispatches to BizTalk Server is concerned with both types of information. Orchestrations, on the other hand, aren't concerned with concrete binding information – they're defined in abstract terms via logical ports. This is important to understand when looking at the BPEL Import Wizard because it only generates the orchestration, not the Web service layer.
Figure 5 BizTalk Server BPEL import project
Let's walk through an example while discussing how this process works. We'll assume that we have an existing WSDL definition that defines a single operation named Multiply. The WSDL definition imports two external schema files: DocIn.xsd and DocOut.xsd. DocIn.xsd defines an element named DocIn, which contains two input elements, Param1 and Param2, as illustrated here:
<xs:schema
xmlns="http://example.org/docin"
elementFormDefault="qualified"
targetNamespace="http://example.org/docin"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="DocIn">
<xs:complexType>
<xs:sequence>
<xs:element name="Param1" type="xs:int" />
<xs:element name="Param2" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
DocOut.xsd contains an element named DocOut, which contains a Result element to hold the result of the Multiply operation:
<xs:schema
xmlns="http://example.org/docout"
elementFormDefault="qualified"
targetNamespace="http://example.org/docout"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="DocOut">
<xs:complexType>
<xs:sequence>
<xs:element name="Result" type="xs:long" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Both of these schema files are imported and used by the WSDL definition. They are referenced by the WSDL messages, which are in turn referenced by the operation:
<definitions ...
xmlns:s0="http://example.org/docin"
xmlns:s1="http://example.org/docout"
xmlns:s2="http://example.org/mathservices"
targetNamespace="http://example.org/mathservices"
xmlns="http://schemas.xmlsoap.org/wsdl/"
>
<import namespace="http://example.org/docin"
location="DocIn.xsd" />
<import namespace="http://example.org/docout"
location="DocOut.xsd" />
<message name="InputMessage">
<part name="parameters" element="s0:DocIn" />
</message>
<message name="OutputMessage">
<part name="parameters" element="s1:DocOut" />
</message>
<portType name="MathService">
<operation name="Multiply">
<input message="s2:InputMessage" />
<output message="s2:OutputMessage" />
</operation>
</portType>
...
The rest of this WSDL file goes on to bind the portType to SOAP over HTTP using the document/literal style. However, as far as the orchestration is concerned, the important information is shown above. The types, messages, and portTypes are the constructs that generate the new BizTalk orchestration. In fact, the current BPEL Import Wizard is only capable of dealing with these constructs, which means you have to extract the binding/service elements from the WSDL definition before using it with the BPEL Import Wizard.
Once you have the WSDL definition ready to import, run the BPEL Import Wizard and specify it when prompted to "Select BPEL, WSDL, and XSD Files" to import (see Figure 6). Even though the WSDL file imports the XSD files, you must specify the required XSD files as well. Once you've finished, complete the wizard and the skeleton orchestration project is generated.
Figure 6 BPEL Import Wizard - Selecting Files to Import
Initially, the orchestration project looks deceivingly empty. However, upon closer inspection, you'll notice the following things occurred:
-
If you inspect Solution Explorer, you'll see an orchestration was created with the same name as the WSDL file.
-
The XSD files were automatically imported into the project.
-
The wizard generated several BizTalk Server types and messages for use within the orchestration that you'll find via the Orchestration View (see Figure 7) REF _Ref100857356 \h
-
Given our WSDL, a BizTalk PortType was generated with a name of MathService. The PortType contains a single operation named Multiply, which uses a request/response message exchange.
-
The Request message is mapped to InputMessage—a multipart message type also generated from the WSDL. InputMessage contains a single part named parameter, which maps to the DocIn element from the imported XSD. The same is true for the Response message.
-
In addition to the PortType, notice that the wizard also generated two message variables named Message_1 and Message_2 for use within the orchestration. These messages also map to the DocIn and DocOut XSD elements.
Figure 7 Orchestration view
Now all we need to do is define a new logical port based on the MathService PortType and our orchestration is guaranteed to conform to the interface defined in the original WSDL definition. To do this, create a new configured port and select MathService as the existing PortType. Once you finish the wizard, the new port appears containing all of the operations found in the PortType – in this case Multiply. Then you're simply left with the task of implementing the operations in the orchestration logic.
The completed orchestration for this example is shown in Figure 8. Next, we need to generate the Web services layer that implements the original WSDL contract and dispatches messages into our new BizTalk orchestration.
Figure 8 Port Configuration Wizard
Figure 9 Orchestration implementation from WSDL