我使用的是wso2esb 4.7.0和wso2dss3.0.1 我正在获取数据但无法发送给客户端。该问题无法转换我的邮件显示错误的邮件 本地条目是xslt文件
<?xml version="1.0" encoding="UTF-8"?>
<localEntry xmlns="http://ws.apache.org/ns/synapse" key="emp_xslt">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:f="http://ws.wso2.org/dataservice"
version="1.0">
<xsl:output method="xml"/>
<xsl:param name="eage"/>
<xsl:param name="eno"/>
<xsl:template match="/">
<xsl:apply-templates select="/f:empCollection"/>
</xsl:template>
<f:for-each select="//f:emp">
<tr>
<eage>
<xsl:value-of select="eage"/>
</eage>>
<eno>
<xsl:value-of select="eno"/>
</eno>
</tr>
</f:for-each>
</xsl:stylesheet>
<description/>
</localEntry>
和xslt配置就像这样
<sequence xmlns="http://ws.apache.org/ns/synapse" name="emp2">
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:s="http://ws.wso2.org/dataservice" name="eno" expression="//s:empCollection/s:emp/s:eno" scope="default" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:s="http://ws.wso2.org/dataservice" name="eage" expression="//s:empCollection/s:emp/s:eage" scope="default" type="STRING"/>
<log level="full">
<property name="response" value="not working"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="eno" expression="get-property('eno')"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="eage" expression="get-property('eage')"/>
</log>
<xslt xmlns:f="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd" key="emp_xslt" source="/f:empCollection/f:emp">
<property name="eno" expression="get-property('eno')"/>
<property name="eage" expression="get-property('eage')"/>
</xslt>
<log level="full"/>
</sequence>
但我希望显示数组数据格式到客户端我从esb获取数据
Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><empCollection xmlns="http://ws.wso2.org/dataservice"><emp><ename>faisal</ename><eno>5</eno><eage>26</eage></emp><emp><ename>suresh</ename><eno>6</eno><eage>26</eage></emp><emp><ename>prashant</ename><eno>7</eno><eage>28</eage></emp><emp><ename>anil</ename><eno>2</eno><eage>27</eage></emp><emp><ename xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><eno>0</eno><eage>0</eage></emp><emp><ename>-1</ename><eno>0</eno><eage>0</eage></emp></empCollection></soapenv:Body></soapenv:Envelope>
我的esb日志在控制台中评估了很多错误它显示了xpath错误一段时间name = null是否可以创建我的数据数组
[2013-10-10 15:07:44,425] INFO - LogMediator To: /services/xsltExmp, MessageID: urn:uuid:619c7f86-f0d1-4f57-935b-66b485f8fa08, Direction: request
[2013-10-10 15:07:44,440] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:9f8bf2a6-5736-48c9-bda5-c163c6c571d6, Direction: response, response = not working, eno = 567200, eage = 2626282700, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><empCollection xmlns="http://ws.wso2.org/dataservice"><emp><ename>faisal</ename><eno>5</eno><eage>26</eage></emp><emp><ename>suresh</ename><eno>6</eno><eage>26</eage></emp><emp><ename>prashant</ename><eno>7</eno><eage>28</eage></emp><emp><ename>anil</ename><eno>2</eno><eage>27</eage></emp><emp><ename xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><eno>0</eno><eage>0</eage></emp><emp><ename>-1</ename><eno>0</eno><eage>0</eage></emp></empCollection></soapenv:Body></soapenv:Envelope>
[2013-10-10 15:07:44,442] ERROR - XSLTMediator The evaluation of the XPath expression /f:empCollection/f:emp did not result in an OMNode : null
[2013-10-10 15:07:44,442] ERROR - XSLTMediator Unable to perform XSLT transformation using : Value {name ='null', keyValue ='emp_xslt'} against source XPath : /f:empCollection/f:emp reason : The evaluation of the XPath expression /f:empCollection/f:emp did not result in an OMNode : null
org.apache.synapse.SynapseException: The evaluation of the XPath expression /f:empCollection/f:emp did not result in an OMNode : null
at org.apache.synapse.util.xpath.SourceXPathSupport.selectOMNode(SourceXPathSupport.java:100)
at org.apache.synapse.mediators.transform.XSLTMediator.performXSLT(XSLTMediator.java:211)
at org.apache.synapse.mediators.transform.XSLTMediator.mediate(XSLTMediator.java:191)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:232)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:443)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:222)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
[2013-10-10 15:07:44,444] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:9f8bf2a6-5736-48c9-bda5-c163c6c571d6, Direction: response, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Unable to perform XSLT transformation using : Value {name ='null', keyValue ='emp_xslt'} against source XPath : /f:empCollection/f:emp reason : The evaluation of the XPath expression /f:empCollection/f:emp did not result in an OMNode : null, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><empCollection xmlns="http://ws.wso2.org/dataservice"><emp><ename>faisal</ename><eno>5</eno><eage>26</eage></emp><emp><ename>suresh</ename><eno>6</eno><eage>26</eage></emp><emp><ename>prashant</ename><eno>7</eno><eage>28</eage></emp><emp><ename>anil</ename><eno>2</eno><eage>27</eage></emp><emp><ename xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><eno>0</eno><eage>0</eage></emp><emp><ename>-
100
答案 0 :(得分:0)
由于您需要xslt介体中的所有emp元素,因此请从XSLT介体中删除source属性,如下所示。
<xslt xmlns:f="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd" key="emp_xslt">
<property name="eno" expression="get-property('eno')"/>
<property name="eage" expression="get-property('eage')"/>
</xslt>