Title: Is there a testing tool to test a C# .net web service that contains complex types?
Tags: c#;.net;web-services;testing
Question: I have built a C# .net web service that takes a complex type as a parameter.  Is there a testing tool that I can run against my web service and pass all of the values to the complex parameter type?

Some background info:
I ran the xsd.exe tool against my XSD and have created a .cs class.  This .cs class has the dataset that is used as my complex parameter.  Now I need to test out my webmethod and pass values to it as the client would.  I have tried WebService Studio and Storm, but it seems that neither of the products can handle complex types.  Is there any other product that can do this?  Or do I have write my own test application from scratch?


Here is the accepted answer: soapUI will help you do this.

However, the way I usually do it is to write automated unit tests using NUNIT or MSTEST, add a Service Reference and then just write the tests. This has the additional benefit that you are creating the same kind of client code your users will need to do. If your service is hard to use, then you'll find out pretty quick.


Here is another answer: For classic ASMX services, I used Web Service Studio 2.0 which handled every complex type I wagnerelaine@example.com.  You can get the classic version (2.0) from http://archive.msdn.microsoft.com/webservicestudio20/.

I know there is an updated version on codeplex that you linked to and it looks like it's been updated to support complex types.  (A while back there was a useless tool on codeplex that couldn't do complex types.)  

Just curious what specific issue you are having with Web Service Studio? 

UPDATE: After re-reading your question, it sounds like you are using a DataSet in your service.  If so, then you are going to have interoperability problems consuming that service from most toolkits; they can't handle the DataSet because it is a "dynamic" type.  The easiest way around that issue is to avoid DataSets.

If that is the case, then I agree with others that you will need to create your own .NET application that can consume your service.

Comment for this answer: Whenever I have the complex type (i.e. dataset) as a parameter value of my webmethod, when WebServiceStudio compiles the Proxy it throws this error, "error CS0260: Missing partial modifier on declaration of type 'ItemList'; another partial declaration of this type exists".  If I remove the complex parameter, the error goes away and webservicestudio works correctly.

Here is another answer: For simple cases you can use WCF Test Client (WcfTestClient.exe) introduced in Visual Studio 2008. Find more on http://msdn.microsoft.com/en-us/library/bb552364.aspx

SoapUI is good for more complex cases.


Here is another answer: I would test it by using Visual Studio with a Windows Form referencing your web service. In this Windows Form you can use NUnit, Fit or anything you normally use to test your application. If you run both your Web Service and Windows Form in debug you can walk through the code to see the results.

This is the method I use, I've never really heard of another way within .net Web Services with custom types.


Here is another answer: Isn't it just as easy to grab a copy of Visual Studio Express (if you don't have the full version) and create a windows application, add a webreference and test it?

Should take you less time, than me reading this question ;)
(and no I'm not a slow reader)

Comment for this answer: I can say that I often need to test these things on a Customer's carefully controlled server where I'm logged into a Citrix Server over a dodgy VPN connection. Installing Visual Studio is not feasable. Copying over a generic tiny portable .Net app is. That's where Web Service Studio comes in handy.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 5, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 2.5', 'CreationDate': '2009:00:08/17/09', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<c#><.net><web-services><testing>', 'Title': 'Is there a testing tool to test a C# .net web service that contains complex types?', 'ViewCount': 14429, 'id': 1289713, 'user_AboutMe': '<p>Software Architect</p>\n', 'user_AccountId': 19948.0, 'user_DisplayName': 'Jon', 'user_Reputation': 1971.0, 'user_Views': 172.0, 'user_id': 47191.0}}