Creating a typed service client

WCF services can be consumed by a client through various means. If our client application is also built upon .NET Framework 3.x or above, the most common and convenient way of consuming the WCF service is by using a typed service proxy class. This recipe will show you how to create a typed service proxy through WCF service metadata.

How to do it...

We will go through the typed service proxy generation steps via a simple WCF service that is hosted at the address http://localhost:29671/service1.svc.

Following are the detailed steps:

  1. Get the WSDL metadata of the targeting service.

    For our sample service, we can directly get the service metadata at the SVC endpoint file (from the previous address).

  2. Locate the service metadata ...

Get Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.