@@ -0,0 +1,2355 @@
+package com.equalize.xpi.af.modules.json;%0A%0Aimport com.equalize.xpi.af.modules.util.AbstractModuleConverter;%0Aimport com.equalize.xpi.af.modules.util.AuditLogHelper;%0Aimport com.equalize.xpi.af.modules.util.DynamicConfigurationHelper;%0Aimport com.equalize.xpi.af.modules.util.ParameterHelper;%0Aimport com.equalize.xpi.util.converter.ConversionDOMInput;%0Aimport com.equalize.xpi.util.converter.ConversionJSONOutput;%0Aimport com.equalize.xpi.util.converter.XMLElementContainer;%0Aimport com.sap.aii.af.lib.mp.module.ModuleException;%0Aimport com.sap.engine.interfaces.messaging.api.Message;%0Aimport com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;%0A%0Apublic class XML2JSONConverter extends AbstractModuleConverter %7B%0A%09private ConversionDOMInput domIn;%0A%09private ConversionJSONOutput jsonOut;%0A%09private XMLElementContainer rootXML;%0A%09private int indentFactor;%0A%09private boolean skipRootNode;%0A%0A%09public XML2JSONConverter(Message msg, ParameterHelper param, AuditLogHelper audit, DynamicConfigurationHelper dyncfg) %7B%0A%09%09super(msg, param, audit, dyncfg);%0A%09%7D%0A%09@Override%0A%09public void retrieveModuleParameters() throws ModuleException %7B%0A%09%09this.indentFactor = this.param.getIntParameter(%22indentFactor%22);%0A%09%09this.skipRootNode = this.param.getBoolParameter(%22skipRootNode%22);%0A%09%7D%0A%0A%09@Override%0A%09public void parseInput() throws ModuleException %7B%0A%09%09try %7B%0A%09%09%09// Parse input XML contents%0A%09%09%09this.domIn = new ConversionDOMInput(this.payload.getInputStream());%0A%09%09%09this.audit.addLog(AuditLogStatus.SUCCESS, %22Parsing input XML%22);%0A%09%09%09this.rootXML = this.domIn.extractDOMContent();%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09this.audit.addLog(AuditLogStatus.ERROR, e.getMessage());%0A%09%09%09throw new ModuleException(e.getMessage(), e);%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public byte%5B%5D generateOutput() throws ModuleException %7B%0A%09%09try %7B%0A%09%09%09// Create output converter and generate output JSON%0A%09%09%09this.jsonOut = new ConversionJSONOutput();%0A%09%09%09this.audit.addLog(AuditLogStatus.SUCCESS, %22Constructing output JSON%22);%0A%09%09%09String output = this.jsonOut.generateJSONText(this.rootXML, this.skipRootNode, this.indentFactor);%0A%0A%09%09%09this.audit.addLog(AuditLogStatus.SUCCESS, %22Conversion complete%22);%0A%09%09%09this.payload.setContentType(%22application/json; charset=utf-8%22);%0A%09%09%09return output.getBytes();%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09this.audit.addLog(AuditLogStatus.ERROR, e.getMessage());%0A%09%09%09throw new ModuleException(e.getMessage(), e);%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create XML2JSONConverter.java