Thursday, 5 April 2007

Testing ASP.NET SOAP Web Services

I've been developing some ASP.NET SOAP services for exposing some application logic to an associated application being developed by a colleague using Flash and Flash Media Server.

To test the SOAP calls before deploying the services ready to be consumed by Flash, I needed to test the output from the services under certain conditions.

When running the ASP.NET site from Visual Studio 2005, you can invoke the SOAP call from the browser. This is fine for testing service operations that don't take any parameters, or parameters that primitive types (like strings and integers). If the operation takes a complex type like an instance of a class you've written or complex .NET type like System.Guid - they you can't invoke them this way.

You could write a consumer application for web methods that can't be executed from the browser, but that means there's more code to write - and I'd rather see the service working outside of .NET to assure me that it will do the job for the Flash and Flash Comms Server parts of the application.

soapUI is a free and open source java based SOAP tester that allows you to prod and poke a web service with relative ease. Its available as a standalone java app, or as a plug-in to popular tools like Eclipse. I downloaded and installed the java installer from soapUI SourceForge Project.

To test the service you just need to point soapUI to the WSDL description for the service you want to test. ASP.NET generates that document for you so the URL looks something like http://myServer/myService.asmx?wsdl. soapUI then uses the WSDL to give you a template for a SOAP request where you can fill in the data values you want to test with.






After that's done, hit the Submit option and the response from the service is displayed in the right hand pane. It's complete with the SOAP headers and the data that's been returned. If there's an exception thrown by the service call, then the exception will be displayed instead.









Later on I'll need to set up some unit tests and regression tests for the services, but soapUI is a great tool for doing the ad-hoc testing I need at the moment.

5 comments:

Nik G said...

Just been playing with this to get soap envelopes for Flex. It works really well.

Couldn't get the Eclipse plugin version to work unfortunately.

Anonymous said...

For those who are looking for a similar .NET tool check out http://codeplex.com/storm

rxraza said...

Can we test a WCF web service with it?

RDLUNT said...

You guy are the best. Spent hours working within .Net and this blog worked wonders.

Thanks a millino

jg_taveras said...

thks to the guy that suggest stom, really works well for me, soapUI keeps throwing errors at me so dont XD great blogg !!!