Forum Discussion

skjoldan's avatar
skjoldan
Occasional Contributor
14 years ago

getting property from Raw Response

Hi,

I need to pull out a property (A large string), from a response of a rest call.

I have tried using property transfer, with response as XML. The problem is that the response contains /r/n and SoapUI and when I pull it out as xml, then the /r/n is being removed.

So i need the text from the raw tab, as that contains /r/n

Can anybody help me?

1 Reply

  • skjoldan's avatar
    skjoldan
    Occasional Contributor
    I have found a fix which seems to work.

    Through a groovy script I'm using af JSON.Parser for getting the correct information, code is here:

    import grails.converters.*

    def testRequest = testRunner.testCase.testSteps["bestilling med kunde - W"].testRequest.response.contentAsString
    log.info testRequest

    //def file = new File("c:/array.txt")
    //def text = file.getText().trim()
    def text = testRequest
    def jsonArray = JSON.parse(text)
    def result = jsonArray."array-init"
    log.info result
    return result


    But you need to have the grails files in your soapUI lib.