How to test a WCF Webservice with JMeter?

10,462

Solution 1

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.

Solution 2

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! :-)

Share:
10,462
JMc
Author by

JMc

Updated on June 08, 2022

Comments

  • JMc
    JMc almost 2 years

    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.

  • JMc
    JMc about 13 years
    Thanks a mil. That gives me exactly what I need. It also displays the WSDL in a different manner to when I view the raw XML. I can see the parameters etc now.
  • dinhlam
    dinhlam about 13 years
    Glad I could help. I've found it to be a huge time saver.
  • JMc
    JMc about 13 years
    Actually. from playing around with SoapUI, I see it also performs load testing (which is essentially what I want to do). Do you find one tool better than the other for this? I had intended to use JMeter having not heard of SoapUI previously.
  • dinhlam
    dinhlam about 13 years
    I wasn't a huge fan of SoapUI's load testing tools (they have both loadUI and a performance tester within SoapUI). I found them more difficult to customize then JMeter.
  • sarwar026
    sarwar026 about 10 years
    @BlackGaff: What I see in RAW request view is not the soap:envelope tag instead it is GET http: .... What can I do? please help.