Forum Discussion

bowlej's avatar
bowlej
New Contributor
9 years ago

Using a variable in an XML request

Hi all,

 

I have set up a test case that has 3 test steps:

 

1. A script that creates a variable which is UUID, variable name "uuid"

2. A script that created a variable which is a unique email address, variable name "email"

3. An XML soap request that i would like to send that includes a variable referenced in step 1 and step 2  

 

I reference the variable like this "${uuid}" or "${email}" in the XML request.

 

eg:

 

<ord:ClientOrderIdentifier>${uuid}</ord:ClientOrderIdentifier>

 

The problem is when i run my test case the XML request is not getting updated with the variables i have created in the previous steps.

 

I think the problem is down to my misunderstanding TBH, how can i construct my test so it does work in the way i would like?

 

I have attached a screenshot to show what this looks like in soap.

 

Any help would be much appreciated.

 

 

  • In your script, you need to add the uuid, and email to the context, then only you will be able to use them like you wish to.

    for instance:
    def uuid = "243d-3432-kja-dkfkfjdkd"
    context.uuid = uuid
  • nmrao's avatar
    nmrao
    Champion Level 3
    In your script, you need to add the uuid, and email to the context, then only you will be able to use them like you wish to.

    for instance:
    def uuid = "243d-3432-kja-dkfkfjdkd"
    context.uuid = uuid