Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test a WCF Webservice with JMeter?

I have a WCF Webservice hosted on IIS which exposes a single method that takes three integer parameters. I have a simple, console based client which can call this method.

int InsertNewOrder(short quantity, int custID, int productID);

If my understanding is correct, I need to provide JMeter a SOAP envelope with the details of the method to be called and parameters to be passed. I have seen many examples similar to below:

<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/">; 
<soapenv:Body>
<ns2:InsertNewOrder xmlns:ns2="?????"> 
<ns2:Param1>${1}</ns2:Param1> 
<ns2:Param1>${1}</ns2:Param1> 
<ns2:Param1>${1}</ns2:Param1> 
</ns2:InsertNewOrder>  
</soapenv:Body>
</soapenv:Envelope>

However, from looking at my WSDL doc, I don't see where it refers to any of the parameters needed to pass to the method. I've also used Fiddler to examine the client's soap messages to the service. Again, I don't see where it's passing the parameters. As a result, I don't know how to create a simple SOAP envelope I can use with JMeter to test this service.

Can anyone advise as to why the WSDL doc does not provide any details of the method parameters, or explain how I can create the necessary SOAP envelope for use with JMeter?

I am coding in C# using VS 2010, JMeter 2.4, IIS v6, wsHttpBinding.

like image 244
JMc Avatar asked Apr 27 '11 12:04

JMc


2 Answers

Disclaimer: I'm not a WSDL expert, so i can't tell you why the doc doesn't provide detail.

To generate the SOAP envelope for JMeter, I've used the free version of soapUI.

Steps

  1. Import WSDL into soap
  2. Create a default request for the method
  3. Set the request view to RAW, and copy into JMeter

This provides me all the information I need for jmeter, including parameters, user-agent, endpoint, etc.

like image 110
BlackGaff Avatar answered Oct 22 '22 21:10

BlackGaff


Use JMeter's "HTTP Proxy Server" to record the WCF calls with your normal testclient, and then play them back later when testing. This is what I have experienced to be fastest, and gives the best test-cases (because you record them with your normal client, or test client of choice).

Set up JMeters HTTP Proxy Server as per instructions. Then, make sure the WCF (or any SOAP) client use that proxy. The important part of the WCF client configuation is (replace my ... with normal config):

<system.serviceModel>
    <bindings>
    ...
    <wsHttpBinding>
    <binding ...  proxyAddress="http://proxyServerName:8080" useDefaultWebProxy="false" ...>
    ...
        <security mode="None">
            <message establishSecurityContext="false"/>
            <transport clientCredentialType="None"/>
        </security>

proxyServerName is localhost, if the WCF client runs on the same machine as JMeter (normal when creating the test cases).

Also, I got an error message using HTTP Proxy, if I did not turn off security as shown above. The same security settings must also be at the WCF service server.

Happy testing! :-)

like image 30
Eirik W Avatar answered Oct 22 '22 19:10

Eirik W