Read and get Exchange rate from XML

Hello Everyone.

I have the following question, I am consulting the exchange rate on the following webservice http://www.banxico.org.mx/DgieWSWeb/DgieWS?WSDL, the result i get is the following XML after deserialize the string. https://protiviti-my.sharepoint.com/:t:/g/personal/oscar_flores_protivitiglobal_com_mx/Ea6gFqbio-1GkwOECod_U6MBjXx4TLgrLaOd3FEmmZd5SQ?e=LL0P7h

As far as I understand, to extract for example the ID value, I have to use the following code: SOAP_Result.Element(“CompactData”).Element(“Header”).Element(“ID”).value.ToString. But I got the following error: object not set to an instance of an object.

Error

Can you guys please help me?

Hi @OscarFV,

  1. It is just a suggestion, It will help you hopefully
    There is an easy way to get the required output with the WSDL url’s. You just need to import the UiPath.WebAPI.Activities which are available. Drag the SOAP request activity to the sequence. It will automatically gives you the available methods and the classes available in that methods as well. Then all you need is to pass the parameters to that and it will gives you the output after deserializing XML in the JSON format. we have available JSON packages also to parse JSON objects.

  2. And, if you want to deserialize the XML output, you have actitivities available to deserialize XML as well. Deserialize XML or Get XML Nodes activities will help you :slight_smile:

Regards,
Hareesh

Hello @HareeshMR.

Thank you so much for your reply, in fact, this is the UIPATH flow,

WebServiceFlow

I tried to use the Get XML Nodes activity, but I can only use the command ElementAt("").

As far as I understand on the XML code, the parent header is CompactData and the children headers are “Header” and “Dataset”. I am right on that? Maybe I am not understanding the XML structure :unamused:

I just did some research and I got the following XPath code //bm:Series[3]/bm:Obs/@OBS_VALUE, the issue with this code is the : character, can anyone please help me on solve this?

Thanks & Regards!