How to extract XML data from response HTTP activity

Hello everyone,

I’d like to know what is the optimal way to extract the value from the tag “decimal” from the following XML response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/\“>
<s:Body>
<GetFileTotalValueByFileCodeResponse
xmlns="http://tempuri.org/\”>
<GetFileTotalValueByFileCodeResult
xmlns:a="http://schemas.datacontract.org/2004/07/WcfAbreuRPA.Business\"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance\“>
<ErrorMessages
xmlns="http://schemas.datacontract.org/2004/07/WcfAbreuRPA.Entities.Base\
xmlns:b="http://schemas.datacontract.org/2004/07/WcfAbreuRPA.Entities\“/>
<TimeElapsedMessage i:nil="true"
xmlns="http://schemas.datacontract.org/2004/07/WcfAbreuRPA.Entities.Base\”/>
<a:FileValuesService
xmlns:b="http://schemas.datacontract.org/2004/07/System\">
<b:decimal>1231.870</b:decimal>
</a:FileValuesService>


</s:Body>
</s:Envelope>

My workflow is as follow:

  1. HTTP Request → Output response to variable

  2. Deserialize XML → Output to XDocument

Apologies if the solution is simple, I’ve been trying to access the different elements in the XML to get to the decimal value, but so far with no sucess.

Thank you.

@andre.f.pires
as this XML is related to SOAP namespaces are defined for the elements and has to be handled.

Find some starter help here:

Hello Tim,
In this video, I use HTTP Request and extract XML from response:

23:50 Deserialize XML
25:15 How to extract Data from XML Nodes
27:40 How to extract Data from XML Attributes

Thanks,
Cristian Negulescu

Thank you for the suggestions everyone, but because I only want to extract a single value and the response body is static, I ended up using a simple REGEX expression to obtain the value. It’s not optimal, but it works for now.

Once again, I appreciate the help!

1 Like