How to pass a variable in xml file

I am sending an HTTP post Request by reading an XML file using Read text activity with static data.

I need to pass dynamic data in XML.

Please help me how to pass dynamic data in xml.

Hello @aman7790,

There are two ways of doing this:

  1. Place some text like <Property1> , <Property2> in XML. Then read the XML File into a string variable say InputString, then do InputString.Replace("<Property1>","Nithin").
  2. Place the position holders like {0}, {1} where ever required in the XML. Then read the XML File into a string variable say InputString, then do String.Format(InputString,"Nithin","Prabhu"). {0} in XML will be replaced with “Nithin” & {1} will be replaced with “Prabhu”

Hope that helps !. Kudos :slight_smile:

Regards,
Nithin

2 Likes

@Nithin_P

Hi Nithin,

It is working fine when I use log message but I have to send to Post request using http Request.

Other team is getting the response as {0}.

Hello @aman7790,

Once the string is formated (Replaced with required text). It behaves the same way for Log Message / Any other activity.

I hope you have assigned the output of String.Format(InputString,"Nithin","Prabhu") to another string variable & you are using the newly assiged string variable for further operations.

Regards,
Nithin

1 Like

@Nithin_P

Where i need to pass it in http request?

Hello @aman7790,

If the String you are processing is the Body of the API Post then it must go to the “Body” property under “Options” Category.

Hope this helps ! Kudos :slight_smile:

Regards,
Nithin

1 Like

Thanks @Nithin_P :slight_smile:

1 Like

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