Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

WebEntityResponse.setBody : wrong number of arguments

Hi Experts

I'm trying  to expose my table profile through XSJS but I'm getting the following error.

Found the following errors:

===========================

Error: WebEntityResponse.setBody : wrong number of arguments (line 24 position 0 in /TM/services/profile.xsjs)

URL PARAMETER

http://54.XXX.114.137:8000/TM/services/profile.xsjs?Cmd=filter

I know its a silly error i'm not able to figure it.

profile.xsjs

function exposeProfile(){

  try{

  var responseArray = [];

  var queryStatement = 'SELECT * FROM SAP_HANA_TM.TM.data::profile';

  var conn = $.db.getConnection("TM.services::Anonymous_Access");

  //var conn = $.db.getConnection();

  var pstmt= conn.prepareStatement(queryStatement);

  var rs = pstmt.executeQuery();

  while (rs.next()) {

  

  responseArray.push({'FIRSTNAME':rs.getString(1),'HEADLINE':rs.getString(2),'PID':rs.getString(3),'DOMAIN':rs.getString(4),'LASTNAME':rs.getString(5),

  'PICURL':rs.getString(7),'PROFILEURL':rs.getString(8)});

  $.response.contentType = 'application/json';

  }

  $.response.setBody(JSON.stringify(responseArray));

  $.response.status=$.net.http.OK;

}

  catch(e){

  $.response.status=$.net.http.INTERNAL_SERVER_ERROR;

  $.response.setBody();

  return;

  }

}

var aCmd=$.request.parameters.get('Cmd');

switch(aCmd){

case 'filter': exposeProfile();

  break;

default : $.response.status=$.net.http.INTERNAL_SERVER_ERROR;

}

Directory

Tags:
Former Member
Former Member replied

Hi Shashank,

I guess the error "wrong number of arguments" is because of line 20 in your code snippet. Please try to set a string, e.g., "error".

$.response.setBody();

Best regards,

Wenjun

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question