Я пишу Data(xml)
в file(csv)
, используя
Smooks медиатор в wso2 EI 6.1.1,
получил исключение, указанное ниже
Я создал прокси-сервис с именем 'WriteDataToCSV' и smooksconfiguration
, файл с именем SmooksCSVConfig
WriteDataToCSV:
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="WriteDataToCSV" startOnLoad="true" transports="http https"
xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<payloadFactory media-type="xml">
<format>
<order id="231">
<header>
<customer number="12345">Justin</customer>
</header>
<order-items>
<order-item id="1">
<product>Fogg</product>
<price>186</price>
<quantity>1</quantity>
</order-item>
<order-item id="2">
<product>Powder</product>
<price>50</price>
<quantity>1</quantity>
</order-item>
</order-items>
</order>
</format>
<args />
</payloadFactory>
<log level="full"/>
<smooks config-key="SmooksCSVConfig">
<input type="xml"/>
<output property="textResult" type="text"/>
</smooks>
</inSequence>
<outSequence />
<faultSequence />
</target>
</proxy>
SmooksCSVConfig:
<?xml version="1.0" encoding="UTF-8"?>
<localEntry key="SmooksCSVConfig" xmlns="http://ws.apache.org/ns/synapse">
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd" xmlns:file="http://www.milyn.org/xsd/smooks/file-routing-1.1.xsd" xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.4.xsd">
<core:filterSettings type="SAX" />
<jb:bean beanId="order" class="java.util.Hashtable" createOnElement="order">
<jb:value property="orderId" decoder="Integer" data="order/@id"/>
<jb:value property="customerNumber" decoder="Long" data="header/customer/@number"/>
<jb:value property="customerName" data="header/customer"/>
<jb:wiring property="orderItem" beanIdRef="orderItem"/>
</jb:bean>
<jb:bean beanId="orderItem" class="java.util.Hashtable" createOnElement="order-item">
<jb:value property="itemId" decoder="Integer" data="order-item/@id"/>
<jb:value property="productId" decoder="Long" data="order-item/product"/>
<jb:value property="quantity" decoder="Integer" data="order-item/quantity"/>
<jb:value property="price" decoder="Double" data="order-item/price"/>
</jb:bean>
<file:outputStream openOnElement="order-item" resourceName="orderItemSplitStream">
<file:fileNamePattern>order-${order.orderId}-${order.orderItem.itemId}.xml</file:fileNamePattern>
<file:destinationDirectoryPattern>E:/Smooks/target/orders/</file:destinationDirectoryPattern>
<file:listFileNamePattern>order-${order.orderId}.lst</file:listFileNamePattern>
<file:highWaterMark mark="10"/>
</file:outputStream>
<ftl:freemarker applyOnElement="order-item">
<ftl:template>E:/Smooks/target/classes/CustomersTrans.ftl</ftl:template>
<ftl:use>
<!-- Output the templating result to the "orderItemSplitStream" file output stream... -->
<ftl:outputTo outputStreamResource="orderItemSplitStream"/>
</ftl:use>
</ftl:freemarker>
</smooks-resource-list>
CustomersTrans.ftl:
<orderitem id="${.vars["order-item"].@id}" order="${order.@id}">
<customer>
<name>${order.header.customer}</name>
<number>${order.header.customer.@number}</number>
</customer>
<details>
<productId>${.vars["order-item"].product}</productId>
<quantity>${.vars["order-item"].quantity}</quantity>
<price>${.vars["order-item"].price}</price>
</details>
</orderitem>
Получил исключение, как,
org.milyn.cdr.SmooksConfigurationException: Error invoking @Initialize method 'initialize' on class 'org.milyn.templating.freemarker.FreeMarkerTemplateProcessor'.
Я ожидаю, что разделенные данные будут записаны в файлы в указанной папке (E: / Smooks / target / orders)
Не могли бы вы помочь мне исправить вышеупомянутую проблему?
Примечание:
у меня не работает