2013-10-10 1 views
0

Я использую wso2esb 4.7.0 и wso2dss3.0.1 Я получаю данные правильно, но не могу отправить клиенту. Вопрос не в состоянии преобразовать сообщение мое сообщение с указанием ошибки локальные записи являются XSLT-файлКак использовать медиатор XSLT в wso2esb

<?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>&gt; 
       <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> 

, но я хочу Disply формат данных массива для клиента я получаю данные 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 является evaluting много ошибок в консоли он, показывая ошибку XPATH некоторое время имя = нуль можно ли мак е массив моих данных

[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>- 
+0

ERROR_CODE = 0, ERROR_MESSAGE = Невозможно выполнить преобразование XSLT с помощью: Значение {имя = 'NULL', KeyValue = 'emp_xslt'} против источника XPath:/F: empCollection/е: EMP причина: оценка выражение XPath/f: empCollection/f: emp не привело к OMNode: null, Envelope:

ответ

0

Поскольку певце нужны все элементы EMP внутри XSLT медиатора, удалить атрибут источника из посредника XSLT, как показано ниже.

<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> 
+0

ERROR - XSLTMediator Невозможно выполнить преобразование XSLT, используя: Значение {name = 'null', keyValue = 'orderTransformer'} в отношении источника XPath: s11: Тело/дочерний :: * [position() = 1] | s12: Тело/ребенок :: * [позиция() = 1] причина: невозможно создать OMElement с использованием результата XSLT org.apache.synapse.SynapseException: невозможно создать OMElement с использованием результата XSLT в то время как его предоставление ошибок, подобных этому –

+0

, не работает, его ошибка источника исходного источника .... –