engswee / equalize-cpi-converter

CPI Converter a.k.a. FormatConversionBean for CPI
MIT License
17 stars 10 forks source link

Integration Suite (new CPI name) and new problems #13

Closed bdbais closed 1 year ago

bdbais commented 1 year ago

Hi I'm trying to use your library and I have this error:

Error Details javax.script.ScriptException: java.lang.Exception: java.lang.ClassCastException: java.util.ArrayList (loaded by ) cannot be cast to java.lang.String (loaded by )@ line 65 in excelConverter.groovy, cause: java.lang.ClassCastException: java.util.ArrayList (loaded by ) cannot be cast to java.lang.String (loaded by )

All library imported: // commons-collections4-4.3 // commons-math3-3.6.1 // converter-core-2.3.0 // poi-4.1.0 // poi-ooxml-4.1.0 // poi-ooxml-schemas-4.1.0 // xmlbeans-3.1.0

-----------Groovy Script ----------------

import com.sap.gateway.ip.core.customdev.util.Message
import com.equalize.cpi.converter.FormatConversionBean

// com.equalize.converter.core
//
// Property: convertClass   (com.equalize.converter.core.XML2ExcelConverter)
// Property: indentFactor   ## (2)
// Property: skipRootNode   (Y/N)

// com.equalize.converter.core.JSON2XMLConverter        JSON    XML JSONTransformBean Part 1: Converting JSON content to XML
// com.equalize.converter.core.XML2JSONConverter        XML JSON    JSONTransformBean Part 2: Converting XML to JSON content
// com.equalize.converter.core.Base64DecodeConverter    Base64  Any Base64DecodeConverter – Base64 decoding made easy!
// com.equalize.converter.core.Base64EncodeConverter    Any Base64  Base64EncodeConverter – Base64 encoding made easy!
// com.equalize.converter.core.DeepPlain2XMLConverter   Plain   XML DeepFCCBean – The better FCC at meeting your deep (structure) needs! (Part 2 – Flat File to Deep XML)
// com.equalize.converter.core.XML2DeepPlainConverter   XML Plain   DeepFCCBean – The better FCC at meeting your deep (structure) needs! (Part 1 – Deep XML to Flat File)
// com.equalize.converter.core.Excel2XMLConverter       Excel   XML ExcelTransformBean Part 1: Convert various Excel formats to simple XML easily
// com.equalize.converter.core.XML2ExcelConverter       XML Excel   ExcelTransformBean Part 2: Convert simple XML to various Excel formats easily

def Message processData(Message message) {

    def fcb = new FormatConversionBean(message.exchange, message.getProperties())
    def output = fcb.convert()
    message.setBody(output)
    return message
}

Funny thing... I don't have line 65 on my groovy script, but probably it's groovy magic import.

bdbais commented 1 year ago

image

bdbais commented 1 year ago

image

engswee commented 1 year ago

Hi @bdbais - it's not exactly clear what scenario you are trying to achieve. skipRootNode is a parameter for XML2JSONConverter but you are using XML2ExcelConverter as the converter class.