Forum Discussion

tom_13's avatar
tom_13
Contributor
16 years ago

convert type in soap request

Hi,
I have following qustion:
I need to send system time in milliseconds to one of parameter of my soap request. I wrote ${#System#currentTimeMillis()} but this doesn't work.
this parameter is in integer type, but I think that function return srting. How I can convert string to integer in request?
  • Hi Tom,


    You need to use proper property expansion syntax in your HTTP/SOAP/REST test request parameter.
    Starting from soapUI 2.5 you can embed Groovy snippets inside property expansion syntax, like this: ${=System.currentTimeMillis()}

    Alternatively, you can have more freedom with your parameter (e.g. add 1000 ms to the previously fetched value) if you set it property from a Groovy script:

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )

    curTime = System.currentTimeMillis()
    futureTime = curTime + 1000
    groovyUtils.setPropertyValue("Properties", "currentTime", curTime.toString())

    and later use standard format of property expansion. The simplest syntax would be simply: ${currentTime}


    Cheers!
    /Nenad Nikolic a.k.a. Shonzilla