Skip to Content
avatar image
Former Member

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

arg_error.jpg (12.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 13, 2015 at 05:28 AM

    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

    Add comment
    10|10000 characters needed characters exceeded