Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2017-06-22 Thread Sashika Wijesinghe
Hi All,

I have added test cases [1] in Testlink to capture the XPath 2.0 and XSLT
2.0 functions supported by ESB. As mentioned in this mail thread some of
the functions failed while saving them due to [2], and some other functions
failed with "no such function" [3] exception. Test cases were included for
the functions that worked successfully with ESB assuming that the other
functions are not supported by ESB as concluded above.

It would be better to add automated tests for the identified test cases
[1] for XPath 2.0 and XSLT 2.0 functions.

@Documentation Team - Since we do not support all the available XPath 2.0
functions in ESB, better to include this point in the documentation.

[1] https://support.wso2.com/jira/browse/WSOQATESTC-1403
[2] *class org.jaxen.saxpath.XPathSyntaxException: fn:avg((1,2,3)): 9:
Expected: ) *
[3]* org.jaxen.UnresolvableException: No Such Function matches*

Regards,
Sashika

On Tue, Aug 9, 2016 at 11:23 AM, Sohani Weerasinghe  wrote:

> Thanks Shafreen for the input.
>
> @Nisrin: Please note
>
> Sohani Weerasinghe
> Senior Software Engineer
> WSO2, Inc: http://wso2.com
>
> Mobile  : +94 716439774 <+94%2071%20643%209774>
> Blog :http://christinetechtips.blogspot.com/
> Twitter  : https://twitter.com/sohanichristine
>
> On Tue, Aug 9, 2016 at 11:21 AM, Shafreen Anfar  wrote:
>
>> Hi Sohani,
>>
>> Sorry for the delayed response. IMO, ideally we should try writing a
>> simple java program with HE and see if it supports that particular function
>> or not. Anyways, since it is not working in ESB. I think it is OK to
>> conclude that is not supported in our ESB.
>>
>> On Fri, Aug 5, 2016 at 10:52 AM, Sohani Weerasinghe 
>> wrote:
>>
>>>
>>> Hi Shafreen,
>>>
>>> I have used [1] in testing the functions, since there is no proper
>>> reference to get a list of functions supported by the Saxon 9.4 HE. Based
>>> on this, can we confirm that the mentioned functions in the above thread
>>> are not supported in HE? (so that we can conclude with the functions we are
>>> supporting in ESB)
>>>
>>> [1] http://www.saxonica.com/html/documentation9.4/functions/
>>>
>>> Sohani Weerasinghe
>>> Senior Software Engineer
>>> WSO2, Inc: http://wso2.com
>>>
>>> Mobile  : +94 716439774
>>> Blog :http://christinetechtips.blogspot.com/
>>> Twitter  : https://twitter.com/sohanichristine
>>>
>>> On Fri, Aug 5, 2016 at 10:21 AM, Shafreen Anfar 
>>> wrote:
>>>
 Hi Sohanai,

 [+ Asanthi]

 We are using Saxon: HE (Home Edition) for XAPTH 2 functions. AFAIK, we
 don't select functionality to support so anything supported by library
 should already be there, which means it's likely HE edition does not
 contain function you're looking for. Please have a look at [1].

 [1] http://www.saxonica.com/html/documentation9.4/about/

 On Thu, Aug 4, 2016 at 6:57 PM, Sohani Weerasinghe 
 wrote:

> Hi ESB Team,
>
> Please find the summary of issues encountered while testing the XPath
> 2.0 functions at [1] ( referred [2] & [3] for syntax) and really 
> appreciate
> your input on this
>
>
> *1. "Invalid XPath Syntax" occurs when saving the synapse
> configuration in management console*
>
> This error occurs for below functions:
>
>- avg- fn:avg((1,2,3,4,5))
>- codepoints-to-string - fn:codepoints-to-string((97, 32, 98, 32,
>99)))
>- distinct-values - fn:distinct-values( ('a', 'b', 'a') ) -This is
>supported when passing the value as an xml payload
>- id - //book/section/secRef/fn:id(@refs)
>- idref - //book/idref('language')/string(.)
>- index-of - fn:index-of( (4, 5, 6, 4), 4)
>- max- fn:max((2,3,5))
>- min - fn:min((2,3,5))
>- remove - fn:remove( ('a', 'b', 'c'), 2)
>- reverse - fn:reverse((1, 2, 3, 4, 5))  -This is supported when
>passing the value as an xml payload
>- string-join - string-join( ('a', 'b', 'c'), '')
>- subsequence - fn:subsequence(('a', 'b', 'c', 'd', 'e'), 3)
>
>
> *2. Issues in using error() function*
>
> According to https://www.w3.org/TR/xpath-functions-30/#ERRFOER ,
> calling the function with empty parameters should give an unidentified
> error. But when invoking the service it gives below exception
>
> Is this accepted?
>
> ERROR - SynapseXPath Evaluation of the XPath expression fn:error()
> resulted in an error
> ; Line#: 1; Column#: -1
> net.sf.saxon.trans.XPathException: Error signalled by application
> call on error()
> at net.sf.saxon.functions.Error.error(Error.java:98)
> at net.sf.saxon.functions.Error.evaluateItem(Error.java:55)
> at net.sf.saxon.expr.Expression.iterate(Expression.java:429)
> at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpress
> ionImpl.java:326)
> at 

Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-08 Thread Sohani Weerasinghe
Thanks Shafreen for the input.

@Nisrin: Please note

Sohani Weerasinghe
Senior Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine

On Tue, Aug 9, 2016 at 11:21 AM, Shafreen Anfar  wrote:

> Hi Sohani,
>
> Sorry for the delayed response. IMO, ideally we should try writing a
> simple java program with HE and see if it supports that particular function
> or not. Anyways, since it is not working in ESB. I think it is OK to
> conclude that is not supported in our ESB.
>
> On Fri, Aug 5, 2016 at 10:52 AM, Sohani Weerasinghe 
> wrote:
>
>>
>> Hi Shafreen,
>>
>> I have used [1] in testing the functions, since there is no proper
>> reference to get a list of functions supported by the Saxon 9.4 HE. Based
>> on this, can we confirm that the mentioned functions in the above thread
>> are not supported in HE? (so that we can conclude with the functions we are
>> supporting in ESB)
>>
>> [1] http://www.saxonica.com/html/documentation9.4/functions/
>>
>> Sohani Weerasinghe
>> Senior Software Engineer
>> WSO2, Inc: http://wso2.com
>>
>> Mobile  : +94 716439774
>> Blog :http://christinetechtips.blogspot.com/
>> Twitter  : https://twitter.com/sohanichristine
>>
>> On Fri, Aug 5, 2016 at 10:21 AM, Shafreen Anfar 
>> wrote:
>>
>>> Hi Sohanai,
>>>
>>> [+ Asanthi]
>>>
>>> We are using Saxon: HE (Home Edition) for XAPTH 2 functions. AFAIK, we
>>> don't select functionality to support so anything supported by library
>>> should already be there, which means it's likely HE edition does not
>>> contain function you're looking for. Please have a look at [1].
>>>
>>> [1] http://www.saxonica.com/html/documentation9.4/about/
>>>
>>> On Thu, Aug 4, 2016 at 6:57 PM, Sohani Weerasinghe 
>>> wrote:
>>>
 Hi ESB Team,

 Please find the summary of issues encountered while testing the XPath
 2.0 functions at [1] ( referred [2] & [3] for syntax) and really appreciate
 your input on this


 *1. "Invalid XPath Syntax" occurs when saving the synapse configuration
 in management console*

 This error occurs for below functions:

- avg- fn:avg((1,2,3,4,5))
- codepoints-to-string - fn:codepoints-to-string((97, 32, 98, 32,
99)))
- distinct-values - fn:distinct-values( ('a', 'b', 'a') ) -This is
supported when passing the value as an xml payload
- id - //book/section/secRef/fn:id(@refs)
- idref - //book/idref('language')/string(.)
- index-of - fn:index-of( (4, 5, 6, 4), 4)
- max- fn:max((2,3,5))
- min - fn:min((2,3,5))
- remove - fn:remove( ('a', 'b', 'c'), 2)
- reverse - fn:reverse((1, 2, 3, 4, 5))  -This is supported when
passing the value as an xml payload
- string-join - string-join( ('a', 'b', 'c'), '')
- subsequence - fn:subsequence(('a', 'b', 'c', 'd', 'e'), 3)


 *2. Issues in using error() function*

 According to https://www.w3.org/TR/xpath-functions-30/#ERRFOER ,
 calling the function with empty parameters should give an unidentified
 error. But when invoking the service it gives below exception

 Is this accepted?

 ERROR - SynapseXPath Evaluation of the XPath expression fn:error()
 resulted in an error
 ; Line#: 1; Column#: -1
 net.sf.saxon.trans.XPathException: Error signalled by application call
 on error()
 at net.sf.saxon.functions.Error.error(Error.java:98)
 at net.sf.saxon.functions.Error.evaluateItem(Error.java:55)
 at net.sf.saxon.expr.Expression.iterate(Expression.java:429)
 at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpress
 ionImpl.java:326)
 at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpress
 ionImpl.java:389)
 at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(
 SynapseXPath.java:533)
 at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(Syn
 apseXPath.java:367)
 at org.apache.synapse.mediators.MediatorProperty.getEvaluatedEx
 pression(MediatorProperty.java:138)
 at org.apache.synapse.mediators.builtin.LogMediator.setCustomPr
 operties(LogMediator.java:223)
 at org.apache.synapse.mediators.builtin.LogMediator.getCustomLo
 gMessage(LogMediator.java:146)
 at org.apache.synapse.mediators.builtin.LogMediator.getLogMessa
 ge(LogMediator.java:132)
 at org.apache.synapse.mediators.builtin.LogMediator.mediate(Log
 Mediator.java:101)
 at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
 stractListMediator.java:97)
 at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
 stractListMediator.java:54)
 at org.apache.synapse.mediators.base.SequenceMediator.mediate(S
 equenceMediator.java:158)
 at 

Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-08 Thread Shafreen Anfar
Hi Sohani,

Sorry for the delayed response. IMO, ideally we should try writing a simple
java program with HE and see if it supports that particular function or
not. Anyways, since it is not working in ESB. I think it is OK to conclude
that is not supported in our ESB.

On Fri, Aug 5, 2016 at 10:52 AM, Sohani Weerasinghe  wrote:

>
> Hi Shafreen,
>
> I have used [1] in testing the functions, since there is no proper
> reference to get a list of functions supported by the Saxon 9.4 HE. Based
> on this, can we confirm that the mentioned functions in the above thread
> are not supported in HE? (so that we can conclude with the functions we are
> supporting in ESB)
>
> [1] http://www.saxonica.com/html/documentation9.4/functions/
>
> Sohani Weerasinghe
> Senior Software Engineer
> WSO2, Inc: http://wso2.com
>
> Mobile  : +94 716439774
> Blog :http://christinetechtips.blogspot.com/
> Twitter  : https://twitter.com/sohanichristine
>
> On Fri, Aug 5, 2016 at 10:21 AM, Shafreen Anfar  wrote:
>
>> Hi Sohanai,
>>
>> [+ Asanthi]
>>
>> We are using Saxon: HE (Home Edition) for XAPTH 2 functions. AFAIK, we
>> don't select functionality to support so anything supported by library
>> should already be there, which means it's likely HE edition does not
>> contain function you're looking for. Please have a look at [1].
>>
>> [1] http://www.saxonica.com/html/documentation9.4/about/
>>
>> On Thu, Aug 4, 2016 at 6:57 PM, Sohani Weerasinghe 
>> wrote:
>>
>>> Hi ESB Team,
>>>
>>> Please find the summary of issues encountered while testing the XPath
>>> 2.0 functions at [1] ( referred [2] & [3] for syntax) and really appreciate
>>> your input on this
>>>
>>>
>>> *1. "Invalid XPath Syntax" occurs when saving the synapse configuration
>>> in management console*
>>>
>>> This error occurs for below functions:
>>>
>>>- avg- fn:avg((1,2,3,4,5))
>>>- codepoints-to-string - fn:codepoints-to-string((97, 32, 98, 32,
>>>99)))
>>>- distinct-values - fn:distinct-values( ('a', 'b', 'a') ) -This is
>>>supported when passing the value as an xml payload
>>>- id - //book/section/secRef/fn:id(@refs)
>>>- idref - //book/idref('language')/string(.)
>>>- index-of - fn:index-of( (4, 5, 6, 4), 4)
>>>- max- fn:max((2,3,5))
>>>- min - fn:min((2,3,5))
>>>- remove - fn:remove( ('a', 'b', 'c'), 2)
>>>- reverse - fn:reverse((1, 2, 3, 4, 5))  -This is supported when
>>>passing the value as an xml payload
>>>- string-join - string-join( ('a', 'b', 'c'), '')
>>>- subsequence - fn:subsequence(('a', 'b', 'c', 'd', 'e'), 3)
>>>
>>>
>>> *2. Issues in using error() function*
>>>
>>> According to https://www.w3.org/TR/xpath-functions-30/#ERRFOER ,
>>> calling the function with empty parameters should give an unidentified
>>> error. But when invoking the service it gives below exception
>>>
>>> Is this accepted?
>>>
>>> ERROR - SynapseXPath Evaluation of the XPath expression fn:error()
>>> resulted in an error
>>> ; Line#: 1; Column#: -1
>>> net.sf.saxon.trans.XPathException: Error signalled by application call
>>> on error()
>>> at net.sf.saxon.functions.Error.error(Error.java:98)
>>> at net.sf.saxon.functions.Error.evaluateItem(Error.java:55)
>>> at net.sf.saxon.expr.Expression.iterate(Expression.java:429)
>>> at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpress
>>> ionImpl.java:326)
>>> at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpress
>>> ionImpl.java:389)
>>> at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(
>>> SynapseXPath.java:533)
>>> at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(Syn
>>> apseXPath.java:367)
>>> at org.apache.synapse.mediators.MediatorProperty.getEvaluatedEx
>>> pression(MediatorProperty.java:138)
>>> at org.apache.synapse.mediators.builtin.LogMediator.setCustomPr
>>> operties(LogMediator.java:223)
>>> at org.apache.synapse.mediators.builtin.LogMediator.getCustomLo
>>> gMessage(LogMediator.java:146)
>>> at org.apache.synapse.mediators.builtin.LogMediator.getLogMessa
>>> ge(LogMediator.java:132)
>>> at org.apache.synapse.mediators.builtin.LogMediator.mediate(Log
>>> Mediator.java:101)
>>> at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>>> stractListMediator.java:97)
>>> at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>>> stractListMediator.java:54)
>>> at org.apache.synapse.mediators.base.SequenceMediator.mediate(S
>>> equenceMediator.java:158)
>>> at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.re
>>> ceive(ProxyServiceMessageReceiver.java:210)
>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>> at org.apache.synapse.transport.passthru.ServerWorker.processEn
>>> tityEnclosingRequest(ServerWorker.java:398)
>>> at org.apache.synapse.transport.passthru.ServerWorker.run(Serve
>>> rWorker.java:145)
>>> at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.r
>>> un(NativeWorkerPool.java:172)
>>> at 

Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-04 Thread Sohani Weerasinghe
Hi Shafreen,

I have used [1] in testing the functions, since there is no proper
reference to get a list of functions supported by the Saxon 9.4 HE. Based
on this, can we confirm that the mentioned functions in the above thread
are not supported in HE? (so that we can conclude with the functions we are
supporting in ESB)

[1] http://www.saxonica.com/html/documentation9.4/functions/

Sohani Weerasinghe
Senior Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine

On Fri, Aug 5, 2016 at 10:21 AM, Shafreen Anfar  wrote:

> Hi Sohanai,
>
> [+ Asanthi]
>
> We are using Saxon: HE (Home Edition) for XAPTH 2 functions. AFAIK, we
> don't select functionality to support so anything supported by library
> should already be there, which means it's likely HE edition does not
> contain function you're looking for. Please have a look at [1].
>
> [1] http://www.saxonica.com/html/documentation9.4/about/
>
> On Thu, Aug 4, 2016 at 6:57 PM, Sohani Weerasinghe 
> wrote:
>
>> Hi ESB Team,
>>
>> Please find the summary of issues encountered while testing the XPath 2.0
>> functions at [1] ( referred [2] & [3] for syntax) and really appreciate
>> your input on this
>>
>>
>> *1. "Invalid XPath Syntax" occurs when saving the synapse configuration
>> in management console*
>>
>> This error occurs for below functions:
>>
>>- avg- fn:avg((1,2,3,4,5))
>>- codepoints-to-string - fn:codepoints-to-string((97, 32, 98, 32,
>>99)))
>>- distinct-values - fn:distinct-values( ('a', 'b', 'a') ) -This is
>>supported when passing the value as an xml payload
>>- id - //book/section/secRef/fn:id(@refs)
>>- idref - //book/idref('language')/string(.)
>>- index-of - fn:index-of( (4, 5, 6, 4), 4)
>>- max- fn:max((2,3,5))
>>- min - fn:min((2,3,5))
>>- remove - fn:remove( ('a', 'b', 'c'), 2)
>>- reverse - fn:reverse((1, 2, 3, 4, 5))  -This is supported when
>>passing the value as an xml payload
>>- string-join - string-join( ('a', 'b', 'c'), '')
>>- subsequence - fn:subsequence(('a', 'b', 'c', 'd', 'e'), 3)
>>
>>
>> *2. Issues in using error() function*
>>
>> According to https://www.w3.org/TR/xpath-functions-30/#ERRFOER ,
>> calling the function with empty parameters should give an unidentified
>> error. But when invoking the service it gives below exception
>>
>> Is this accepted?
>>
>> ERROR - SynapseXPath Evaluation of the XPath expression fn:error()
>> resulted in an error
>> ; Line#: 1; Column#: -1
>> net.sf.saxon.trans.XPathException: Error signalled by application call
>> on error()
>> at net.sf.saxon.functions.Error.error(Error.java:98)
>> at net.sf.saxon.functions.Error.evaluateItem(Error.java:55)
>> at net.sf.saxon.expr.Expression.iterate(Expression.java:429)
>> at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpress
>> ionImpl.java:326)
>> at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpress
>> ionImpl.java:389)
>> at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(
>> SynapseXPath.java:533)
>> at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(Syn
>> apseXPath.java:367)
>> at org.apache.synapse.mediators.MediatorProperty.getEvaluatedEx
>> pression(MediatorProperty.java:138)
>> at org.apache.synapse.mediators.builtin.LogMediator.setCustomPr
>> operties(LogMediator.java:223)
>> at org.apache.synapse.mediators.builtin.LogMediator.getCustomLo
>> gMessage(LogMediator.java:146)
>> at org.apache.synapse.mediators.builtin.LogMediator.getLogMessa
>> ge(LogMediator.java:132)
>> at org.apache.synapse.mediators.builtin.LogMediator.mediate(Log
>> Mediator.java:101)
>> at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>> stractListMediator.java:97)
>> at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>> stractListMediator.java:54)
>> at org.apache.synapse.mediators.base.SequenceMediator.mediate(S
>> equenceMediator.java:158)
>> at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.re
>> ceive(ProxyServiceMessageReceiver.java:210)
>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>> at org.apache.synapse.transport.passthru.ServerWorker.processEn
>> tityEnclosingRequest(ServerWorker.java:398)
>> at org.apache.synapse.transport.passthru.ServerWorker.run(Serve
>> rWorker.java:145)
>> at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.
>> run(NativeWorkerPool.java:172)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>> Executor.java:1145)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>> lExecutor.java:615)
>> at java.lang.Thread.run(Thread.java:745)
>>
>>
>> *3. "System function is not available with this host language/version"
>> occurs when invoking the service*
>>
>> According to 
>> https://sourceforge.net/p/saxon/mailman/saxon-help/thread/
>> 

Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-04 Thread Shafreen Anfar
Hi Sohanai,

[+ Asanthi]

We are using Saxon: HE (Home Edition) for XAPTH 2 functions. AFAIK, we
don't select functionality to support so anything supported by library
should already be there, which means it's likely HE edition does not
contain function you're looking for. Please have a look at [1].

[1] http://www.saxonica.com/html/documentation9.4/about/

On Thu, Aug 4, 2016 at 6:57 PM, Sohani Weerasinghe  wrote:

> Hi ESB Team,
>
> Please find the summary of issues encountered while testing the XPath 2.0
> functions at [1] ( referred [2] & [3] for syntax) and really appreciate
> your input on this
>
>
> *1. "Invalid XPath Syntax" occurs when saving the synapse configuration in
> management console*
>
> This error occurs for below functions:
>
>- avg- fn:avg((1,2,3,4,5))
>- codepoints-to-string - fn:codepoints-to-string((97, 32, 98, 32, 99)))
>- distinct-values - fn:distinct-values( ('a', 'b', 'a') ) -This is
>supported when passing the value as an xml payload
>- id - //book/section/secRef/fn:id(@refs)
>- idref - //book/idref('language')/string(.)
>- index-of - fn:index-of( (4, 5, 6, 4), 4)
>- max- fn:max((2,3,5))
>- min - fn:min((2,3,5))
>- remove - fn:remove( ('a', 'b', 'c'), 2)
>- reverse - fn:reverse((1, 2, 3, 4, 5))  -This is supported when
>passing the value as an xml payload
>- string-join - string-join( ('a', 'b', 'c'), '')
>- subsequence - fn:subsequence(('a', 'b', 'c', 'd', 'e'), 3)
>
>
> *2. Issues in using error() function*
>
> According to https://www.w3.org/TR/xpath-functions-30/#ERRFOER ,
> calling the function with empty parameters should give an unidentified
> error. But when invoking the service it gives below exception
>
> Is this accepted?
>
> ERROR - SynapseXPath Evaluation of the XPath expression fn:error()
> resulted in an error
> ; Line#: 1; Column#: -1
> net.sf.saxon.trans.XPathException: Error signalled by application call on
> error()
> at net.sf.saxon.functions.Error.error(Error.java:98)
> at net.sf.saxon.functions.Error.evaluateItem(Error.java:55)
> at net.sf.saxon.expr.Expression.iterate(Expression.java:429)
> at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(
> XPathExpressionImpl.java:326)
> at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(
> XPathExpressionImpl.java:389)
> at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(
> SynapseXPath.java:533)
> at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(
> SynapseXPath.java:367)
> at org.apache.synapse.mediators.MediatorProperty.getEvaluatedExpression(
> MediatorProperty.java:138)
> at org.apache.synapse.mediators.builtin.LogMediator.setCustomProperties(
> LogMediator.java:223)
> at org.apache.synapse.mediators.builtin.LogMediator.getCustomLogMessage(
> LogMediator.java:146)
> at org.apache.synapse.mediators.builtin.LogMediator.
> getLogMessage(LogMediator.java:132)
> at org.apache.synapse.mediators.builtin.LogMediator.mediate(
> LogMediator.java:101)
> at org.apache.synapse.mediators.AbstractListMediator.mediate(
> AbstractListMediator.java:97)
> at org.apache.synapse.mediators.AbstractListMediator.mediate(
> AbstractListMediator.java:54)
> at org.apache.synapse.mediators.base.SequenceMediator.mediate(
> SequenceMediator.java:158)
> at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(
> ProxyServiceMessageReceiver.java:210)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
> at org.apache.synapse.transport.passthru.ServerWorker.
> processEntityEnclosingRequest(ServerWorker.java:398)
> at org.apache.synapse.transport.passthru.ServerWorker.run(
> ServerWorker.java:145)
> at org.apache.axis2.transport.base.threads.NativeWorkerPool$
> 1.run(NativeWorkerPool.java:172)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745)
>
>
> *3. "System function is not available with this host language/version"
> occurs when invoking the service*
>
> According to 
> https://sourceforge.net/p/saxon/mailman/saxon-help/
> thread/50f7f8b9.4090...@falutin.net/, it seems this is an XSLT function, is
> that the reason for getting the below error?  but at [1] this function is
> declared as an XPath function
>
>
> [2016-08-02 12:47:27,875] ERROR - SynapseXPath Evaluation of the XPath
> expression fn:format-date(fn:current-date(), '[Y01]/[M01]/[D01]')
> resulted in an error
> net.sf.saxon.trans.XPathException: System function format-date#2 is not
> available with this host language/version
> at net.sf.saxon.expr.parser.ExpressionParser.grumble(
> ExpressionParser.java:263)
> at net.sf.saxon.expr.parser.ExpressionParser.parseFunctionCall(
> ExpressionParser.java:2375)
> at net.sf.saxon.expr.parser.ExpressionParser.parseBasicStep(
> ExpressionParser.java:1731)
> at 

Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-04 Thread Sohani Weerasinghe
Hi ESB Team,

Please find the summary of issues encountered while testing the XPath 2.0
functions at [1] ( referred [2] & [3] for syntax) and really appreciate
your input on this


*1. "Invalid XPath Syntax" occurs when saving the synapse configuration in
management console*

This error occurs for below functions:

   - avg- fn:avg((1,2,3,4,5))
   - codepoints-to-string - fn:codepoints-to-string((97, 32, 98, 32, 99)))
   - distinct-values - fn:distinct-values( ('a', 'b', 'a') ) -This is
   supported when passing the value as an xml payload
   - id - //book/section/secRef/fn:id(@refs)
   - idref - //book/idref('language')/string(.)
   - index-of - fn:index-of( (4, 5, 6, 4), 4)
   - max- fn:max((2,3,5))
   - min - fn:min((2,3,5))
   - remove - fn:remove( ('a', 'b', 'c'), 2)
   - reverse - fn:reverse((1, 2, 3, 4, 5))  -This is supported when passing
   the value as an xml payload
   - string-join - string-join( ('a', 'b', 'c'), '')
   - subsequence - fn:subsequence(('a', 'b', 'c', 'd', 'e'), 3)


*2. Issues in using error() function*

According to https://www.w3.org/TR/xpath-functions-30/#ERRFOER ,
calling the function with empty parameters should give an unidentified
error. But when invoking the service it gives below exception

Is this accepted?

ERROR - SynapseXPath Evaluation of the XPath expression fn:error() resulted
in an error
; Line#: 1; Column#: -1
net.sf.saxon.trans.XPathException: Error signalled by application call on
error()
at net.sf.saxon.functions.Error.error(Error.java:98)
at net.sf.saxon.functions.Error.evaluateItem(Error.java:55)
at net.sf.saxon.expr.Expression.iterate(Expression.java:429)
at
net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:326)
at
net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:389)
at
org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(SynapseXPath.java:533)
at
org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:367)
at
org.apache.synapse.mediators.MediatorProperty.getEvaluatedExpression(MediatorProperty.java:138)
at
org.apache.synapse.mediators.builtin.LogMediator.setCustomProperties(LogMediator.java:223)
at
org.apache.synapse.mediators.builtin.LogMediator.getCustomLogMessage(LogMediator.java:146)
at
org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:132)
at
org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:101)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:54)
at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:210)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:398)
at
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:145)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)


*3. "System function is not available with this host language/version"
occurs when invoking the service*

According to 
https://sourceforge.net/p/saxon/mailman/saxon-help/thread/50f7f8b9.4090...@falutin.net/
, it seems this is an XSLT function, is that the reason for getting the
below error?  but at [1] this function is declared as an XPath function


[2016-08-02 12:47:27,875] ERROR - SynapseXPath Evaluation of the XPath
expression fn:format-date(fn:current-date(), '[Y01]/[M01]/[D01]') resulted
in an error
net.sf.saxon.trans.XPathException: System function format-date#2 is not
available with this host language/version
at
net.sf.saxon.expr.parser.ExpressionParser.grumble(ExpressionParser.java:263)
at
net.sf.saxon.expr.parser.ExpressionParser.parseFunctionCall(ExpressionParser.java:2375)
at
net.sf.saxon.expr.parser.ExpressionParser.parseBasicStep(ExpressionParser.java:1731)
at
net.sf.saxon.expr.parser.ExpressionParser.parseStepExpression(ExpressionParser.java:1654)
at
net.sf.saxon.expr.parser.ExpressionParser.parseRelativePath(ExpressionParser.java:1573)
at
net.sf.saxon.expr.parser.ExpressionParser.parsePathExpression(ExpressionParser.java:1557)
at
net.sf.saxon.expr.parser.ExpressionParser.parseUnaryExpression(ExpressionParser.java:1447)
at
net.sf.saxon.expr.parser.ExpressionParser.parseExprSingle(ExpressionParser.java:517)
at
net.sf.saxon.expr.parser.ExpressionParser.parseExpression(ExpressionParser.java:455)
at
net.sf.saxon.expr.parser.ExpressionParser.parse(ExpressionParser.java:391)
at net.sf.saxon.expr.parser.ExpressionTool.make(ExpressionTool.java:94)
at

Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-01 Thread Sohani Weerasinghe
According to [1] if I test the distinct-values function,it behaves as
explained below:


1. If I use a rest mock service to get the response and then get the
distinct values :

Rest mock service response:

http://example.org/ACC/;> 
*557
44*
*44*  

Rest API:

http://ws.apache.org/ns/synapse; name="sample123"
context="/test123">   
 http://localhost:8080/getResult"/> 
http://www.w3.org/2005/xpath-functions; xmlns:ns="
http://org.apache.synapse/xsd; xmlns:base="http://test; name="testValue"
*expression="fn:**distinct-values**(//product/*)"/*>
   


Then expected result is : *557, 44*

But I am getting only *557*

Am I missing something here?

2. If I directly use this function as below

http://ws.apache.org/ns/synapse;
   name="testProxy"
   transports="http https"
   startOnLoad="true">
   
   
  
 
http://www.w3.org/2005/xpath-functions;
  xmlns:xs="http://www.w3.org/2001/XMLSchema;
  xmlns:ns="http://org.apache.synapse/xsd;
  name="testValue"
  expression="*fn:**distinct-values**(('a', 'b', 'a'))*
"/>
 
  
  
   


Then I'm getting the exception "invalid XPapth expression" in saving the
proxy

But according to [1] it seems both ways are correct


[1] http://www.xqueryfunctions.com/xq/fn_distinct-values.html

Thanks,
Sohani

Sohani Weerasinghe
Senior Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine

On Mon, Aug 1, 2016 at 3:54 PM, Sohani Weerasinghe  wrote:

>
>
>
> Sohani Weerasinghe
> Senior Software Engineer
> WSO2, Inc: http://wso2.com
>
> Mobile  : +94 716439774
> Blog :http://christinetechtips.blogspot.com/
> Twitter  : https://twitter.com/sohanichristine
>
> On Mon, Aug 1, 2016 at 1:28 PM, Sohani Weerasinghe 
> wrote:
>
>> Hi All,
>>
>> It seems, the " Invalid XPapth expression" comes when we use two
>> brackets in the function as below
>>
>
>
> While I was testing further I found that below function works perfectly
> even it has two brackets, so that means the syntax of the above mentioned
> functions are correct.
>
> So, are these functions not supported in ESB? Appreciate your input on this
>
> fn:dateTime(xs:date('2006-08-15'), xs:time('12:30:45-05:00'))
>
>
>> fn:codepoints-to-string(*(*2309, 2358, 2378, 2325*)*)
>> fn:string-join(('a', 'c'), 'bbb')
>>
>>
>>
>>
>>
>>
>> Sohani Weerasinghe
>> Senior Software Engineer
>> WSO2, Inc: http://wso2.com
>>
>> Mobile  : +94 716439774
>> Blog :http://christinetechtips.blogspot.com/
>> Twitter  : https://twitter.com/sohanichristine
>>
>> On Mon, Aug 1, 2016 at 12:06 PM, Sohani Weerasinghe 
>> wrote:
>>
>>> Hi All,
>>>
>>> I am validating the Xpath 2.0 functions support in ESB ( please refer
>>> [1]) and I am using below configuration in defining 'avg' function
>>> (Referred [2]), but it seems I am using the wrong syntax.
>>>
>>>   http://www.w3.org/2005/xpath-functions;
>>>   xmlns:test="http://test;
>>>   xmlns:ns="http://org.apache.synapse/xsd;
>>>   name="testValue"
>>> *  expression="fn:avg((3,4,5))"/>*
>>>
>>> Can someone please point the correct syntax?
>>>
>>> Since avg function requires a single parameter, is there a way to define
>>> the integer values externally ( may be using a property mediator ) and use
>>> it inside the function ?
>>>
>>> If this syntax is correct, is this function not supported in ESB?
>>>
>>> Really appreciate your input on this
>>>
>>> FYI: When saving the proxy, I'm getting below exception:
>>>
>>> [2016-08-01 11:41:11,718] ERROR - ProxyServiceAdmin Unable to save
>>> changes made for the proxy service : testProxy. Restored the existing
>>> proxy... :: Invalid XPapth expression : fn:avg((3,4,5))
>>> org.apache.synapse.SynapseException: Invalid XPapth expression :
>>> fn:avg((3,4,5))
>>> at
>>> org.apache.synapse.config.xml.MediatorPropertyFactory.getMediatorProperties(MediatorPropertyFactory.java:106)
>>> at
>>> org.apache.synapse.config.xml.LogMediatorFactory.createSpecificMediator(LogMediatorFactory.java:111)
>>> ...
>>>
>>>
>>>
>>> [1] Xpath 2.0.0 functions supported by ESB
>>> [2] https://www.w3.org/TR/xpath-functions/#func-avg
>>> Sohani Weerasinghe
>>> Senior Software Engineer
>>> WSO2, Inc: http://wso2.com
>>>
>>> Mobile  : +94 716439774
>>> Blog :http://christinetechtips.blogspot.com/
>>> Twitter  : https://twitter.com/sohanichristine
>>>
>>
>>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-01 Thread Sohani Weerasinghe
Sohani Weerasinghe
Senior Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine

On Mon, Aug 1, 2016 at 1:28 PM, Sohani Weerasinghe  wrote:

> Hi All,
>
> It seems, the " Invalid XPapth expression" comes when we use two brackets
> in the function as below
>


While I was testing further I found that below function works perfectly
even it has two brackets, so that means the syntax of the above mentioned
functions are correct.

So, are these functions not supported in ESB? Appreciate your input on this

fn:dateTime(xs:date('2006-08-15'), xs:time('12:30:45-05:00'))


> fn:codepoints-to-string(*(*2309, 2358, 2378, 2325*)*)
> fn:string-join(('a', 'c'), 'bbb')
>
>
>
>
>
>
> Sohani Weerasinghe
> Senior Software Engineer
> WSO2, Inc: http://wso2.com
>
> Mobile  : +94 716439774
> Blog :http://christinetechtips.blogspot.com/
> Twitter  : https://twitter.com/sohanichristine
>
> On Mon, Aug 1, 2016 at 12:06 PM, Sohani Weerasinghe 
> wrote:
>
>> Hi All,
>>
>> I am validating the Xpath 2.0 functions support in ESB ( please refer
>> [1]) and I am using below configuration in defining 'avg' function
>> (Referred [2]), but it seems I am using the wrong syntax.
>>
>>   http://www.w3.org/2005/xpath-functions;
>>   xmlns:test="http://test;
>>   xmlns:ns="http://org.apache.synapse/xsd;
>>   name="testValue"
>> *  expression="fn:avg((3,4,5))"/>*
>>
>> Can someone please point the correct syntax?
>>
>> Since avg function requires a single parameter, is there a way to define
>> the integer values externally ( may be using a property mediator ) and use
>> it inside the function ?
>>
>> If this syntax is correct, is this function not supported in ESB?
>>
>> Really appreciate your input on this
>>
>> FYI: When saving the proxy, I'm getting below exception:
>>
>> [2016-08-01 11:41:11,718] ERROR - ProxyServiceAdmin Unable to save
>> changes made for the proxy service : testProxy. Restored the existing
>> proxy... :: Invalid XPapth expression : fn:avg((3,4,5))
>> org.apache.synapse.SynapseException: Invalid XPapth expression :
>> fn:avg((3,4,5))
>> at
>> org.apache.synapse.config.xml.MediatorPropertyFactory.getMediatorProperties(MediatorPropertyFactory.java:106)
>> at
>> org.apache.synapse.config.xml.LogMediatorFactory.createSpecificMediator(LogMediatorFactory.java:111)
>> ...
>>
>>
>>
>> [1] Xpath 2.0.0 functions supported by ESB
>> [2] https://www.w3.org/TR/xpath-functions/#func-avg
>> Sohani Weerasinghe
>> Senior Software Engineer
>> WSO2, Inc: http://wso2.com
>>
>> Mobile  : +94 716439774
>> Blog :http://christinetechtips.blogspot.com/
>> Twitter  : https://twitter.com/sohanichristine
>>
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-01 Thread Sohani Weerasinghe
Hi All,

It seems, the " Invalid XPapth expression" comes when we use two brackets
in the function as below

fn:codepoints-to-string(*(*2309, 2358, 2378, 2325*)*)
fn:string-join(('a', 'c'), 'bbb')






Sohani Weerasinghe
Senior Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine

On Mon, Aug 1, 2016 at 12:06 PM, Sohani Weerasinghe  wrote:

> Hi All,
>
> I am validating the Xpath 2.0 functions support in ESB ( please refer [1])
> and I am using below configuration in defining 'avg' function (Referred
> [2]), but it seems I am using the wrong syntax.
>
>   http://www.w3.org/2005/xpath-functions;
>   xmlns:test="http://test;
>   xmlns:ns="http://org.apache.synapse/xsd;
>   name="testValue"
> *  expression="fn:avg((3,4,5))"/>*
>
> Can someone please point the correct syntax?
>
> Since avg function requires a single parameter, is there a way to define
> the integer values externally ( may be using a property mediator ) and use
> it inside the function ?
>
> If this syntax is correct, is this function not supported in ESB?
>
> Really appreciate your input on this
>
> FYI: When saving the proxy, I'm getting below exception:
>
> [2016-08-01 11:41:11,718] ERROR - ProxyServiceAdmin Unable to save changes
> made for the proxy service : testProxy. Restored the existing proxy... ::
> Invalid XPapth expression : fn:avg((3,4,5))
> org.apache.synapse.SynapseException: Invalid XPapth expression :
> fn:avg((3,4,5))
> at
> org.apache.synapse.config.xml.MediatorPropertyFactory.getMediatorProperties(MediatorPropertyFactory.java:106)
> at
> org.apache.synapse.config.xml.LogMediatorFactory.createSpecificMediator(LogMediatorFactory.java:111)
> ...
>
>
>
> [1] Xpath 2.0.0 functions supported by ESB
> [2] https://www.w3.org/TR/xpath-functions/#func-avg
> Sohani Weerasinghe
> Senior Software Engineer
> WSO2, Inc: http://wso2.com
>
> Mobile  : +94 716439774
> Blog :http://christinetechtips.blogspot.com/
> Twitter  : https://twitter.com/sohanichristine
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Passing values to the Xpath 2.0 function - fn:avg

2016-08-01 Thread Sohani Weerasinghe
Hi All,

I am validating the Xpath 2.0 functions support in ESB ( please refer [1])
and I am using below configuration in defining 'avg' function (Referred
[2]), but it seems I am using the wrong syntax.

  http://www.w3.org/2005/xpath-functions;
  xmlns:test="http://test;
  xmlns:ns="http://org.apache.synapse/xsd;
  name="testValue"
*  expression="fn:avg((3,4,5))"/>*

Can someone please point the correct syntax?

Since avg function requires a single parameter, is there a way to define
the integer values externally ( may be using a property mediator ) and use
it inside the function ?

If this syntax is correct, is this function not supported in ESB?

Really appreciate your input on this

FYI: When saving the proxy, I'm getting below exception:

[2016-08-01 11:41:11,718] ERROR - ProxyServiceAdmin Unable to save changes
made for the proxy service : testProxy. Restored the existing proxy... ::
Invalid XPapth expression : fn:avg((3,4,5))
org.apache.synapse.SynapseException: Invalid XPapth expression :
fn:avg((3,4,5))
at
org.apache.synapse.config.xml.MediatorPropertyFactory.getMediatorProperties(MediatorPropertyFactory.java:106)
at
org.apache.synapse.config.xml.LogMediatorFactory.createSpecificMediator(LogMediatorFactory.java:111)
...



[1] Xpath 2.0.0 functions supported by ESB
[2] https://www.w3.org/TR/xpath-functions/#func-avg
Sohani Weerasinghe
Senior Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev