views:

259

answers:

5

I'm going to use C# to read data from a few webservices. I've done that many times before, but those times I've had direct access to the webservices from my development machine.

In this project I've just been sent a .wsdl file, and a couple of .xsd files for the webservice they have in their local intranet.

I've seen that I can use "Add Web Reference", and point directly to the .wsdl file, so that a C# class is created.

But how can I really test it? I'd like to return some dummy data that I can visualize while I develop. Any tips for this situation?

+2  A: 

Google helps: Mock Webservice

Henrik
Nice. Thanks for that link.
Brian
Its perfactly ok to ask here without googling. This thread should be the first hit when someone google!
Carl Bergquist
No objection to that. This was no critique, just an info where the link came from.
Henrik
+1  A: 

You can also try SOAP UI for mocking up service with ease. (Free web service testing tool)

Check:

http://www.soapui.org/gettingstarted/mocking.html

shivaspk
A: 

It is easy to create your own server side stub. Assuming you want to do it with WCF, then go here. You can then add some basic logic to get your client working.

You can also use the legacy Web Service functionality via the WSDL tool's /Server option, though I recommend you use WCF.

RichardOD
+1  A: 

The svcutil.exe tool bundled with the Windows SDK (found at C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin) is a nice command line tool that generates WCF client proxies. I've found this to be a good way to interrogate a WSDL. It'll create an interface for the service and then a proxy class that implements that interface. You can then mock up something else that implements that interface to facilitate testing.

Travis Heseman
A: 

You may also want to try a product like "Fiddler" (http://www.fiddler2.com)

It allows you to capture HTTP (or HTTPS) packets and send a fake automated reply file back as if the server had sent the response. I use it for my project and it works wonders when the test server goes offline (which is often). I take an old response packet, save it as a text file, then send it back again and the application I'm building has no idea it didn't come from the actual host.

Jerry