XQuery transformation with WSO2 ESB
Pergunta
I am designing a Proxy Service sequence that includes an XQuery transformation. I have a problem with referencing the registry file containing the transformation.
Here is the sequence:
<sequence name="MySequence" xmlns="http://ws.apache.org/ns/synapse" >
<xquery key="conf:/wsdl/xqueryRequest.xq"
target="..."
xmlns:ns="http://org.apache.synapse/xsd" >
<variable xmlns:ns2="http://..." name="var1" expression="..." type="ELEMENT" />
</xquery>
<send>
<endpoint>...</endpoint>
</send>
</sequence>
The file containing the XQuery transformation is uploaded in
/_system/config/wsdl/xqueryRequest.xq
And this is the exception I am getting:
WARN ERROR_DETAIL : org.apache.synapse.SynapseException: Unable to execute the query at org.apache.synapse.mediators.xquery.XQueryMediator.handleException(XQueryMediator.java:627) at org.apache.synapse.mediators.xquery.XQueryMediator.mediate(XQueryMediator.java:130) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60) at ... Caused by: java.lang.NullPointerException at org.wso2.carbon.mediation.registry.WSO2Registry.lookup(WSO2Registry.java:177) at org.apache.synapse.registry.AbstractRegistry.getResource(AbstractRegistry.java:63) at org.apache.synapse.config.SynapseConfiguration.getEntry(SynapseConfiguration.java:693) at org.apache.synapse.core.axis2.Axis2MessageContext.getEntry(Axis2MessageContext.java:194) at org.apache.synapse.mediators.xquery.XQueryMediator.performQuery(XQueryMediator.java:233) at org.apache.synapse.mediators.xquery.XQueryMediator.mediate(XQueryMediator.java:123) ... 11 more
The exception shows a NullPointer at WSO2Registry.lookup so I assume that the problem is in finding the XQuery file in the registry, this part:
key="conf:/wsdl/xqueryRequest.xq"
The documentation shows two code snippets(390 and 391) with XQuery transformation but non of them explains howto reference the XQuery file.
Question: What should be the correct value for the key parameter? Do I need to use the "Local Entry" feature? If yes, then should I define the value as "Inline XML Entry" or "Inline Text"?
UPDATE 03/23/12:
Question 2: Perhaps a simpler question: Where should I copy/upload the xqueryRequest.xq file when I set Xquery mediator's key field to key="xqueryRequest.xq"?
Solução
Can you try saving your xquery as a local entry and refer it from the XQuery mediator. (Please have a look at local entry samples)