Develop SAP applications 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 SAP 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 SAP adapter as .NET methods on the WCF client. For more information about WCF clients, see WCF Client Overview.
The proxy class used to receive an operation from a client is called a WCF service contract class. This class models an operation exposed by your code as a callback method with strongly-typed parameters. 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 class targeted to the POLLINGSTMT operation, you can receive the results of a polling query from the SAP 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 SAP 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 SAP 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 class, see Generating a WCF Client or a WCF Service Contract for SAP solution 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 SAP adapter. However, there are scenarios in which the WCF channel model might be a better choice; particularly in scenarios in which streaming is important. 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. For more information about using the WCF channel model, see Develop SAP applications 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 SAP adapter.