0

I am trying to use tokenize xpath fn in my wso2 esb proxy service. I need to split my input string based on certain condition.

But I got the following error,

SynapseXPath Evaluation of the XPath expression fn:tokenize(//SOAP-ENV:Envelope/SOAP-ENV:Body/m:subscribe/m:subscribe/m1:filter/m1:messageContent, ' and ') resulted in an error
org.jaxen.UnresolvableException: No Such Function {http://www.w3.org/2005/xpath-functions}:tokenize.

Following few blogs I have uncommented xpath 2.0 in synapse properties file in $ESB_HOME/repository/conf and rebooted ESB, still I got the same error.

Any inputs on this will be helpful.

Thanks in advance

Community
  • 1
  • 1
Naresh sivaram
  • 37
  • 1
  • 11
  • what version of the ESB are you using? I have not been able to reproduce this problem on 4.8.1 and 5.0.0 – ophychius May 21 '17 at 03:47
  • I am using 5.0 and now the issue got resolved. There was some issue with installation I believe, got errors in OSGi bundle as well. I have installed a fresh copy and now it is working as expected. Thanks for the response. – Naresh sivaram May 22 '17 at 06:21

2 Answers2

1

If you want to use XPath 2.0 functions in WSO2EI, you'll need to do two things.

  1. activate synapse.xpath.dom.failover.enabled=true in <ESB_HOME>/repository/conf/synapse.properties

  2. indicate explicitly the namespace for fn. For instance, instead of

<property name="numbers" expression="fn:tokenize($ctx:phone_numbers, ';')"/>

you should say

<property name="numbers" expression="fn:tokenize($ctx:phone_numbers, ';')" xmlns:fn="http://www.w3.org/2005/xpath-functions"/>

Tested successfully on wso2ei 6.5.0

PS: there's also a split_to_element function but I never managed to make it work properly

zar3bski
  • 2,773
  • 7
  • 25
  • 58
-1

You may follow [1] and [2].

[1] http://wso2logs.blogspot.com/2015/05/error-when-executing-xpath-20-functions.html

[2] How We Can Break a String in Wso2esb using Xpath

Community
  • 1
  • 1