Although XPATH 2.0 is supported in WSO2 ESB, it is not enabled by default. In order to use this you have to enable XPATH 2.0.
To enable XPath 2.0 functions, we have to uncomment following entry in the synapse.properties file. which is located at <ESB_HOME>/repository/conf directory
synapse.xpath.dom.failover.enabled=true
After enabling xpath 2.0, you will able to use xpath functions like "codepoint-equal()" in your synapse configuration.
If you are using synapse specific xpath functions like "get-property()" within a xpath 2.0 function you have to use them with the prefix "syn".
Following is an example for a such usage.
So in my case lets say I'm getting a request header like following
{org.apache.synapse.transport.http.wire} - >> "Content-Type: application/xml; charset=UTF-8" {org.apache.synapse.transport.http.wire}
I want to extract the "application/xml" value from the "application/xml; charset=UTF-8". I can use the following expression to do this, Note that I'm tokenizing the mentioned value, extracting the relevent text and assigning it to a new property which can be referred later.
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:fn="http://www.w3.org/2005/xpath-functions" name="NEW_CONTENT_TYPE" expression="fn:tokenize(syn:get-property('axis2','ContentType'),';')[1]" scope="default" type="STRING"/>
Thanks for reading and drop a comment if you have any queries.
I have enabled xpath 2.0 from synapse prop file as mentioned above and trying to use tokenize fn in my proxy service.
ReplyDeleteStill I get the below error and property where I used tokenize
fn:tokenize(//xpath for the node, 'value ')
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
yozgat
ReplyDeletetunceli
hakkari
zonguldak
adıyaman
Z63JO
4F6F2
ReplyDeleteKastamonu Parça Eşya Taşıma
Yalova Parça Eşya Taşıma
Trabzon Evden Eve Nakliyat
Siirt Evden Eve Nakliyat
Aydın Şehirler Arası Nakliyat
Çankırı Parça Eşya Taşıma
Bartın Evden Eve Nakliyat
Tekirdağ Cam Balkon
Gate io Güvenilir mi
B8F49
ReplyDeleteAntalya Şehir İçi Nakliyat
Ünye Parke Ustası
Ünye Yol Yardım
Eryaman Parke Ustası
Elazığ Evden Eve Nakliyat
Malatya Parça Eşya Taşıma
Osmo Coin Hangi Borsada
Çerkezköy Çelik Kapı
Konya Şehir İçi Nakliyat
E2490
ReplyDeleteBartın Şehirler Arası Nakliyat
Karaman Parça Eşya Taşıma
Adıyaman Şehir İçi Nakliyat
Van Parça Eşya Taşıma
Bartın Şehir İçi Nakliyat
Erzincan Parça Eşya Taşıma
Ünye Oto Elektrik
Kırıkkale Parça Eşya Taşıma
Isparta Şehir İçi Nakliyat