Skip to Content
Jan 22, 2018 at 08:58 PM

How to remove "/" after hostname while reading odata service from xsjs file



I have created xshttpdest and xsjs file. My requirement is to read the service from the xsjs file. While running the xsjs file one extra "/" is added in the service url after hostname from where i want to get the data and the xsjs file is giving below error {"ERROR":"HttpClient.request: request failed: response from xxxxxxx/:80/sap/opu/odata/iwpgw/TASKPROCESSING;v=2/TaskCollection('83')/Description is pending...please retrieve it first with getResponse()"}

I want to create this url xxxxxxx:80/sap/opu/odata/iwpgw/TASKPROCESSING;v=2/TaskCollection('83')/Description "hostname:port/pathprefix" Please let me know how to remove "/" after hostname. Destination code: host ="xxxxxxx"; port =80; description ="ABAP Gateway test"; pathPrefix="sap/opu/odata/iwpgw/TASKPROCESSING;v=2/TaskCollection('83')/Description"; authType =basic; timeout =0; xsjs code try{ //Reading the destination properties destination = $.net.http.readDestination("test12.Services","dest00"); //Creating HTTP Client client = new $.net.http.Client(); //Creating Request request = new $.web.WebRequest($.net.http.GET,"?$format=json"); client.request(request,destination); $.response.setBody(client.getResponse().body.asString()); } catch(errorObj){ $.response.setBody(JSON.stringify({ ERROR : errorObj.message })); }