Export (0) Print
Expand All

Developing Applications by Using the WCF Service Model

At the lowest level, the Windows Communication Foundation (WCF) presents a programming model in which clients invoke operations on a service by exchanging SOAP messages over a channel established between client and service endpoints. This model, known as the WCF channel model, exposes data types and methods that enable you to operate directly on the WCF channel architecture. The WCF channel model provides you with direct control over the contents of the SOAP messages you create and over the way both your application and the Oracle Database adapter consume them; however, creating well-formed SOAP messages to send over a channel and validating the reply messages returned can be a detailed and exacting task.

For this reason, WCF provides another programming model called the WCF service model. The WCF service model involves the use of proxy classes to invoke operations on a target service or to receive operations from a client.

  • The proxy class used to invoke operations on a target service is called a WCF client class. This class models the operations exposed by a service as .NET methods with strongly-typed parameters. By using the WCF service model, you can invoke the operations exposed by the Oracle Database adapter as .NET methods on the WCF client. For more information about WCF clients, see "WCF Client Overview" at http://go.microsoft.com/fwlink/?LinkId=91458.

  • In the WCF service model, the service contract exposed by a service is represented by an interface. This managed code representation of the service contract is called a WCF service contract. The WCF service contract models operations as methods with strongly-typed parameters. To receive an operation from a client you implement a class, the WCF service, from this interface. You can then host an instance of this class in a System.ServiceModel.ServiceHost to enable a client to invoke the operation on your code. By using the WCF service model and a WCF service contract targeted to the POLLINGSTMT operation, you can receive the results of a polling operation on the Oracle database using Oracle Database adapter.

You use tools to generate a WCF client class or a WCF service contract and associated helper code from the service metadata that the Oracle Database adapter exposes. You can use either of the following tools:

  • The ServiceModel Metadata Utility Tool (svcutil.exe), which ships with WCF

  • The Add Adapter Service Reference Visual Studio Plug-in, which ships with the Oracle Database adapter

The Add Adapter Service Reference Plug-in is integrated with the Visual Studio design experience and presents a standard Microsoft Windows interface that provides powerful browsing and searching capabilities on operations exposed by the adapter. For more information about how to generate a WCF client or a WCF service contract, see Generating a WCF Client or a WCF Service Contract for Oracle Database Artifacts.

Because it presents a model that is familiar to .NET programmers and that hides the underlying complexities of SOAP message exchange over a channel, the WCF service model is often the best choice to develop programming solutions for the Oracle Database adapter. However, there are scenarios in which the WCF channel model might be a better choice. For example, the WCF service model only supports streaming for the ReadLOB operation. This is because serializing and de-serializing between the XML representation of objects in a SOAP message and the .NET types used to represent them in the service model involves reading the entire message into memory. (The result of a ReadLOB operation is an exception to this rule.)

The WCF channel model provides support for XML node-level streaming on all operations and data-level streaming on the ReadLOB and UpdateLOB operations. If you are dealing with queries that return large result sets or are attempting to update an LOB field in a table, the WCF channel model might be a better choice. For more information about using the WCF channel model, see Developing Applications by Using the WCF Channel Model.

The topics in this section contain information, procedures, and examples to help you create and use the WCF service model to develop applications by using the Oracle Database adapter.

Show:
© 2014 Microsoft