Ready to get started?

Configure a Receive Location for the CData BizTalk Adapter for IBM Cloud Object Storage



Pull IBM Cloud Object Storage data in BizTalk using the CData BizTalk Adapter for IBM Cloud Object Storage. Use receive locations to execute SQL commands and automate actions in IBM Cloud Object Storage.

You can follow the procedure in this article to connect to IBM Cloud Object Storage data, configure a static one-way receive location, and use it to perform a simple test: retrieving IBM Cloud Object Storage data and writing it to an XML file.

A receive location can execute SQL commands and create BizTalk messages that contain the results. If you want to execute updategram commands, use a send port.

Create 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.

  1. If you have not already done so, open your application in the BizTalk Administration Console.
  2. In your application, right-click Receive Ports and click New -> Static One-Way Receive Port. The Receive Port Properties dialog is displayed.
  3. In the Name menu, enter a name for the receive port.

Create the Receive Location

After you create the receive port, create the receive location and configure it to use the IBM Cloud Object Storage adapter as its transport type.

  1. Right-click Receive Locations and click New -> One-Way Receive Location.
  2. Select the appropriate receive port of which the new receive location will be a member. The Receive Location Properties dialog is displayed.
  3. In the Name menu, enter a name for the receive location.
  4. In the Receive Location properties, select CData.IBMCloudObjectStorage in the Transport Type menu.
  5. In the Receive pipeline menu, select the default option, PassThruReceive.

Configure the Adapter

In the Transport Properties dialog, specify the command that the adapter will execute.

  1. In the receive location properties, click Configure. The Transport Properties dialog for the adapter is displayed.
  2. In the SQL Command property, enter the command. This example uses SELECT Key, Etag FROM Objects WHERE Bucket = 'someBucket'
Refer to the "Adapter Configuration" chapter for the available adapter configuration properties.

Configure the Connection String

Set credentials and other connection properties in the Connection String Options dialog.

  1. In the receive location properties, click Configure. The adapter properties dialog is displayed.
  2. Click the button in the Connection String property.
  3. Click the box in the Connection String property. The Connection String Options dialog is displayed.
  4. Enter connection properties. Below is a typical connection string: ApiKey=myApiKey;CloudObjectStorageCRN=MyInstanceCRN;Region=myRegion;OAuthClientId=MyOAuthClientId;OAuthClientSecret=myOAuthClientSecret;

    Register a New Instance of Cloud Object Storage

    If you do not already have Cloud Object Storage in your IBM Cloud account, follow the procedure below to install an instance of SQL Query in your account:

    1. Log in to your IBM Cloud account.
    2. Navigate to the page, choose a name for your instance and click Create. You will be redirected to the instance of Cloud Object Storage you just created.

    Connecting using OAuth Authentication

    There are certain connection properties you need to set before you can connect. You can obtain these as follows:

    API Key

    To connect with IBM Cloud Object Storage, you need an API Key. You can obtain this as follows:

    1. Log in to your IBM Cloud account.
    2. Navigate to the Platform API Keys page.
    3. On the middle-right corner click "Create an IBM Cloud API Key" to create a new API Key.
    4. In the pop-up window, specify the API Key name and click "Create". Note the API Key as you can never access it again from the dashboard.

    Cloud Object Storage CRN

    If you have multiple accounts, you will need to specify the CloudObjectStorageCRN explicitly. To find the appropriate value, you can:

    • Query the Services view. This will list your IBM Cloud Object Storage instances along with the CRN for each.
    • Locate the CRN directly in IBM Cloud. To do so, navigate to your IBM Cloud Dashboard. In the Resource List, Under Storage, select your Cloud Object Storage resource to get its CRN.

    Connecting to Data

    You can now set the following to connect to data:

    • InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
    • ApiKey: Set this to your API key which was noted during setup.
    • CloudObjectStorageCRN (Optional): Set this to the cloud object storage CRN you want to work with. While the connector attempts to retrieve this automatically, specifying this explicitly is recommended if you have more than Cloud Object Storage account.

    When you connect, the connector completes the OAuth process.

    1. Extracts the access token and authenticates requests.
    2. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.

  5. Click Test Connection to verify the connection values and test connectivity.

Refer to the help documentation for a description of the various properties and their functions.

Use a Send Port to Write Data to an XML File

The Static One-Way Receive Location is now ready for use with a send port: A send port must be associated with the BizTalk message that is created by the receive location. To write data to a file, create a file send port.

  1. In the BizTalk Administration console, right-click Send Ports -> New -> Static One-Way Send Port.
  2. Enter a name for the send port at the top of the configuration window and select FILE from the Type menu.

  3. Configure a destination folder; this will be the location where the files are created on disk.
  4. For the file name, a macro can be used to easily identify what day the file was created. By default, %MessageId%.xml is used. However, this is not a very user-friendly name, as it is a randomly generated BizTalk Id. To produce a file in the format Objects_yyyy-MM-dd.xml, enter Objects_%Date%.xml.

    Note: For additional information regarding macros, visit the BizTalk Configuration section in the help documentation.

  5. Click OK. The URI field should now contain a value.
  6. Click Filters in the left-hand side of the configuration screen for the send port.
  7. Set the following properties:
    Property: Select "BTS.InboundTransportLocation" from the menu.
    Operator: Select "==" from the menu.
    Value: Enter the URI of the receive location. The URI is shown in the receive location properties.

You can now use the send port to write files that have been sent from the receive location.

Enlist and Enable the Locations and Ports

The final step is to enlist the send port and enable the receive location: Right-click the send port and click Enlist. Then right-click the receive location and click Enable.

Note: Enable the receive location last: This makes sure the file gets picked up for writing by the send port.

Troubleshooting

To check if errors are occurring, expand "Event Viewer (Local)" in the navigation tree in the Administration Console. Expand Windows Logs and click Applications.

The log will include error messages for all applications on the system, so it is important to check that the source of the error message is "CData BizTalk IBM Cloud Object Storage Receive Adapter". Details of the error message should provide insight into why the error is occurring. For guidance on resolving the error, contact support@cdata.com.