cancel
Showing results for 
Search instead for 
Did you mean: 

Can't set up the xshttpdest for xsjs

0 Kudos

Hello colleagues.

I have a problem. I try use Proxy Bridge for SAP Cloud Platform Document Service in XSJS. I create xshttpdest for Proxy Bridge, but when I debug my XSJS I have this problem. When I create this request in Postman, everything works well. What could be the problem? I hope for your answers.

Error:

xshttpdest code:

description = "Connection to Proxy Bridge App";
host = "https://cmisproxy**********.hana.ondemand.com";
pathPrefix = "/cmisproxy/cmis/json";
port = 443;
useProxy = false;
authType = basic;
useSSL = true;
timeout = 0;
sslAuth = anonymous;  

xsjs code:

function getData() 
{
    try
    {
        var Dest = $.net.http.readDestination('***.*********.xsjs.v01', 'documentservice');
        var Request = new $.web.WebRequest($.net.http.GET, '');
        Request.headers.set("Authorization",'Basic **************');
        
        var client = new $.net.http.Client();
    	client.request(Request, Dest); 
    	
    	var response = client.getResponse();
    	var data = response.body.asString();
    	
    	var parse_data = JSON.parse(data);
        return parse_data;
    }
    catch (e)
    {
        return e;
    }
}
getData();     
gregorw
Active Contributor
0 Kudos

Are you in the trial or production environment?

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
Active Contributor
0 Kudos

In the production environment the following destination configuration worked for me:

host = "cmisproxy.hana.ondemand.com";
port = 443;
pathPrefix = "/cmis/json/xyz";
proxyType = http;
proxyHost = "proxy";
proxyPort = 8080;
authType = none;
useSSL = true;
timeout = 0;
oAuthAppConfigPackage = "com.demo.documents";
oAuthAppConfig = "cmisproxyOAconfig";
sslAuth = anonymous;

As I see, it seems I've used oAuth for the authentication. But basic auth might also work depending on your proxy.

Answers (1)

Answers (1)

0 Kudos

Hi gregorw , thanks for the reply.

I use production environment. I don't know why, but when I delete "https://" in host and add proxy, my application is working.

Here is a working version of destination:

host = "cmisproxy********.hana.ondemand.com";
port = 443;
pathPrefix = "/cmisproxy/cmis/json";
proxyType = http;
proxyHost = "proxy";
proxyPort = 8080;
authType = basic;
useSSL = true;
timeout = 0;
sslAuth = anonymous;
gregorw
Active Contributor
0 Kudos

And that is correct. The field is named host and not url.