user3890186
user3890186

Reputation: 31

how to integrate mule and smooks for mule

I want to integrate smooks into the mule ide.We are trying to shift from webmethods to mule. We have a Edi transformation available in smmoks which we want to make use of.I found Smooks-for-Mule.jar that could be integrated to the mule. I searched the net but couldn't find any examples to help me out.Atleast can you please guide me to what to look for,so i can go ahead,i couldn't find any one experienced in my project to help this out.

This question seems small,but can u guys put an effort on this. First question,by the way..:-}

Upvotes: 3

Views: 277

Answers (1)

Víctor Romero
Víctor Romero

Reputation: 5115

You could use something like the following (slightly modified for your usecase):

public abstract class EdiSmooksTransformer extends AbstractTransformer 
{
    private Smooks smooks; 

    public EdiSmooksTransformer() throws IOException, SAXException 
    {
        smooks = new Smooks();
        smooks.setReaderConfig(new EDIReaderConfigurator("MY_EDI_CONFIG_FILE_PATH_HERE"));
    }

    @Override
    protected Object doTransform(Object src, String enc) throws TransformerException 
    {
        StringResult stringResult = new StringResult();
        smooks.filterSource(new StreamSource((BufferedReader) src), stringResult);
        return stringResult.getResult();
    }

}

Upvotes: 2

Related Questions