Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurred when unit tests on Custom XPath functions #3842

Open
shavinsenadheera opened this issue Dec 17, 2024 · 0 comments
Open

Error occurred when unit tests on Custom XPath functions #3842

shavinsenadheera opened this issue Dec 17, 2024 · 0 comments
Labels

Comments

@shavinsenadheera
Copy link

shavinsenadheera commented Dec 17, 2024

Description

We have integrated a custom XPath function and conducted unit testing using VS Code and Integration Studio on MI 4.3.0. During the execution of the unit tests, the following error occurred. However, when performing the integration tests on the same MI instance, we received a successful response.

[2024-12-04 15:49:07,103] ERROR {org.apache.synapse.util.xpath.SynapseXPath} - Evaluation of the XPath expression wso2:to-camelcase('testing from me') resulted in an error ; Line#: -1
net.sf.saxon.trans.XPathException: Namespace prefix 'wso2' has not been declared
at net.sf.saxon.expr.parser.XPathParser.grumble(XPathParser.java:311)
at net.sf.saxon.expr.parser.XPathParser.grumble(XPathParser.java:268)
at net.sf.saxon.expr.parser.XPathParser.resolveFunctionName(XPathParser.java:3431)
at net.sf.saxon.expr.parser.XPathParser.parseFunctionCall(XPathParser.java:3231)
at net.sf.saxon.expr.parser.XPathParser.parseBasicStep(XPathParser.java:2226)
at net.sf.saxon.expr.parser.XPathParser.parseStepExpression(XPathParser.java:2102)
at net.sf.saxon.expr.parser.XPathParser.parseRelativePath(XPathParser.java:2021)
at net.sf.saxon.expr.parser.XPathParser.parsePathExpression(XPathParser.java:1983)
at net.sf.saxon.expr.parser.XPathParser.parseSimpleMappingExpression(XPathParser.java:1997)
at net.sf.saxon.expr.parser.XPathParser.parseUnaryExpression(XPathParser.java:1850)
at net.sf.saxon.expr.parser.XPathParser.parseExprSingle(XPathParser.java:752)
at net.sf.saxon.expr.parser.XPathParser.parseExpression(XPathParser.java:657)
at net.sf.saxon.expr.parser.XPathParser.parse(XPathParser.java:519)
at net.sf.saxon.expr.parser.ExpressionTool.make(ExpressionTool.java:91)
at net.sf.saxon.xpath.XPathEvaluator.compile(XPathEvaluator.java:202)
at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(SynapseXPath.java:679)
at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:510)
at org.apache.synapse.mediators.builtin.PropertyMediator.getResultValue(PropertyMediator.java:425)
at org.apache.synapse.mediators.builtin.PropertyMediator.mediate(PropertyMediator.java:133)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:126)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:74)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.unittest.TestCasesMediator.sequenceMediate(TestCasesMediator.java:126)
at org.apache.synapse.unittest.TestingAgent.processTestCases(TestingAgent.java:290)
at org.apache.synapse.unittest.RequestHandler.runTestingAgent(RequestHandler.java:215)
at org.apache.synapse.unittest.RequestHandler.run(RequestHandler.java:83)
at java.base/java.lang.Thread.run(Thread.java:842)
--------------- linked to ------------------
javax.xml.xpath.XPathExpressionException: net.sf.saxon.trans.XPathException: Namespace prefix 'wso2' has not been declared
at net.sf.saxon.xpath.XPathEvaluator.compile(XPathEvaluator.java:212)
at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(SynapseXPath.java:679)
at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:510)
at org.apache.synapse.mediators.builtin.PropertyMediator.getResultValue(PropertyMediator.java:425)
at org.apache.synapse.mediators.builtin.PropertyMediator.mediate(PropertyMediator.java:133)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:126)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:74)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.unittest.TestCasesMediator.sequenceMediate(TestCasesMediator.java:126)
at org.apache.synapse.unittest.TestingAgent.processTestCases(TestingAgent.java:290)
at org.apache.synapse.unittest.RequestHandler.runTestingAgent(RequestHandler.java:215)
at org.apache.synapse.unittest.RequestHandler.run(RequestHandler.java:83)
at java.base/java.lang.Thread.run(Thread.java:842)
Caused by: net.sf.saxon.trans.XPathException: Namespace prefix 'wso2' has not been declared
at net.sf.saxon.expr.parser.XPathParser.grumble(XPathParser.java:311)
at net.sf.saxon.expr.parser.XPathParser.grumble(XPathParser.java:268)
at net.sf.saxon.expr.parser.XPathParser.resolveFunctionName(XPathParser.java:3431)
at net.sf.saxon.expr.parser.XPathParser.parseFunctionCall(XPathParser.java:3231)
at net.sf.saxon.expr.parser.XPathParser.parseBasicStep(XPathParser.java:2226)
at net.sf.saxon.expr.parser.XPathParser.parseStepExpression(XPathParser.java:2102)
at net.sf.saxon.expr.parser.XPathParser.parseRelativePath(XPathParser.java:2021)
at net.sf.saxon.expr.parser.XPathParser.parsePathExpression(XPathParser.java:1983)
at net.sf.saxon.expr.parser.XPathParser.parseSimpleMappingExpression(XPathParser.java:1997)
at net.sf.saxon.expr.parser.XPathParser.parseUnaryExpression(XPathParser.java:1850)
at net.sf.saxon.expr.parser.XPathParser.parseExprSingle(XPathParser.java:752)
at net.sf.saxon.expr.parser.XPathParser.parseExpression(XPathParser.java:657)
at net.sf.saxon.expr.parser.XPathParser.parse(XPathParser.java:519)
at net.sf.saxon.expr.parser.ExpressionTool.make(ExpressionTool.java:91)
at net.sf.saxon.xpath.XPathEvaluator.compile(XPathEvaluator.java:202)
... 12 more

Steps to Reproduce

N/A

Version

4.3.0

Environment Details (with versions)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant