Skip to Content
avatar image
Former Member

Issue in reading csv payload in scripting right after XML2CSV converter

Hi All,

Does anyone as used scripting right after XML2CSV converter ?

once csv comes as payload to scripting, in tracing i can see and confirm csv is passing on to the script.

But it still says " java.lang.NoSuchMethodException: No signature of method: java.io.ByteArrayOutputStream.readLines() is applicable for argument types: () values: []"

I am trying to read the payload which is csv as readLines . I am not sure the reason because when i hard code the flat file in content modifier body and read the lines in the script it executes successfully .

please find the screen shot for the same :

Input for the script:

And the script is as follows:

import com.sap.gateway.ip.core.customdev.util.Message;

import java.util.HashMap;

def Message processData(Message message) {

//Body

def body = message.getBody();

def BodyList = body.readLines();

def messageLog = messageLogFactory.getMessageLog(message);

def count=BodyList.size();

def gpid=''

if(count>0)

{

for(i=0;i<=BodyList.size-1;i++)

{

def line = BodyList[i]

personid=personid+','+line.split(",")[0]

}

messageLog.setStringProperty("inactive personid",''+personid);

}

message.setBody(body);

return message;

}

Thanks,

Pradeep KN

issue.PNG (87.6 kB)
input.PNG (64.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 05, 2016 at 06:54 PM

    The following issue is resolved by reading the message as a string instead of getbody()

    def body = message.getBody(java.lang.String); def BodyList = body.readLines();
    Add comment
    10|10000 characters needed characters exceeded