The response body from a GET request Iāve set up returns variables of this format:
I simply would like to call on this data exactly how it is (or convert it into JSON if that is easier, but would prefer to keep as XML) and POST this data in another request.
@bpricilla, thank you very much for your response!
I had already tried your first suggestion, but not your second. Unfortunately, both still fail. Iām working with a channeladvisor feed and trying to send the response to sellercenter. Strangely, if I run a POST request with the body as a ācopy-pasteā exact of the text above, it is successful.
However, when running and calling on variables, it does not return a success, and comes with an āinvalid request errorā message. I understand that this may be not at fault of the writing of the script, but I do believe if it works via copy-paste that some solution exists via scripts.
Perhaps it is sending purely {{SOAP_Request}} instead of the text inside? Iām unsure. Both requests are in the same collection and are using the same environment. Hopefully this insight is helpful!
@bpricilla I believe the issue is currently with storing the reponse in a variable. As per the attached images, an error is returned with the test script (it wasnāt before though, so unsure what is happening now) when written as suggested. As for the POST script, Iāve simply been calling on the variable in XML as shown.
@chartley22: I believe you have stored the variable in the āTestsā section of your first GET request. Then please check in the environment variable section if the new variable is generated and the XML response is stored properly.
@bpricilla no it is not being generated in the environment. Iāve tried running pm.environment.set(āSOAP_Requestā, (responseBody)); both in the body of the GET request and in the test section, but neither create a variable named SOAP_Request to be called upon in the POST request
@bpricilla wow, thank you. Didnāt even realise that the quotations were in some kind of different font. I believe this works now. I cannot thank you enough!
I have tried roughly based on the visible response. If not working, please provide me the full response
Also kindly read the below link if you need to know more about SOAP response parsing.
Please create a separate topic in future for your queries, so that it will be addressed. Also I request you to consider the points here for your next query here.