Forum Discussion

MDe-Wolf's avatar
14 years ago

Reformating a Response to use with Xpath

I have used a Property Transfer to extract info from <![CDATA[ ##info is here## ]]> and placed this in a temporary property.

I am looking to extract Timecode out of this XML, and place that timecode into a soap request later on in my tests.

Problem is it extracted with the :
eg 01:00:23:12

and I have to input it as an INT
01002312

Anybody have any ideas?

2 Replies

  • RJanecek's avatar
    RJanecek
    Regular Contributor
    Hi,

    I would prefer groovy script for this:

    // first you need to get property:
    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) 

    def response = context.expand( '${TestRequestName#Response}' )
    def holderResponse = groovyUtils.getXmlHolder( response )
    def property = holderResponse.getNodeValue( "//*[local-name()='elementName' and namespace-uri()='nameSpaceName']")


    // then replace
    property.replaceAll(":","")


    // then save it
    context.setProperty("property",property)


    // and now you can call this property in Test Request:

                <urn:Property>${Property}</urn:Property>


    // or in groovy script

    def property = context.getProperty("property")