I have little to begin with WSO2 ESB and need to create a scheme that allows me from a .edi file (96a) obtained via VFS (which has already been enabled) transform it into a XML ... for this I am using Smooks and UN / EDIFACT to perform the parsing. When executed gives the following error WSO2:
[2014-01-16 08:16:44,684] ERROR - VFSTransportListener Error processing File URI : file:///home/pwcenter/Proxy_UnEdifact/in/wm_msg_download_xml_tipo_7.edi
org.milyn.cdr.SmooksConfigurationException: Error invoking @Initialize method 'initialize' on class 'org.milyn.smooks.edi.ModelLoader'.
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:457)
at org.milyn.cdr.annotation.Configurator.initialise(Configurator.java:439)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:91)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:66)
at org.milyn.delivery.JavaContentHandlerFactory.create(JavaContentHandlerFactory.java:63)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.addCDU(ContentDeliveryConfigBuilder.java:623)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyCDUStrategy(ContentDeliveryConfigBuilder.java:548)
at org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyStrategy(ContentDeliveryConfigBuilder.java:536)
at org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.iterate(ContentDeliveryConfigBuilder.java:711)
at org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.access$300(ContentDeliveryConfigBuilder.java:690)
at org.milyn.delivery.ContentDeliveryConfigBuilder.extractContentHandlers(ContentDeliveryConfigBuilder.java:484)
at org.milyn.delivery.ContentDeliveryConfigBuilder.load(ContentDeliveryConfigBuilder.java:349)
at org.milyn.delivery.ContentDeliveryConfigBuilder.getConfig(ContentDeliveryConfigBuilder.java:146)
at org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:91)
at org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:65)
at org.milyn.Smooks.createExecutionContext(Smooks.java:411)
at org.milyn.Smooks.createExecutionContext(Smooks.java:374)
at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:103)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.axis2.transport.base.AbstractTransportListener.handleIncomingMessage(AbstractTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.processFile(VFSTransportListener.java:597)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:158)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:107)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.milyn.edisax.EDIConfigurationException: Failed to locate jar file for EDI Mapping Model URN 'org.milyn.edi.unedifact:d96a-mapping:*'. Jar must be available on classpath.
at org.milyn.edisax.util.EDIUtils.getMappingModelConfigStream(EDIUtils.java:300)
at org.milyn.edisax.util.EDIUtils.getMappingModelList(EDIUtils.java:207)
at org.milyn.edisax.util.EDIUtils.loadMappingModels(EDIUtils.java:118)
at org.milyn.smooks.edi.ModelLoader.initialize(ModelLoader.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:453)
... 32 more
The Smooks's configuration is:
<?xml version="1.0"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:unedifact="http://www.milyn.org/xsd/smooks/unedifact-1.4.xsd">
<unedifact:reader mappingModel="urn:org.milyn.edi.unedifact:d96a-mapping:*" />
</smooks-resource-list>
This same configuration I have used in a Java application and me worked perfectly.
Also, I have tried adding the dependencies manually in WSO2 within dropins and lib directories, besides creating the CLASSPATH and even the build-classpath-directory command, but not to avail.
Comrades, After much searching and inquiring, I managed to find a partial, but fully functional, solution. First you must correctly identify the path where you will read the EDIFACT mapping as follows:
With this you can already read the EDIFACT file, but some contain any inconcordancias, as only read one trace, but does not read multiple traces, to fix you must remove the first line:
A quick and easy way is to make a custome Mediator, which take "UNB" to " ' " and remove everything inside it, using a regular expression:
With this we achieved make reading multiple traces of an incoming EDIFACT in WSO2ESB.