Forum Discussion

Hector48's avatar
Hector48
New Member
6 years ago

simple way of echoing request field from a request to the response in a REST XML mock

Hi,

 

I am new to SoapUi and I need to setup a REST XML mock in which some fields from the request must be echoed in the response.

I tried with doing the following

// create XmlHolder for request content
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )
// get arguments
def arg1 = holder["//startTime"]

Then in the xml response body I added :

<startTime>${arg1}</startTime>

but what is sent is the exact string "${arg1}" not the content that was supposed to be put in arg1

 

How to proceed ?

Thank you for helping

 

 

 

1 Reply

  • avidCoder's avatar
    avidCoder
    Super Contributor

    Did you try adding the arg1 value to PROPERTY step and then parameterizing to the response?

     

    Like this:-

    def arg1 = holder["//startTime"]
    //Create arg1 in PROPERTY step and assign the value of arg1 there.
    
    //After that in response xml:-
    <startTime>${PROPERTY#ARG1}</startTime>