SOAP requests

NeoLoad's optional SOAP module can be used to load test Web services using the SOAP protocol.

There are two ways of using this NeoLoad module:

Creating a SOAP request

This section describes how to create a SOAP request from the ground up. To record a request using an existing client, see the next section

Procedure 6.3. Creating a SOAP request in a virtual user

  1. In the "Design" section, click on the "Virtual Users" tab.

  2. In the virtual user, container or page's pop-up menu, select "Insert as child / SOAP Request".

  3. Follow the wizard to select the parameter editing mode:

    1. Create a SOAP request using a WSDL description file:

      1. Enter the URL containing the WSDL. Use the file browse button to select a file on the hard drive, or enter a web server URL, for example: http://myserver/app/myservice?WSDL.

      2. In the drop-down list, select the method (or operation) to be tested.

      3. Choose a pertinent name for the SOAP request.

      4. Enter the URL of the web service ("Endpoint"). The URL defined in the WSDL is displayed by default.

    2. Create a SOAP request by manually editing an XML request.

      1. Choose a pertinent name for the SOAP request.

      2. Enter the URL of the web service ("Endpoint").

Recording a SOAP request

This section describes how to record the interaction between an existing SOAP client and the web services server.

Procedure 6.4. Recording a SOAP request.

  1. Alter the SOAP client's settings so that it uses NeoLoad as a proxy:

    • hostname: name or IP address of the machine currently running the NeoLoad Controller.

    • port: the NeoLoad HTTP recorder's port, 8090 by default. This setting can be changed in the NeoLoad preferences.

    Please refer to the documentation accompanying your web services framework for instructions on how to change the proxy settings. As a guide:

    1. Axis: Modify the http.proxyHost and http.proxyPort system properties.

      For example, place the following lines in your code:

      System.setProperty("http.proxyHost", "localhost");
      System.setProperty("http.proxyPort", "8090");

      or modify the command line as follows:

      java -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8090 ...

    2. .Net. The configuration file may be modified as follows:

      <configuration>
         <system.net>
            <defaultProxy>
               <proxy
                  usesystemdefault = "false"
                  proxyaddress="http://localhost:8090"
                  bypassonlocal="true"
               />
            </defaultProxy>
         </system.net>
      </configuration>

      For further information, please see http://support.microsoft.com/default.aspx?scid=kb;[LN];318140

  2. Run NeoLoad

  3. Start a recording (See the section called “Recording a Test Scenario”). Since the recording does not require a browser, we recommend clearing the "Launch browser" option .

  4. Launch your SOAP client application. Since the application has been configured to use the NeoLoad recorder as a proxy, NeoLoad records the request.

  5. Stop the recording.

Editing a SOAP request

Description of the SOAP request editing pane:

  • Name. Name of the request

  • Description. Optional comments or notes.

  • URL. Web service's URL, cannot be edited.

  • Server. Web service server.

  • Path. Path to the web service, depending on the selected server.

  • WSDL. URL for the WSDL. For a file on the hard drive, the URL will take the form file:/C:/... Use the file browse button to select the file. For an online file, use the standard http://myserver/myapp/myservice?WSDL.

    The Reload button allows the WSDL to be reloaded and to choose a method from the WSDL. It reconfigures the request parameters according to the new selected method. After confirmation, the request's original parameters are deleted.

  • Edition mode. 

  • Method. SOAP Method to be called, cannot be edited directly. Another method can be selected when clicking on the Reload button, if a WSDL is provided.

  • Content. Edit the WSDL parameters or XML content, depending on the mode selected.

  • Test. Provides a quick way to test the request. Clicking on "Check" creates a virtual user containing the edited request, then launches the virtual user check.

[Note]Note

The "Advanced..." and "Check..." buttons provide the same features as for a standard HTTP request, allowing the editing of HTTP headers, the creation of variable extractors and the checking of contents.

Editing the parameters extracted from the WSDL

When NeoLoad loads the WSDL file, it generates a default tree structure for the parameters and SOAP headers. Optional parameters may be deleted and other parameters added if the WSDL description permits.

Parameters

The parameters tab allows the user to edit, delete or add parameters.

Parameter editing is limited by the restrictions imposed by the WSDL description.

There are two types of parameters:

  • leaf elements, such as a text or numeric value which can be edited.

    This value may be an actual value or a variable. Encoding allows special characters such as '>' and '<' to be encoded. If the value is a variable, the "encode value" option may be cleared if the variable's value is already encoded

    The value type displayed is the 'type' in the WSDL sense of the term, for example: {http://www.w3.org/2001/XMLSchema}string. The user must ensure that the value type syntax is adhered to.

  • containers that contain other elements:

    • Elements of type "Sequence" contain other elements in a specific order and follow the cardinality described in the WSDL. For example, the S sequence must contain between zero and three A elements and at least one B element, in that order;

    • Elements of type "All" contain other elements once, and only once, in an unspecified order;

    • Elements of type "Choice" contain a single child element among the various child elements allowed.

    The container element's restrictions are displayed for information purposes in the "Children" section at the bottom of the container's edit pane.

To add an element to a container , either click on the '+' button, or right-click on the element, then select "Add". In either case, the list of elements to be added is limited by the child elements allowed by the WSDL. The element is automatically inserted in the appropriate place, among the other child elements where an order constraint exists.

To delete an element from a container , either click on the '-' button, or right-click, then select "Delete".

To move an element within a container , use the appropriate direction button, or right-click, then select "Move up" or "Move down".

[Note]Note

If a restriction imposed on the container by the WSDL is not complied with, an error icon is added to the container's icon. An error message also appears in the "Child elements" section of the appropriate container's edit panel.

The attributes section allows the user to edit the parameter's attributes. The permitted attributes are listed in the table. The first column, "Use", allows the attribute to be added to the parameter. Entering a value in the value column automatically adds the attribute to the parameter. It is not possible to add attributes not intended by the WSDL.

Headers

This tab is used to configure the SOAP headers declared in the WSDL.

Its use is similar to that of the Parameters tab.

The specific SOAP Header section allows the user to define the SOAP protocol's "Actor" attribute.

Advanced

This tab is used to define the following two parameters:

  • message style. The styles supported are: RPC/Encoded, RPC/literal, Document/literal and Wrapped Document/literal. The style selected is the one declared in the WSDL. Normally, this parameter should not be changed, as the web service expects to be contacted using the predetermined style (as set in the WSDL).

  • encapsulation format for the binary attachments: MIME or DIME. As with the message style, this parameter is extracted from the WSDL and should not normally be changed.

XML preview

This allows the user to preview the XML body of the request exactly as it will be generated. The preview cannot be edited and only includes the XML body of the message (not the binary attachments, where present).

Carry out a request validation to obtain a preview of the complete HTTP request.

Editing the XML content

If the WSDL file is not defined, or if the WSDL parameters cannot be edited, the XML body of the message may be defined manually.

To do this, edit either the XML text or the XML tree.

Flat XML

This tab allows the user to edit the XML text.

[Tip]Tip

Right click or use 'Ctrl-F' to search.

XML Tree

This tab is used to edit the nodes of the XML tree using the open tree view. The variable picker in this view makes it especially useful when using variables.

If a node value contains a variable, and this variable is already encoded, the option not to encode it XML-wise is available. In this case, NeoLoad adds the attribute NeoLoad-encode="false" to the corresponding node, visible in the XML text tab view. This additional attribute will be deleted during the XML encoding phase of the test and will not be sent to the server.

Preview

This tab provides a read-only preview of the body of the request to be sent.

The variables are interpreted and the carriage returns deleted (see tip below).

[Tip]Tip

The request has the carriage returns removed to make it more compact for the test. Right-click and select "Format as pretty XML" to obtain a more readable presentation.

Configuring the "SOAPAction" HTTP header

SOAP 1.1 requires the presence of the SOAPAction HTTP request header. This header is automatically added, with the appropriate value, when the WSDL is loaded, or recorded if the request is recorded.

Edit the request's HTTP headers to modify this value. To do this, click on the "Advanced..." button and select the "Request header" tab .

Testing a SOAP request

Click on the Check button in the Test section to test the current SOAP request.

NeoLoad creates a virtual user containing the single request, then displays the validation window for that virtual user. Click on the Start check button.

The Details section provides details of the request sent and of the server's response, and access to the assertion messages.

[Tip]Tip

Right-click and select "Format as pretty XML" in the text field to obtain a more easily-readable detail report for the sent request. Right-click and select "Find..." or use Ctrl-F to search.