Hello,
I need help with the following scenario:
I have a flow that consults a SOAP service of my company to obtain some data about the employees, specifically information about their vacation periods. The query returns well without problem, the Body of the answer is in XML format which I store in a variable.
Then here is my problem, the image is the response of the SOAP service. I need to extract the text of the following data: <DiasVacaciones> 40 and <DiasTomados> 16, the values 40 and 16 I must store them in another variable and then return them.
Can someone tell me how I can achieve this.Thank you
Solved! Go to Solution.
Hola!
Your variable is called 'Redactar' and is of type string (cadena) right?
I can think of two approaches:
1.- first one is to see if SOAP response has proper XML format, you can use the following expression to evaluate it:
xml(variables('Redactar'))
If malformed xml, flow will fail. If proper xml, you can use xpath() based expression to read XML nodes inside. Either you can search in the Power Automate Community for 'xpath' to find different examples on how to use it... or you share an example of the whole SOAP response as you store it in your variable in this same thread and we can suggest a more precise expression
2.- As a workaround, and assuming <DiasVacaciones> node is always present in the response and just once, you can consider the SOAP response as a text, and use text manipulation WDL functions, like split(), so you can try with the following expression:
first(split(last(split(variables('Redactar'),'<DiasVacaciones>')),'</DiasVacaciones>'))
Same approach for DiasTomados
first(split(last(split(variables('Redactar'),'<DiasTomados>')),'</DiasTomados>'))
¡Ánimo!
Proud to be a Flownaut!
Hola!
Your variable is called 'Redactar' and is of type string (cadena) right?
I can think of two approaches:
1.- first one is to see if SOAP response has proper XML format, you can use the following expression to evaluate it:
xml(variables('Redactar'))
If malformed xml, flow will fail. If proper xml, you can use xpath() based expression to read XML nodes inside. Either you can search in the Power Automate Community for 'xpath' to find different examples on how to use it... or you share an example of the whole SOAP response as you store it in your variable in this same thread and we can suggest a more precise expression
2.- As a workaround, and assuming <DiasVacaciones> node is always present in the response and just once, you can consider the SOAP response as a text, and use text manipulation WDL functions, like split(), so you can try with the following expression:
first(split(last(split(variables('Redactar'),'<DiasVacaciones>')),'</DiasVacaciones>'))
Same approach for DiasTomados
first(split(last(split(variables('Redactar'),'<DiasTomados>')),'</DiasTomados>'))
¡Ánimo!
Proud to be a Flownaut!
Excellent, it worked correctly. Thanks
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.
User | Count |
---|---|
12 | |
7 | |
4 | |
4 | |
3 |
User | Count |
---|---|
11 | |
8 | |
5 | |
5 | |
4 |