Forum Discussion

nats's avatar
nats
New Contributor
15 years ago

Groovy Script to recreate default request xml from schema in soapui

How can i recreate default request xml from schema in soapui .

As we are recreate default request xml in using refresh button in request pan

and
Groovy Script to Format xml

we are doing it manually by right click and format xml or using ALT+f button

Any one can know pls provide me the script details.


Thanks

2 Replies

  • nats's avatar
    nats
    New Contributor
    Can any one help me on this its needed very urgently
  • AnandKiran's avatar
    AnandKiran
    Frequent Contributor
    Hi,

    Why dont you use a property transfer step to achieve your requriement
    follow the below steps

    1 - For example considering the Operation Name as " Add "
    2. Clone the operation step and name it as " Intiallizer" ( This must be your default Request)
    3. Now in your test case you will be having two Operation Steps (i.e two Request XMLs)
    4. Use a property transfer step to transfer the " Intiallizer" XML to "Add".

    If you want to do in groovy here is the code

    // get request property
    request1                =    groovyUtils.getXmlHolder("Intiallizer#Request")
    def Intiallizer_XML = request1.xml

    // set request property
    request2 = testRunner.testCase.getTestStepByName( "Add " )
    request2.getProperty("request").setValue(Intiallizer_XML)

    Let me know whether it helps.

    Regards
    Anand.