ss » s Home ss » s Online TV ss » . Technology ss » s Blog

Saturday, 11 April 2009

WCF Client overview



WCF Client Overview

This section describes what client applications do, how to configure, create, and use a Windows Communication Foundation (WCF) client, and how to secure client applications.

Using WCF Client Objects
A client application is a managed application that uses a WCF client to communicate with another application. To create a client application for a WCF service, the following steps are required.

Obtain the service contract, binding, and address information for a service endpoint.

Create a WCF client using that information.

Call operations.

Close the WCF client object.

The following sections discuss these steps as well as provide brief introductions to the following issues:

Handling errors

Configuring and securing clients

Creating callback objects for duplex services

Calling services asynchronously

Calling services using client channels

Obtain the Service Contract, Bindings, and Addresses
In WCF services and clients model contracts using managed attributes, interfaces, and methods. To connect to a service in a client application, then, you need to obtain the type information for the service contract. Typically, you do this by using the ServiceModel Metadata Utility Tool (Svcutil.exe), which downloads metadata from the service, converts it to a managed source code file in the language of your choice, and creates a client application configuration file that you can use to configure your WCF client object. For example, if you are going to create an WCF client object to invoke a MyCalculatorService and you know that the metadata for that service is published at http://computerName/MyCalculatorService/Service.svc?wsdl then the following code example shows how to use Svcutil.exe to obtain a ClientCode.vb file that contains the service contract in managed code

No comments:

Post a Comment