In our Test Plan, we will use a .NET webservice. Since you're using
the webservice sampler, we won't go into the details of writing a
webservice. If you don't know how to write a webservice, google for
webservice and familiarize yourself with writing webservices for
Java and .NET. It should be noted there is a significant difference
between how .NET and Java implement webservices. 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 webservice 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".
Figure 10.3. Webservice Request
|
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 webservice 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 convienance, 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 Webservice,
uncheck "Read Soap Responses." If the test plan is intended to stress test
a webservice, 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 webserver, it does not work correctly and is not a reliable webserver. Cassini is meant to be a simple example and isn't a full blown webserver 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 webservices. The list includes JWSDP, Weblogic, Axis, The Mind Electric Glue, and gSoap.