The (Unofficial) ITWorx Technical Architecture Blog

Testing Webservices with NUnit

Posted by archworx on July 1, 2007

Because NUnit is an exe and you sometimes you need to access web.config and objects that are only present in a web context, you will need to do the following:

– Open the command prompt and cd to C:\Program Files\Microsoft Visual Studio 8\VC, or in Visual Studio 2005 Command Prompt, type wsdl url (where url is the WSDL URL). A C# file will be generated with the name of the webservice. You can add some command line arguments to change the file name or the language. Just type wsdl without any arguments to show the help.

– Move the file to your test project and use it. It will call the webservice 🙂

There’s a great article about Implementing Service-Oriented Integration with ASP.NET .. check it out.


4 Responses to “Testing Webservices with NUnit”

  1. Ed Jones said

    Very Nice. Works like a charm.

  2. Ken T. said

    thanks for the tip! My problem is that my web services website always reports an error on the certificate. This is something I can get around inside code, but wsdl.exe seems to have a problem with it and it does not work under those conditions. I tried finding a parameter to feed wsdl to ignore certificate errors but I don’t think one exists.

    If anyone figures this one out, let me know!

  3. Alberto said

    Great! It worked! Thanks!

  4. emi/emc said


    […]Testing Webservices with NUnit « TechnicalArchitectureWorx[…]…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: