Adding Web Service Requests- In our Test Plan, we will use a .NET web service. Since you’re using the web service sampler, we won’t go into the details of writing a web service. If you don’t know how to write a web service, Google for web service and familiarize yourself with writing web services for Java and .NET. It should be noted there is a significant difference between how .NET and Java implement web services. The topic is too broad to cover in the user manual. Please refer to other sources to get a better idea of the differences.
JMeter sends requests in the order that they appear in the tree.
Start by adding the sampler WebService(SOAP) Request to the Jakarta Users element (Add –> Sampler –> WebService(SOAP) Request). Then, select the web service Request element in the tree and edit the following properties (see Figure 10.5):
- Change the Name field to “WebService(SOAP) Request”.
- Enter the WSDL URL and click “Load WSDL”.
If the WSDL file was loaded correctly, the “Web Methods” drop-down should be populated. If the drop down remains blank, it means there was a problem getting the WSDL. You can test the WSDL using a browser that reads XML. For example, if you’re testing an IIS web service the URL will look like this: http://localhost/myWebService/Service.asmx?WSDL. At this point, SOAPAction, URL and SOAP Data should be blank.
Next, select the web method and click “Configure”. The sampler should populate the “URL” and “SOAPAction” text fields. Assuming the WSDL is valid, the correct soap action should be entered.
The last step is to paste the SOAP message in the “SOAP/XML-RPC Data” text area. You can optionally save the soap message to a file and browse to the location. For convenience, there is a third option of using a message folder. The sampler will randomly select files from a given folder and use the text for the soap message.
If you do not want JMeter to read the response from the SOAP Web service, uncheck “Read Soap Responses.” If the test plan is intended to stress test a web service, the box should be unchecked. If the test plan is a functional test, the box should be checked. When “Read Soap Responses” is unchecked, no result will be displayed in view result tree or view results in table.
An important note on the sampler. It will automatically use the proxy host and port passed to JMeter from command line, if those fields in the sampler are left blank. If a sampler has values in the proxy host and port text field, it will use the ones provided by the user. If no host or port are provided and JMeter wasn’t started with command-line options, the sampler will fail silently. This behavior may not be what users expect.
Note: If you’re using Cassini web server, it does not work correctly and is not a reliable web server. Cassini is meant to be a simple example and isn’t a full-blown web server like IIS. Cassini does not close connections correctly, which causes JMeter to hang or not get the response contents.
Currently, only .NET uses SOAPAction, so it is normal to have a blank SOAPAction for all other web services. The list includes JWSDP, Weblogic, Axis, The Mind Electric Glue, and gSoap.
Test Your Software Testing Skills By Taking Our JMeter Practice Tests On This Link
Become Vskills Certified JMeter Tester. Gain knowledge on the module “Adding Web Service Requests”. Try the free practice test!
Apply For JMeter Certification