I am currently testing the use of the Smooks API with Unedifact mapping/binding jars for parsing Edifact messages into XML and POJOs.
In my test code, when I parse Edi messages into XML, I get the XML output for the given Edifact messages as expected (when passing StreamResult(writer) instance to smooks.filterSource()). However, when I try to parse the same Edi messages into POJOs (using JavaResult instance), I only seem to get null beans out of it.
UNEdifactReaderConfigurator readerConfig =
File edi = new File("test-data.edi");
InputStream is = new FileInputStream(edi);
JavaResult result = new JavaResult();
Smooks smooks = new Smooks();
smooks.filterSource(new StreamSource(is), result);
I was able to solve the problem by adding the Cusdec's bindingconfig.xml binding configuration to the smooks instance's setup (See edited code above). However, if we are parsing different message types, then each type's binding config needs to be added. Not sure if this is the correct way of setting up smooks for this scenario.
The binding configuration for d04a's Cusdec was included by adding the following two lines of code: