O'Reilly logo

Professional Visual Basic 2012 and .NET 4.5 Programming by Todd Herman, Gastón Hillar, David McCarter, Rob Windsor, Billy Hollis, Bill Sheldon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a WCF Consumer

Now that a TCP service is out there, which you built using the WCF framework, the next step is to build a consumer application that uses the simple Calculator service. The consumer sends its request via TCP using SOAP. Using TCP means that the consumption can actually occur with a binary encoding of the SOAP message on the wire, substantially decreasing the size of the payload being transmitted.

This section describes how to consume this service. You have two options at this point: You can open a second instance of Visual Studio and create a new WPF Application project to reference your service or you can add a new WPF Application project to your current solution. For simplicity, this example uses the latter.

The only difference in terms of what is needed occurs as part of adding a reference to the service. If you create your application in a new solution, then in order to add the reference you'll need to have a copy of the service running. To that end, after you add a new project to your current called ProVB_WCFCalculatorClient you can start the add reference process by adding a reference to the service project in the shared solution.

Adding a Service Reference

Right-click on the project name in the Solution Explorer and select Add Service Reference from the dialogue. After selecting Add Service Reference, you are presented with the dialogue shown in Figure 11.8. The selections you make within this dialogue, and to some extent what you'll get at the other ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required