web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Xpath returns null value
Power Automate
Unanswered

Xpath returns null value

(0) ShareShare
ReportReport
Posted on by 8

Hi,

 

I'm getting null value when I tried to get sessionID using below function. Please help me on this.

 

xpath(xml(outputs('HTTP')),'//*[Local-name()="Envelope"]/*[Local-name()="Body"]/loginResponse/result/sessionId')

 

HTTP post request output (body):

 

<?xml version="1.0" encoding="UTF-8"?>
    <Soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope" xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLschema-instance">
<Soapenv:Body >
<loginResponse>
<result>
<metadataServerUrl>https://salesforce.com/services/soap/35.0</metadataServerUrl>
<sandbox>false</sandbox>
<sessionId>00RREg646744nnhd73636884</sessionId>
<userInfo>
<LoginName>Company</LoginName>
</userInfo>
</result>
</loginResponse>
</Soapenv:Body >
</Soapenv:Envelope>

 

Thanks in advance.

Categories:
I have the same question (0)
  • Verified answer
    CFernandes Profile Picture
    8,402 Most Valuable Professional on at
    Re: Xpath returns null value

    @Ajay3 

     

    Your XML does not seem to be valid, when I try to convert the SOAP Envelope to XML it gives me the error. 

     

    Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '2860': 'The template language function 'xml' parameter is not valid. The provided value cannot be converted to XML: ''Soapenv' is an undeclared prefix. Line 2, position 3.'. Please see https://aka.ms/logicexpressions#xml for usage details.'.

     

    So I pasted it in an online XML validator and I got the same error. You can also validate XML at https://www.xmlvalidation.com/index.php?id=1&L=0 

     

    CFernandes_0-1599990313618.png

     

    That being said, In my blog I have explained how to get a value from the SOAP Envelope (Step 5 to Step 6C) : https://clavinfernandes.wordpress.com/2019/11/12/create-a-flow-using-the-soap-connector/ 

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

     

  • v-bacao-msft Profile Picture
    on at
    Re: Xpath returns null value

     

    Hi @Ajay3 ,

     

    Have you had an opportunity to apply any of @CFernandes 's recommendations to adapt your Flow? I did a test on my side and the results are consistent with what CFernandes described. It seems that the XML data you provided is in the wrong format.

     

    Please refer to @CFernandes 's suggestions to modify the configuration and feel free to let us know if you have any other questions.

     

    Best Regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard