Export (0) Print
Expand All

How to Create a .NET Application to Test a WCF Service Published with the BizTalk WCF Service Publishing Wizard

To test your published WCF service, you can create a .NET application that consumes your published WCF service. This topic describes how to create a .NET application to test a published WCF service.

The Visual Studio Help Collection contains a valuable walkthrough for creating a .NET application that consumes WCF services. You can use the walkthrough to test your published WCF service. For information and procedures about creating a WCF client project, see "Walkthrough: Accessing an XML Web Service Using Visual Basic or Visual C#" in the Visual Studio Help Collection at http://go.microsoft.com/fwlink/?LinkId=62263.

This topic uses the Service Model Metadata Utility tool (SvcUtil.exe) to create the WCF proxy classes and application configuration file. SvcUtil.exe is included in the Microsoft Windows Software Development Kit (SDK) of Windows Vista and .NET Framework Runtime Components.

To create a simple WCF proxy class and application configuration file

  1. Open CMD Shell as follows: click Start, point to All Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  2. In CMD Shell, go to the directory where you want to place the proxy class and application configuration file.

  3. In CMD Shell, run the ServiceModel Metadata Utility Tool (SvcUtil.exe) to create the WCF proxy class and application configuration file for the published WCF service as follows:

    svcutil <http://servername/apppath/wcfservicename.svc> /config:App.config
    This command line generates BizTalkServiceInstance.cs for the proxy class and App.config for the application configuration. For more information about Svcutil.exe, see "Service Model Metadata Utility Tool (Svcutil.exe)" at http://go.microsoft.com/fwlink/?LinkId=74696.

To compile your .NET application that consumes the published WCF service

  1. In Visual Studio Solution Explorer, add the files that SvcUtil.exe creates, BizTalkServiceInstance and App.config, to your project.

  2. In Visual Studio Solution Explorer, make sure to add a reference to the System.ServiceModel.dll to compile the proxy code.

  3. Create the code to use the generated proxy code. The following code shows how to use the generated proxy:

    DeliveryNotification deliveryNotification= new DeliveryNotification();
    deliveryNotification.TrackingNumber = "001";
                Microsoft_Samples_BizTalk_WCFBasicHttp_BizTalkApp_DliveryRequestProcess_DeliveryNotificatonReceivePortClient service = new Microsoft_Samples_BizTalk_WCFBasicHttp_BizTalkApp_DliveryRequestProcess_DeliveryNotificatonReceivePortClient("BasicHttpBinding_ITwoWayAsyncVoid");
  4. Run your .NET application to send messages to the published WCF service.

See Also

© 2010 Microsoft Corporation. All rights reserved.

Community Additions

© 2015 Microsoft