Wednesday, November 25, 2009

SOAP Testing over HTTPS, using Siege instead of Ab

I've been using ab for a while now to perform load testing. Recently, I ran into trouble however because ab doesn't work with HTTPS out of the box (at least on my Ubuntu install). That triggered an investigation into other tools. Siege fit the bill nicely. Basically, I needed a way to perform an HTTP Post with a SOAP body.

On ubuntu, it is a simple "apt-get install siege".

Then, you create a siegerc file:

verbose = true
logging = true
protocol = HTTP/1.1
connection = keep-alive
concurrent = 50 #Number of concurrent requests
file = ./urls.txt
delay = 0 #If you are using for benchmarking value should be 0
benchmark = true

The settings are fairly obvious. Note that the file parameter points to an additional file you'll need, which lists out all of the urls you want included in your test. Below is an example: POST < soapMessage.xml

Notice after the url we specify "POST", which makes it a POST method instead of GET. Additionally, we pipe in the XML file which contains the SOAP message.

Then we can simply invoke siege with:

siege --rc=./siegerc --header="Authorization:Basic BASGHAJSG78236ds"

Notice, we are supplying an extra header for Basic Auth.