Forum Discussion

Meisinotti's avatar
Meisinotti
Occasional Contributor
6 years ago

XML declaration in request disappears after property transfer

I am using application/xml requests in http test steps. At the beginnig of each request a xml declariation is needed <?xml version="1.0" encoding="ISO-8859-15"?>. It works fine as long as I run the r...
  • Meisinotti's avatar
    Meisinotti
    6 years ago

    So, alt least I got a way that worked for me - than you for you help!

     

    //next line parses the Properties step and gets the value of the declaration
    def declaration = testRunner.testCase.testSuite.getPropertyValue("prexml")
    log.info(declaration)

     

    //next line parses the Properties step and gets the value of the XML without the declaration
    def XML = context.expand('${UC1.116_init#Request}')
    log.info(XML)

     

    //concatenate the values together adding a <br> between them
    def wellFormedXML = declaration +" \n" + XML
    log.info(wellFormedXML)

     

    testRunner.getTestCase().getTestStepByName("UC1.116_init").getProperty('Request').setValue(wellFormedXML)