Tuesday, July 12, 2011

Add dynamic datetime to SoapUI

Sometimes you want to add a simple dynamic datetime to soapUI (the best SOAP tester in the world!). You can do that easily by using the String.format command. Below is an example which returns the time in the following format: 2011-07-12T09:06:11+01:00

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:smar="">
            <smar:Date><![CDATA[${=String.format('%tFT%<tT', new Date() + 10)}+01:00]]></smar:TransactionDate>

Now SOAP testing becomes even more fun!