Search in sources :

Example 1 with Json2XmlValidator

use of nl.nn.adapterframework.pipes.Json2XmlValidator 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("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 Json2XmlValidator

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

the class Json2XmlValidatorSmileyTest method xmlToJsonViaPipe.

public String xmlToJsonViaPipe(String xml) throws ConfigurationException, PipeStartException, PipeRunException {
    Json2XmlValidator json2xml = new Json2XmlValidator();
    json2xml.setWarn(false);
    json2xml.setSchema(xsd);
    json2xml.setRoot("x");
    json2xml.setOutputFormat(json2xml.FORMAT_JSON);
    json2xml.setThrowException(true);
    json2xml.registerForward(new PipeForward("success", null));
    json2xml.configure();
    json2xml.start();
    IPipeLineSession pipeLineSession = new PipeLineSessionBase();
    PipeRunResult prr = json2xml.doPipe(xml, pipeLineSession);
    return (String) prr.getResult();
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Json2XmlValidator(nl.nn.adapterframework.pipes.Json2XmlValidator) PipeForward(nl.nn.adapterframework.core.PipeForward) IPipeLineSession(nl.nn.adapterframework.core.IPipeLineSession) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase)

Example 3 with Json2XmlValidator

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

the class Json2XmlValidatorSmileyTest method jsonToXmlViaPipe.

public String jsonToXmlViaPipe(String json) throws ConfigurationException, PipeStartException, PipeRunException {
    Json2XmlValidator json2xml = new Json2XmlValidator();
    json2xml.setWarn(false);
    json2xml.setSchema(xsd);
    json2xml.setRoot("x");
    json2xml.setThrowException(true);
    json2xml.registerForward(new PipeForward("success", null));
    json2xml.configure();
    json2xml.start();
    IPipeLineSession pipeLineSession = new PipeLineSessionBase();
    PipeRunResult prr = json2xml.doPipe(json, pipeLineSession);
    return (String) prr.getResult();
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Json2XmlValidator(nl.nn.adapterframework.pipes.Json2XmlValidator) PipeForward(nl.nn.adapterframework.core.PipeForward) IPipeLineSession(nl.nn.adapterframework.core.IPipeLineSession) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase)

Aggregations

PipeForward (nl.nn.adapterframework.core.PipeForward)3 Json2XmlValidator (nl.nn.adapterframework.pipes.Json2XmlValidator)3 IPipeLineSession (nl.nn.adapterframework.core.IPipeLineSession)2 PipeLineSessionBase (nl.nn.adapterframework.core.PipeLineSessionBase)2 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)2 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)1 JsonPipe (nl.nn.adapterframework.pipes.JsonPipe)1