Smooks unedifact JavaResult Bean is null

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Smooks unedifact JavaResult Bean is null

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.

Test Code:

UNEdifactReaderConfigurator readerConfig =
new UNEdifactReaderConfigurator("urn:org.milyn.edi.unedifact:d04a-mapping:*");

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);

Cusdec cusdec = (Cusdec) result.getBean("cusdec");

Debugging shows that cusdec object is null and result object displays the following content

  <delimiterChars class="linked-hash-set">



I was expecting the result object to contain something like


Any ideas why this might be?

Cheers, PM.
Reply | Threaded
Open this post in threaded view

Re: Smooks unedifact JavaResult Bean is null

This post was updated on .
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:

InputStream cis = DataParserTest.class.getResourceAsStream(