SoapUI

SoapUI is a tool used for testing web services such as NetForum's xWeb.

Installation

There are two ways to download and install the SoapUI program.

The first method is download the Windows installer. When the program is executed a windows command prompt window is opened to execute the application code. Once the application finished loading the SoapUI interface is opened in a separate window.

SoapUI can also be installed and executed using Java Web Start by downloading the soapui.jnlp file. In order to start the application you must have the Java Runtime Environment (JRE) installed on your computer. You can install the JRE by going to http://www.java.com/en/download/ and selecting the download now link. Once the JRE is installed you can download and run soapui.jnlp. The application will then download and install on your local machine. There won't be any executables or shortcuts created by the installation. To run SoapUI simply execute soapui.jnlp and the application will start.

Testing xWeb with SoapUI

It is not currently possible to test the secure xWeb site through a browser (this is a SOAP browser issue, not a NetForum issue). In order to test, you will need to use a program that can communicate with xWeb through SOAP. You can use SoapUI for this.

Go to http://www.soapui.com and download the program and install it on your machine. Note that this program will require the Java Runtime Environment on your machine.

  1. Create a new project for each client/site.
  2. Enter the WSDL for the /xweb/secure/netForumXML.asmx url. It will look like this:
    http://<<netForumSITE>>/xweb/secure/netForumXML.asmx?WSDL
    Now you will see all the baseline xWeb methods.
    Custom web services are stored in a separate file, usually /xweb/secure/<<Client Acronym>>_WS.asmx. So if the client had the acronym ABC the WSDL location would be:
    http://<<netFOrumSITE>>/xweb/secure/ABC_WS.asmx?WSDL
    Custom web services for a client can be added to an existing project by:
    1. Right-clicking on the project name.
    2. Selecting "Add WSDL from URL."
    3. Entering the WSDL location.
  3. Test the Authenticate method using a valid userName/password. You should get back a token. Copy that token to your clipboard (Ctrl-C).
  4. Next, call another method such as GetIndividualInformation. With the token that you just copied, paste it into the soap-header between the token elements, and enter a valid customerkey in the body between the IndividualKey elements. Check for a response. (See XWeb_Integration_Tips#Manually_Generating_a_Token for tips on working with this token in soapUI.)
  5. You can save each project and request to come back to them later if needed.

If all of this works, then xWeb is setup properly. Therefore, any issues or problems that might be coming up are a result of integration mistakes and not the fundamental configuration of xWeb.

Testing xWeb Methods

SoapUI lets you create sample requests for web methods. If you find that your method is failing and not even getting a response, it's likely that your request has invalid syntax. From the SoapUI request editor, use the Validate function to validate the format and syntax of your request.


The validate feature is useful for troubleshooting what could be a faulty request generated by your integration code. If you can capture the request generated by your integration code, copy it into a SoapUI request editor and Validate it there. You can try to fix the problems in SoapUI and keep plugging away in SoapUI until the request is valid an operates properly. Next, go back to your application and correct any defects that generated the invalid parts of the request.

If you're having trouble capturing the actual request your code is generating, try using Fiddler.

Test Suite and Load Testing

SoapUI contains a test suite feature that enables to add a test script that combines a series of web method calls. You can even take a value from step 1 and pass it to step 2. For an xWeb test suite, this is helpful because you can call Authenticate in step 1, get a token, then pass the token (using SoapUI's property transfer feature) to a GetQuery in step 2, get another token, transfer the token to a InsertFacadeObject in step 3, and so on.

Within a Test Suite, you can have Test Cases, and each Test Case will have one or more Test Steps. The trickiest Test Step is a property transfer to get the token from one step and pass it to the next step. Here is a screen shot of how to do this:


Observe the three Test Steps on the left:

  1. Authenticate
  2. Property Transfer - Authenticate to GetQuery - Individual
  3. GetQuery - Individual
  4. Property Transfer - Ind to Events
  5. GetQuery 2 - Events

You'll want to take the token you get from Authenticate, and transfer it to the first GetQuery. To do this, you'll need to insert a Property Transfer test step between the two. The details on the Property Transfer are on the right. Notice the source is the Authenticate step, and the Response property. The Target on the bottom is the GetQuery - Individual step, and its Request property.

To get the declare statements, click Declare twice. On the third line, enter:

(//ns1:Token)[1]

Add a second Property Transfer to transfer the token from "GetQuery 1" to "GetQuery 2 - Evnts", in basically the same way:


Once you have your Test Suite working, you can run it through a load test in which SoapUI will execute your test suite continuously over a period of time and show you statistics such as average execution time. The load test will see how your test suite will hold up under a heavier load that might approximate how the web service will be used in real life. Of course, there are many other variables in real life including page load, network connections, etc., but load tests are at least a good benchmark to start with.


See:

Managing URLs

Change Test Case URLs

In the first step I've opened a test case which contains three steps, two SOAP requests and a property transfer. The two SOAP requests are opened to the right of the test case window. You'll notice that both SOAP requests are using a development URL. In the test case window there is a button along the top labeled "URL", if you hold your mouse pointer over this button the description will read "Sets the endpoint for all requests in this testcase". Click on this button.

XPath

Syntax

Selecting Nodes

XPath uses path expressions to select nodes in an XML document. The node is selected by following a path or steps. The most useful path expressions are listed below:

Expression Description
nodename Selects all child nodes of the named node
/ Selects from the root node
// Selects nodes in the document from the current node that match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes

Predicates

Predicates are used to find a specific node or a node that contains a specific value.

Predicates are always embedded in square brackets.

Examples

We will use the following XML document in the examples below.

<?xml version="1.0" encoding="ISO-8859-1"?><bookstore><book>  <title lang="eng">Harry Potter</title>  <price>29.99</price></book><book>  <title lang="eng">Learning XML</title>  <price>39.95</price></book></bookstore>

In the table below we have listed some path expressions with predicates and the result of the expressions:

Path Expression Result
/bookstore/book[1] Selects the first book element that is the child of the bookstore element.

Note: IE5 and later has implemented that [0] should be the first node, but according to the W3C standard it should have been [1]!!

/bookstore/book[last()] Selects the last book element that is the child of the bookstore element
/bookstore/book[last()-1] Selects the last but one book element that is the child of the bookstore element
/bookstore/book[position()<3] Selects the first two book elements that are children of the bookstore element
//title[@lang] Selects all the title elements that have an attribute named lang
//title[@lang='eng'] Selects all the title elements that have an attribute named lang with a value of 'eng'
/bookstore/book[price>35.00] Selects all the book elements of the bookstore element that have a price element with a value greater than 35.00
/bookstore/book[price>35.00]/title Selects all the title elements of the book elements of the bookstore element that have a price element with a value greater than 35.00