Search in sources :

Example 1 with JsonPipe

use of nl.nn.adapterframework.pipes.JsonPipe in project iaf by ibissource.

the class Json2XmlValidatorTest method init.

protected void init() throws ConfigurationException {
    jsonPipe = new JsonPipe();
    jsonPipe.setName("xml2json");
    jsonPipe.registerForward(new PipeForward("success", null));
    jsonPipe.setDirection(Direction.XML2JSON);
    jsonPipe.configure();
    try {
        validator = implementation.newInstance();
    } catch (IllegalAccessException e) {
        throw new ConfigurationException(e);
    } catch (InstantiationException e) {
        throw new ConfigurationException(e);
    }
    validator.setThrowException(true);
    validator.setFullSchemaChecking(true);
    instance = new Json2XmlValidator();
    instance.registerForward(new PipeForward("success", null));
    instance.setSoapNamespace(null);
    instance.setFailOnWildcards(false);
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Json2XmlValidator(nl.nn.adapterframework.pipes.Json2XmlValidator) JsonPipe(nl.nn.adapterframework.pipes.JsonPipe) PipeForward(nl.nn.adapterframework.core.PipeForward)

Example 2 with JsonPipe

use of nl.nn.adapterframework.pipes.JsonPipe in project iaf by ibissource.

the class RestListener method transformToJson.

public String transformToJson(String message) throws PipeRunException {
    JsonPipe pipe = new JsonPipe();
    pipe.setDirection(Direction.XML2JSON);
    PipeRunResult pipeResult = pipe.doPipe(new Message(message), new PipeLineSession());
    try {
        return pipeResult.getResult().asString();
    } catch (IOException e) {
        throw new PipeRunException(null, "cannot transform result", e);
    }
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Message(nl.nn.adapterframework.stream.Message) JsonPipe(nl.nn.adapterframework.pipes.JsonPipe) PipeRunException(nl.nn.adapterframework.core.PipeRunException) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) IOException(java.io.IOException)

Example 3 with JsonPipe

use of nl.nn.adapterframework.pipes.JsonPipe in project iaf by ibissource.

the class RestListener method transformToXml.

public String transformToXml(String message) throws PipeRunException {
    JsonPipe pipe = new JsonPipe();
    PipeRunResult pipeResult = pipe.doPipe(new Message(message), new PipeLineSession());
    try {
        return pipeResult.getResult().asString();
    } catch (IOException e) {
        throw new PipeRunException(null, "cannot transform result", e);
    }
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Message(nl.nn.adapterframework.stream.Message) JsonPipe(nl.nn.adapterframework.pipes.JsonPipe) PipeRunException(nl.nn.adapterframework.core.PipeRunException) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) IOException(java.io.IOException)

Aggregations

JsonPipe (nl.nn.adapterframework.pipes.JsonPipe)3 IOException (java.io.IOException)2 PipeLineSession (nl.nn.adapterframework.core.PipeLineSession)2 PipeRunException (nl.nn.adapterframework.core.PipeRunException)2 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)2 Message (nl.nn.adapterframework.stream.Message)2 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)1 PipeForward (nl.nn.adapterframework.core.PipeForward)1 Json2XmlValidator (nl.nn.adapterframework.pipes.Json2XmlValidator)1