I’ve always write a lot C# code to do some simple WCF testing. Until I find SoapUI, one Powerful wsdl stack test tool. It has the free Version which covers pretty all the test features I need. Let me show you a quick Tutorial.
SOAPUI is based ON http protocol mostly. so you might need to add one basicHttpBinding to you configuration. then we can enable the test on the http transport channel.
Given a very basic Service.
when run the host application, you should be able to access the WSDL.
SoapUI is based on Standard JAVA and javafx, so make sure you have the jdk ready . if javafx is not there, the installer will access internet and download the bits for you.
Run the soapui Utility.
Right click the project, Add one New project , you may specify a meaningful name. you don't have to specify the initial wsdl , we will add it later on.
Right Click the new created Project , and chose Add WSDL
Enter or Browse the WSDL url, I will put http://localhost:22276/Service1.svc?wsdl here. Click OK. Then you will see the Operation get listed in the project panel.
Double Click the Request 1 under GetData. the SOAP request template has been generated for you, replace the ? with you value. and Click green Arrow button to submit the request.
Is it sweet? I think so.
Click the raw Tab. you can see the raw data there. there are some buttons that enable you to change the URL, Add customized Header. etc. (if you use the professional version. you will get more features like json view of the data.)
Further more, you can add it as a test case. Click the + button in the toolbar
then you can click the run the test .
also you can add more success criteria by click the add assertion button.
So here is all about SOAP. if you want to see the raw Http traffic, you can use the TCpTrace, also it’s free.
basically, change you service client to point a New port that TCPtrace is listening on, and TCPtrace will forward the request to the Service Port.
Please note. for those wsHttpBinding. you may have to Add one service behavior that allow server to process the request that has a different port(endpoint action), AddressFilterMode
Also for the WCF client, you may just put one ClientViaBehavior to the endpoint, the client runtime will do the forwarding for you.
more related articles.