Adding Variables in the Body of a HTTP Request

In attempting this I put all the lines of the xml on one single line. and added the variable and it did not work. Next I did the same as the first but between every line added +Element.NewLine+ and it compiled but did not take accept the value of the variable which is userID as shown in the image. I am not sure how I would need to approach this issue. The variables are strings and they are populated with the correct strings. When I hard code the ID numbers into the system it works fine.

Please help!! and Thanks

for spanning multiple lines we can do:

I tried it but that gave me this as a response message it should give back a response that returns a rec number. This is the same response I get when I tried the other methods

lets not missmatch validation error and soap responses out of expectations

From your initial request we handled the validation error:

So, we would assume that with the given option it is solved, right?

we dont know your used api /webservice details and your modelling. But have a look on following and try to adapt the call.

In some scenarios a parallel usage of the postman tool can help while developing.
Also check while debugging that your userID variable is not null and the provided value is as the Webservice is expecting

In my post I said that I knew how to fix the compiler error, I had found documentation on correcting the compiler issue. I am trying to understand why the value of the variable isn’t being read into the body. I showed the picture to explain my process. But the soap response is what I came seeking help for.

thanks for your feedback :+1:

Happy Automation

thank you for your help! when I went and debugged the HTTP request it says that the value is not null and that It has the correct value. I compared the values to my excel sheet. The for loop is iterating properly. So I am not sure what the issue is.

In the Image above that is the HTTP request throwing the error but the string used is not Null. When I physically put a user ID into the body with no variable it works so I am confused. Throughout the whole program the userID is populated

This is the string that is in the body. it is correct but its not working still

I solved my issue, essentially you cannot put a variable inside of the body statement to an html request that is populated with strings. You have to make a new string with the body statement in it and use that. Thank you for your help @ppr

Can you share the example or screenshot I did not understand please explain that.

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