简体   繁体   中英

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM