BizTalk 2009 : WCF LOB Adapter SDK (part 1) - Generating Adapter Skeleton Code
1. Step 1: Generating Adapter Skeleton Code
First, you have to create WCF LOB Adapter project. Begin by using Visual Studio's WCF LOB Adapter Development Wizard to generate some skeleton code. Here is the process to follow:
To create a WCF LOB Adapter project, open Visual Studio 2008. Select File => New Project. The New Project dialog box will open. Select a Visual C# project for the project type, and select WCF LOB Adapter from the Templates pane. Specify the project name and location, as shown in Figure 1.
Click OK. The WCF LOB Adapter Development Wizard, shown in Figure 2, will open.
Click Next.
Figure 1. Creating a WCF LOB Adapter project
Figure 2. The WCF LOB Adapter Wizard
On the Scheme, Namespace and URI Information page, specify the parameters shown in Figure 3. If you want to override the default namespace, select the "Override default namespace" check box, and type the desired namespace in the "Service namespace" field.
Figure 3. Scheme, Namespace, and URI Information page
Click the Next button.
Specify the parameters shown in Figure 4, and click the Next button.
Figure 4. Data flows and metadata features
On the Adapter Properties page, add the binding properties listed in Table 1. The EnableConnectionPooling property is used by the ASDK to enable or disable the runtime connection pooling. Make sure that after adding the properties, the Adapter Properties page looks like Figure 5. Click the Next button.
Table 1. Adapter Binding Properties
Property Name Data Type Default Value EnableConnectionPooling System.Boolean True PollingPeriod System.Integer 10 Figure 5. Adapter Properties page
On the Connection Properties page, add the connection properties listed in Table 2. After adding the properties, the Connection Properties page should look like Figure 6.
Table 2. Adapter Connection Properties
Property Name Data Type Default Value Application System.String HotelApp EnableAuthentication System.Boolean True Host System.String HotelAppHost Click the Next button. On the Summary page, click the Finish button. Figure 7 shows the Solution Explorer with the files generated by the WCF LOB Adapter Development Wizard.
Figure 6. Connection Properties page
Figure 7. HotelAdapter generated project
Tables 3 to 7 give a brief description of the files generated by the wizard.
| File | Description |
|---|---|
| HotelAdapterConnection.cs | Contains the definition of the class implementing the IConnection interface. This class is responsible for a single connection to the target LOB system. |
| HotelAdapterConnectionFactory.cs | Contains the definition of the class implementing the IConnectionFactory interface. This class creates an instance of the class implementing the IConnection interface, that is, HotelAdapterConnection. |
| HotelAdapterConnectionUri.cs | Contains the definition of the class representing connection string to the target LOB system. |
| File | Description |
|---|---|
| HotelAdapterMetadataBrowseHandler.cs | Contains the definition of the class implementing the IMetadataBrowseHandler interface. This class is responsible for the metadata browse capabilities of the adapter. |
| HotelAdapterMetadataResolverHandler.cs | Contains the definition of the class implementing the IMetadataResolverHandler interface. This interface is used by ASDK to get the information about supported operations and data types. This information is used to generate proxy files or message type specifications. |
| HotelAdapterMetadataSearchHandler.cs | Contains the definition of the class implementing the IMetadataSearchHandler interface. This class is responsible for the search metadata capabilities of the adapter. |
| File | Description |
|---|---|
| HotelAdapterHandlerBase.cs | Contains the definition of the base class for adapter handlers. |
| HotelAdapterInboundHandler.cs | Contains the definition of the class implementing the IOutboundHandler interface. This class is responsible for listening to events or polling for data on the target LOB system. |
| HotelAdapterOutboundHandler.cs | Contains the definition of the class implementing the IInboundHandler interface. This class is responsible for sending data to the target system. |
| File | Description |
|---|---|
| HotelAdapterBinding.cs | Contains the definition of the class representing a binding for the WCF LOB Adapter. This class hosts a collection of the BindingElements, which the WCF channel is built upon. |
| HotelAdapterBindingCollection Element.cs | Contains the definition of the class used to register the adapter with WCF. |
| HotelAdapterBindingElement.cs | This class is used to apply configuration properties to the adapter binding. |
| HotelAdapterBindingElementExtensionElement.cs | Contains the definition of the class used to expose the adapter as a custom adapter binding. This class is used to configure the adapter using the WCF-custom adapter. |
| File | Description |
|---|---|
| HotelAdapter.cs | Contains the definition of the main adapter class derived from Microsoft.ServiceModel.Channels.Common.Adapter. |
| HotelAdapterTrace.cs | Contains the definition of a supplementary class that can be used in the code for debugging purposes and tracing in particular. |
After completing this step, you have WCF LOB Adapter skeleton classes that you will fill with functionality in the subsequent steps. In the next step, you will categorize the properties that you created using the wizard.