WCF Service Testing:
A challenge for a WCF service developer is to know whether the service developed by him is interoperable with other applications made in different technologies. Often People will write sample windows applications to check whether WCF service else we tend to use dynamic Web service invocation tools which can put up a request to a WCF service and show you the result set. One such tool is SOAP UI.
I had a requirement where my WCF service should communicate with Java clients. Once the WCF service was hosted the java team was facing lot of issues in communication with the service and the issue was not debuggable as the team doesn’t sit in Bangalore and I have no clue what java is . I developed a sample windows client which was communication with the WCF service and fetching desired results. Then came SOAP UI to my rescue. It’s an awesome tool to test any web service.
The actual issue was with the windows Identity, the service was hosted in IIS with widows authentication and the Java team couldn’t get their client get authenticated properly. The windows application was working as Impersonation of the Windows ID was taken care by dotnet framework. However SOAP UI was a perfect test suite for us which we used to Test the WCF service.
Where can you Get SOAP UI:
It’s an open source tool. You can get it downloaded from here. http://www.soapui.org/
How to Use SOAP UI:
Install SOAP UI and navigate to the installed folder. Click “soapui.bat” inside bin folder of your installation path. Press Ctrl+N for a new project and add your Project name and the WSDL URL of your service. Make sure you select an option to create sample requests for each of your methods. The screen will look like this.
 Once the project is created from the WSDL sample requests are created as shown in the screen below. Here GetData and GetDataUsingDataContract are the method exposed and Request1 beneath them are the sample requests for those methods.
Click on Request1 under the public method it will show you the SOAP request in a XML format. A sample is shown below.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<tem:value>?</tem:value>is the parameter we intend to send here. Change the symbol “?” with desired value and click on the Green Colored Submit Request button. You SOAP reqponse will be shown on the right hand side.
On the bottom of Request Panel there are options to add authentication details (domain,username and password.) as well as there is an option for us to attach some data to the header. It could be a file as well.