Freigeben über


Using the WCFTestClient Tool to Test Service Operations

Hello

In case you didn't know, Visual Studio ships a handy tool called WCFTestClient.exe that you should try. It's a great tool for discovering and testing WSDL operations without writing any code. You can view the request and response messages in a formatted view or in XML. For details, see WCF Test Client (WcfTestClient.exe). There is one catch… it is available only with Visual Studio 2008 SP1.

If you use the default Visual Studio install folder, you can find the tool in the C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ folder.

clip_image001

After starting the WCF Test Client tool, click File->Add Service, and enter the endpoint address of the service you want to open. For a list of adCenter sandbox addresses, see Microsoft adCenter Web Services Addresses (when you play with this tool, make sure that you use the sandbox addresses and not the production addresses).

The left pane of the WCF Test Client main window lists all the available services, along with their respective endpoints and operations.

When you double-click on an operation in the left pane, the operation is opened in the right pane. The operation's tab shows the request and response properties in either a Formatted or XML view. When you click Formatted, you can enter arbitrary values for the properties to test the service. To send the request to the service, click Invoke.

There is one trick that is not documented or obvious when working with arrays. To specify an array in your request, enter length=n in the Value column, where n is the number of elements that you want in the array. You can then expand the list (click the + sign) to add the values of the array elements.

The following snippets show the progression.

image

image

image

 

 

image

image

 

Thanks and enjoy!

Comments

  • Anonymous
    March 30, 2010
    Thanks, I needed this information today!
  • Anonymous
    August 19, 2010
    Hi ,Can anyone tell me as how to paste an xml file from an external file ?
  • Anonymous
    September 02, 2010
    Tnx for the array parameter trick
  • Anonymous
    December 27, 2010
    Thanks a lot.
  • Anonymous
    January 03, 2011
    Thanks so much for this info! I always had to set up a client programmatically  in order to be able to test my service.Thanks again
  • Anonymous
    May 16, 2011
    This was exactly what I needed, thank you for posting this.
  • Anonymous
    February 08, 2012
    Such a coicidence, i am from the same team as you and reached here from Bing. Thanks for the array tip.
  • Anonymous
    July 02, 2013
    Thank you, Appreciate your great help. Saved tons of time. This is what i exactly looking for. It is easy, but tricky.
  • Anonymous
    July 17, 2013
    Thank you very much for the tip
  • Anonymous
    August 12, 2013
    Not user friendly Tool. Found finally some answer for this tricky issue. Thanks Again.
  • Anonymous
    October 06, 2013
    Thanks scott, Appreciate you great help
  • Anonymous
    January 14, 2014
    Good info on array parameter trick. In 2012, still no documentation on that
  • Anonymous
    September 02, 2015
    Great info! Could you point me how you are defining the Ads list (or any multilevel part of a request object)? My WCF test client is not showing my list property inside my request object at all.