Ready to get started?

Tutorial: Use the CData BizTalk Adapter for Couchbase to Execute Updategrams

Create a simple application in which you use the adapter for Couchbase to execute an updategram and then write the response from Couchbase to a file.

The CData BizTalk Adapter for Couchbase enables you to execute SQL commands, updategrams, and stored procedures on Couchbase data in BizTalk. This article provides a walk-through of an application that uses an updategram to insert Couchbase data.

A one-way file receive location picks up the XML document that contains the updategram.

The document is routed to a solicit-response send port configured for the adapter.

The adapter executes the command. The result of an insert contains the Id of the new record and the rows affected.

The response from Couchbase is routed to a one-way file send port, which writes the BizTalk message to a file.

Add the Adapter to Your Project

Use the Add Adapter wizard to add the adapter to your project. You will use the adapter to query Couchbase for metadata about the table you want to insert to; for example, "Customer".

Right-click on the project in the Solution Explorer and click Add -> Add Generated Items.

Select Add Adapter Metadata in the resulting dialog box.

In the resulting Add Adapter Wizard, select the CData BizTalk Adapter for Couchbase from the list view.

In the Port menu leave the selection blank. Or, if you want to use the connection string for an adapter you have already configured, select the send port or receive location from your BizTalk application.

Generate an Insert Schema

You will use the schema as a template for creating an updategram that will insert Couchbase data. The schema is an .xsd file that defines the XML request and response. As an example, we show how to generate an insert updategram. You can follow the same process to generate update and delete updategrams.

In the Connection String page of the Schema Wizard, enter authentication credentials and other connection properties.

In the next step select the Send Port option.

Clear the One-Way option. The One-Way option ignores any response from the adapter for the updategram, such as the AffectedRows value that is returned. The Id of the newly created row is also returned. By disabling the One-Way option you will get an updategram schema that supports retrieving the Id.

In the Command Type menu select Updategram.

Select the Insert option and select the table and columns you want to insert into. This tutorial uses FirstName and TotalDue.

Note: When you create the updategram, you are limited to inserting the columns you include in the schema.

On the summary page verify the settings you defined and click Finish to close the wizard.

Generate an Updategram Instance

In this step you will create the XML message that will in later steps be sent to the adapter. To create the updategram right-click the .xsd file in the Solution Explorer and then click Generate Instance. The location where the updategram is saved is listed in the Output tab.

The updategram is structured to define what response is desired from Couchbase. For example updategrams and more information, see the help documentation for the adapter.

Configure the Receive Port

To add a receive location to your application, you first need to add a receive port. Receive ports can receive data from multiple receive locations.

View the Application Logs

In the Application Logs you can view error messages and quickly check that your application has initialized successfully. To open the logs expand the Event Viewer (Local) node in the navigation tree in the Administration Console. Expand Windows Logs and select Application.

A list of errors that have occurred will be available here. This will include error messages for all applications on the system, so it is important to check the source of the error message. For the receive location, the source should be "CData BizTalk Couchbase Receive Adapter". Details of the error message should provide insight into why the error is occurring.