Global variable in xml body of request not working

Hi

I have created global variabel (and saved it) and it works fine in Params, Headers etc. But when i add the {{variable}} to the XML body it doesnt work. After googling I have also tried with "{{variable}} but no luck. It doesnt seem like Postman reqognizes it as a variable. And it sends the text {{variable}} as the value of the field. Can anybody help please?

Hi @andreasgigafib. Welcome to the Postman Community.

I have not seen Postman variable used in an XML request body. The common usecases are in json request body. Let me do some findings and get back to you if this is possible or not.

In the meantime, could you please share a screenshot of how you’re currently making use of the variable in an XML?

Can you share your XML.

As far as I’m aware, it works like normal.

The following does work. You just don’t get the variable highlighted like you do for JSON.

image

image

1 Like

Hi Mike. Thank you for your reply. It doesnt work for me, and I do the same as you. My request fails when i add a variable to the body.

Thank you so much for your reply!
This is how i would like to use the variable. It should insert the value of sessionId variable. When i submit the request with the variable it fails. If i remove the variable and insert the value directly the request works fine.

Postman request with variables

Where do you have the sessionId variable set.

Collection, Environment or local variable, and is it set in the current value (not the initial value).

Hi again Mike. For some reason I now get this to work :slight_smile: I have no idea of what I have done wrong, but i believe it would be that the request was not saved to the collection when i tested with variable.

Thanks again for your reply, it pushed me in the right direction.

Hi again. I have found the problem and have updated the solution in this topic. Thanks for your help :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.