Saturday, October 11, 2008

Testing Web Services - .Net WebService Studio

I am currently engaged in a project which involves integration with a 3rd party using Web Services. A colleague recommended a tool to me called ".Net WebService Studio" for testing Web Services. He was using this tool on his project and had nothing but good things to say about the tool. The tool itself is available for free on Codeplex by Adnan Masood.

Within my project, I am hosting a Web Service and the 3rd party is hosting several Web Services. So during some of my unit testing and before I exchanged WSDLs with the 3rd party I wanted to be able to submit messages to BizTalk via my Web Service. My BizTalk Web Service was generated by the "Expose Orchestration as Web Service Wizard" and is a traditional two/way, request/response service.

In the past I have built my own 'stubs' that would allow me to send in messages that satisfy my testing scenarios. This resulted in a lot of code that eventually is just thrown away. Using .Net Web Studio allows for a Proxy to be download "on the fly". So you basically point the tool at your Web Services and start submitting messages without writing any code!

The first thing you are going to want to do is launch the application and input your Web Service URL in the WSDL EndPoint dropdown. A list of recently used URLs is kept so you don't have to remember a long list of URLs.

The next thing you are going to want to do is click on the "Get" button. This will generate the Web Service Proxy for you and is required in order for you to invoke the Web Service.

You are now in a position to invoke the Web Service. The application is capable of sending some basic data to the Web Service based upon the expected data types. It works similar to the way the "Generate Instance" works when wanting to generate a sample message from a Schema in BizTalk/Visual Studio . In order to Invoke the Web Service you need to select the Operation(or Web Method) that you want to invoke and click the "Invoke" button. Once you have clicked the button, the Response of the Web Service will be displayed in the "Output" text box in the lower left corner.

From this screen you can also modify the "default" values that Web Service Studio is going to use by clicking on an element and then updating the value in the top right "quadrant".

By clicking on the "Request/Response" button, you are able to see, and modify, the actual SOAP request that is being sent to the Web Service and the SOAP Response that is being returned to your client.

This screen also allows you to tweak your SOAP request in case you have some additional security, content type or Proxy requirements.

Overall I think the tool is great and definitely a worth having in your "toolbox".

No comments: