cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in reading csv payload in scripting right after XML2CSV converter

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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();