<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: XPath Expression in REST Adapter in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348375#M17636</link>
    <description>&lt;P&gt;Hi Nageshwara,&lt;/P&gt;&lt;P&gt;if you want the first 3 characters of SNDPRN you can use the below expressions.&lt;/P&gt;&lt;P&gt;substring(//SNDPRN,1,3)&lt;/P&gt;&lt;P&gt;substring(/ZPM_ORDER02/IDOC/EDI_DC40/SNDPRN,1,3)&lt;/P&gt;</description>
    <pubDate>Thu, 22 Dec 2016 22:37:11 GMT</pubDate>
    <dc:creator>Snavi</dc:creator>
    <dc:date>2016-12-22T22:37:11Z</dc:date>
    <item>
      <title>XPath Expression in REST Adapter</title>
      <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaq-p/348374</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;I'm trying to use substring function in XPath Expression for pattern replacement.&lt;/P&gt;&lt;P&gt;As per the below wiki I we can use it in Receiver Determination condition editor&lt;/P&gt;&lt;P&gt;&lt;A href="https://wiki.scn.sap.com/wiki/display/XI/Xpath+Condition+in+Receiver+Determination" target="test_blank"&gt;https://wiki.scn.sap.com/wiki/display/XI/Xpath+Condition+in+Receiver+Determination&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But when I tried to apply the same in Receiver REST adapter for Pattern Replacement using XPath Expression it's not working please guide me on this.&lt;/P&gt;&lt;P&gt;I trying to add query string for my REST URL dynamically using  Pattern Replacement using XPath Expression&lt;/P&gt;&lt;P&gt;Expected URL: &lt;A href="http://host:port/service/path?sid={SID}&amp;amp;recipient={RCVPRN}&amp;amp;sender={SNDPRN}" target="test_blank"&gt;http://host:port/service/path?sid={SID}&amp;amp;recipient={RCVPRN}&amp;amp;sender={SNDPRN}&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/12328-rest-poc-xpath-with-substring.jpg" /&gt;&lt;/P&gt;&lt;P&gt;I've tried couple of ways but none of the giving expected results.&lt;/P&gt;&lt;P&gt;/INVOIC02/IDOC/EDI_DC40[substring(SNDPRN,1,3)]&lt;/P&gt;&lt;P&gt;/INVOIC02/IDOC/EDI_DC40[substring(//SNDPRN,1,3)]&lt;/P&gt;&lt;P&gt;/INVOIC02/IDOC/EDI_DC40[substring(SNDPRN,1,3)]/SNDPRN&lt;/P&gt;&lt;P&gt;I tried giving 1 argument to the substring function to check whether we can apply the function in xpath or not then I got below exception.&lt;/P&gt;&lt;P&gt;XPath: /INVOIC02/IDOC/EDI_DC40[substring(SNDPRN)]&lt;/P&gt;&lt;P&gt;"/INVOIC02/IDOC/EDI_DC40[substring(SNDPRN)]"; Message: "javax.xml.transform.TransformerException: com.sun.org.apache.xpath.internal.functions.FuncSubstring only allows 2 or 3 arguments - com.sun.org.apache.xpath.internal.functions.FuncSubstring only allows 2 or 3 arguments"&lt;/P&gt;&lt;P&gt;Which means we can apply this substring function but not sure how to pass xpath as an arugument(SNDPRN in my case) to the substring function&lt;/P&gt;&lt;P&gt;Note: I cannot use mapping here&lt;/P&gt;&lt;P&gt;Please guide me on this.&lt;/P&gt;&lt;P&gt;As ever,&lt;/P&gt;&lt;P&gt;Nagesh&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 15:05:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaq-p/348374</guid>
      <dc:creator>nageswararao_v2</dc:creator>
      <dc:date>2016-12-22T15:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: XPath Expression in REST Adapter</title>
      <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348375#M17636</link>
      <description>&lt;P&gt;Hi Nageshwara,&lt;/P&gt;&lt;P&gt;if you want the first 3 characters of SNDPRN you can use the below expressions.&lt;/P&gt;&lt;P&gt;substring(//SNDPRN,1,3)&lt;/P&gt;&lt;P&gt;substring(/ZPM_ORDER02/IDOC/EDI_DC40/SNDPRN,1,3)&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 22:37:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348375#M17636</guid>
      <dc:creator>Snavi</dc:creator>
      <dc:date>2016-12-22T22:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: XPath Expression in REST Adapter</title>
      <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348376#M17637</link>
      <description>&lt;P&gt;Hello Navdeep,&lt;/P&gt;&lt;P&gt;Tried that as well when I'm using -  substring(//SNDPRN,1,3) it's giving below exception&lt;/P&gt;&lt;P&gt;MP: exception caught with cause com.sap.aii.adapter.rest.ejb.parse.InvalidXPathExpression: Invalid XPath expression "substring(//SNDPRN,1,3)"; Message: "com.sun.org.apache.xpath.internal.XPathException: Can not convert #STRING to a NodeList! - Can not convert #STRING to a NodeList!"&lt;/P&gt;&lt;P&gt;I think XPath Expression always expects start char with / or //.&lt;/P&gt;&lt;P&gt;If I use - /INVOIC02/IDOC/EDI_DC40[substring(//SNDPRN,1,3)]&lt;/P&gt;&lt;P&gt;It's giving null result form the xpath expression&lt;/P&gt;&lt;P&gt;As ever,&lt;/P&gt;&lt;P&gt;Nagesh&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 14:53:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348376#M17637</guid>
      <dc:creator>nageswararao_v2</dc:creator>
      <dc:date>2016-12-27T14:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: XPath Expression in REST Adapter</title>
      <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348377#M17638</link>
      <description>&lt;P&gt;Hi NageswaraRao!&lt;/P&gt;&lt;P&gt;Yes, it shouldn't work since you get NodeSet as result of your expression.&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;substring(/INVOIC02&lt;STRONG&gt;[1]&lt;/STRONG&gt;/IDOC&lt;STRONG&gt;[1]&lt;/STRONG&gt;/EDI_DC40&lt;STRONG&gt;[1]&lt;/STRONG&gt;/SNDPRN&lt;STRONG&gt;[1]&lt;/STRONG&gt;, 1, 3)&lt;/P&gt;&lt;P&gt;Another syntax (if you have only one INVOIC02 element in your message):&lt;/P&gt;&lt;P&gt;substring(/INVOIC02/IDOC/EDI_DC40/SNDPRN&lt;STRONG&gt;[1]&lt;/STRONG&gt;, 1, 3)&lt;/P&gt;&lt;P&gt;Regards, Evgeniy.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2016 01:41:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348377#M17638</guid>
      <dc:creator>former_member190293</dc:creator>
      <dc:date>2016-12-28T01:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: XPath Expression in REST Adapter</title>
      <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348378#M17639</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Any solution? I have the same problem&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Apr 2019 14:59:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348378#M17639</guid>
      <dc:creator>LeonrdoLemos</dc:creator>
      <dc:date>2019-04-18T14:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: XPath Expression in REST Adapter</title>
      <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348379#M17640</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;There is a strange thing about REST that in RECEIVER adapter it takes the receiver payload and not the sender payload so map the SNDPRN to one field in receiver structure and then do xpath. Or go For adapter specific attribute (ASMA).&lt;BR /&gt;&lt;A href="https://blogs.sap.com/2014/12/18/pi-rest-adapter-using-dynamic-attributes/"&gt;&lt;/A&gt;&lt;A href="https://blogs.sap.com/2014/12/18/pi-rest-adapter-using-dynamic-attributes/" target="test_blank"&gt;https://blogs.sap.com/2014/12/18/pi-rest-adapter-using-dynamic-attributes/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Vikas&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 03:43:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348379#M17640</guid>
      <dc:creator>vicky20691</dc:creator>
      <dc:date>2019-04-29T03:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: XPath Expression in REST Adapter</title>
      <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348380#M17641</link>
      <description>&lt;P&gt;try this note: 2793544 - REST Receiver cannot evaluate&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 12:05:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348380#M17641</guid>
      <dc:creator>LeonrdoLemos</dc:creator>
      <dc:date>2019-05-28T12:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: XPath Expression in REST Adapter</title>
      <link>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348381#M17642</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;How were you able to fix the issue?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 09:23:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xpath-expression-in-rest-adapter/qaa-p/348381#M17642</guid>
      <dc:creator>former_member810074</dc:creator>
      <dc:date>2022-10-31T09:23:26Z</dc:date>
    </item>
  </channel>
</rss>

