Parse string soap response to get XML

Is there a way to parse string soap response to get XML and then use XPATH to parse the xml?

Hello, @Pranjal_Jain!

You can use ‘HTTP-request’ activity to send requests and save responses to variables, then process these variables, for example using methods in JavaScript or using scripts in other languages.

If possible, can you describe your case in more detail? Examples will also help.

Feel free to ask any questions!

Hello, @a.polianskii, thanks for the response,

So the response I get is an XML encoded as a string, which I need to parse to get the XML. I cannot use the “execute js code” because I don’t think I can install packages using npm. So what I did was write a js code for that and use the command prompt to invoke the code.

for eg. If this is the response "<root version=\"v31.2\">Hello world!</root>" I need to parse it to get the XML <root version="v31.2">Hello world!</root> or a js object { root: { _: 'Hello world!', '$': { version: 'v31.2' } } }. All of this can be achieved by invoking a js code from the command prompt but is there a way to do this using the “execute js code” or any other studio activity?

Also for a failed soap request it just gives "Request failed with status code <status code>" and not the error XML response itself. Can I get the error response as well?

@Pranjal_Jain, do you get the response from the server in the same form "<root version=\"v31.2\">Hello world!</root>"(with \) if you use another service for sending HTTP requests? For example, ‘Postman’ or any other service.