Export (0) Print
Expand All

Generating a WCF Client or a WCF Service Contract for Oracle Database Artifacts

You can use the Add Adapter Service Reference Visual Studio Plug-in to generate a WCF client class or a WCF service contract (interface) targeted at selected operations on Oracle database artifacts. You can also use the ServiceModel Metadata Utility Tool (svcutil.exe) to generate the WCF client class or WCF service contract; however, the Add Adapter Service Reference Plug-in exposes the functionality of the ServiceModel Metadata Utility Tool through a standard Microsoft Windows interface. It also provides browse and search capabilities that are not available with the svcutil.exe tool, and it generates a configuration file based on the binding properties that you select when you connect to the Oracle database.

Generating a Client Class by Using the Add Adapter Service Reference Plug-in

Perform the following steps to generate a WCF client class by using the Add Adapter Service Reference Plug-in.

To generate a WCF client class

  1. In Visual Studio Solution Explorer, right-click your project, and then click Add Adapter Service Reference.

  2. After the Add Adapter Service Reference dialog box opens, follow the steps in Retrieving Metadata for Oracle Operations in Visual Studio to connect to the Oracle database and browse and search for operations. To create a WCF client class for the operations that you select, be sure that Client (Outbound operations) is selected from the Select contract type drop-down list (this is the default).

  3. After you select all of the operations that you want to target, click OK to generate the WCF client class.

The Add Adapter Service Reference Plug-in adds two files to your project:

  • OracleDBBindingClient.cs. This file contains the generated WCF client class and helper code for the operations that you selected.

  • App.config. This file contains a binding configuration and client endpoint configurations. These configurations are based on the selections you made when you configured the binding and connection for the Add Adapter Service Reference Plug-in.

    ImportantImportant
    While using the Add Adapter Service Reference Visual Studio Plug-in, if you do not specify a value for a binding property of type string and whose default value is null then that binding property will not be available in the app.config file. You must manually add the binding property and its value in the app.config file, if required.

Generating a WCF Service Contract by Using the Add Adapter Service Reference Plug-in

The adapter exposes inbound operations to enable Oracle database to send messages to an adapter client. For such operations you must generate a WCF service contract. For example, the adapter exposes an inbound POLLINGSTMT operation to poll the Oracle database. The Oracle Database adapter executes the query specified by the PollingStatement binding property and sends the result set to the consuming application in a POLLINGSTMT message. In this scenario, the consuming application acts as a service and the Oracle Database adapter acts as the client. You must, therefore, implement a WCF service that can receive the POLLINGSTMT operation from the adapter. To do this, you use the Add Adapter Service Reference Plug-in to generate a .NET interface that represents the service contract that is surfaced by the adapter for the POLLINGSTMT operation. This .NET interface is also called a WCF service contract. You then implement this interface to create the WCF service that you can use to receive the POLLINGSTMT operation.

This section provides information on how to generate a WCF service contract using the Add Adapter Service Reference Plug-in for inbound operations exposed by the adapter.

To generate a WCF service contract for inbound operations

  1. In Visual Studio Solution Explorer, right-click your project, and then click Add Adapter Service Reference.

  2. After the Add Adapter Service Reference dialog box opens, follow the steps in Retrieving Metadata for Oracle Operations in Visual Studio to connect to the Oracle database. There are several binding properties and a URI property that you may want to set when you connect to the Oracle database for inbound operations. For example, for the inbound polling operation (POLLINGSTMT), you must specify the PollingStatement binding property when you configure the connection to the Oracle database. The Oracle Database adapter uses the SQL SELECT statement specified in this property to generate the class that represents the result set returned by the POLLINGSTMT operation.

  3. After you have connected to the Oracle database, select Service (Inbound operations) from the Select contract type drop-down list.

  4. In the Select a category box, click the root node (/), and browse to the operation for which you want to generate the service contract. For example, for the polling operation, select POLLINGSTMT from the Available categories and operations box, and then click Add.

  5. To generate the WCF service contract for the POLLINGSTMT operation, click OK.

The Add Adapter Service Reference Plug-in adds three files to your project:

  • OracleDBBindingInterface.cs. This file contains the generated WCF service contract (interface) and helper code for the POLLINGSTMT operation.

  • OracleDBBindingService.cs. This file contains a class that implements the interface defined in OracleDBBindingInterface.cs. You can implement the business logic that processes the records returned by the polling query in the POLLINGSTMT method in this class.

  • App.config. This file contains a binding configuration, endpoint behaviors, and service endpoint configuration that are based on the selections you made when you configured the binding and connection for the Add Adapter Service Reference Plug-in.

    ImportantImportant
    While using the Add Adapter Service Reference Visual Studio Plug-in, if you do not specify a value for a binding property of type string and whose default value is null then that binding property will not be available in the app.config file. You must manually add the binding property and its value in the app.config file, if required.

Using svcutil.exe to Generate a WCF Client Class or a WCF Service Contract

You can use svcutil.exe to generate a WCF client class or a WCF service interface for your application. You must configure svcutil.exe to use it with the Oracle Database adapter. For more information about configuring and using svcutil.exe with the Oracle Database adapter, see Using the ServiceModel Metadata Utility Tool with the BizTalk Adapter for Oracle Database.

Svcutil.exe generates the WCF client class or WCF service contract in an output file. The default file name is output.cs. You must manually include this file in your Visual Studio project.

See Also

© 2014 Microsoft Corporation. All rights reserved.
Show:
© 2014 Microsoft