on 02-21-2014 3:24 PM
Hi All,
Perhaps someone has already tried to call a Web Service from HANA via .xshttpdest.
Here is the destination file: name = sapmmcS74.xshttpdest
host = "10.66.176.252";
port = 50013;
description = "sapmmc on S74";
useSSL = false;
pathPrefix = "/SAPControl.cgi";
authType = none;
useProxy = false;
proxyHost = "";
proxyPort = 0;
timeout = 0;
and the corresponding server-side javascript is:
//<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:SAPControl">
//<soapenv:Header/>
//<soapenv:Body>
// <urn:GetSystemInstanceList>
// <timeout>0</timeout>
// </urn:GetSystemInstanceList>
//</soapenv:Body>
//</soapenv:Envelope>
try{
var soapenv = "";
soapenv = soapenv.concat("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:SAPControl\">");
soapenv = soapenv.concat("<soapenv:Header/>");
soapenv = soapenv.concat("<soapenv:Body>");
soapenv = soapenv.concat("<urn:GetSystemInstanceList>");
soapenv = soapenv.concat("<timeout>0</timeout>");
soapenv = soapenv.concat("</urn:GetSystemInstanceList>");
soapenv = soapenv.concat("</soapenv:Body>");
soapenv = soapenv.concat("</soapenv:Envelope>");
var dest = $.net.http.readDestination("services", "sapmmcS74");
var client = new $.net.http.Client();
var req = new $.web.WebRequest($.net.http.POST, soapenv);
client.request(req, dest);
var response = client.getResponse();
if(response.body){
$.response.setBody(response.body.asString());
}
else {
$.response.setBody( "error" );
}
$.response.status = response.status;
$.response.contentType = "text/xml; charset=utf-8";
}
catch(x){
$.response.status = 500;
$.response.setBody( x.message );
}
Both are in the same package/folder "services".
When I test the .xsjs I receive always the error: User is not authorized to use destination (package: services, name: sapmmcS74).
I assigned all possible authorities in HANA to my user: sap.hana.xs.admin.roles::HTTPDestAdministrator as well as package privileges etc. but the error is not resolved.
Any ideas?
Thanks,
Hristina
The same issue was solved when I put .xshttpdest file and .xsjs file in the same package (technically in the same folder)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
I am getting same issue even though i kept both .xshttpdest and .xsjs file under same folder.
Package hierarchy is as shown below.
Found the following errors:
===========================
Error: User is not authorized to use destination (package: testApp, name: Images) (line 3 position 0 in /workshop/sessiona/00/LatestXS/Bhupender/httpdestination/searchImages.xsjs)
line 3 is :- var dest = $.net.http.readDestination("testApp", "Images");
Thanks
Bhupender
The package hierarchy that you show in your screen shot is the not the same as the one in your code or the error message. In your code your package is testApp, but the package hierarchy in your screen shot is LatestXS.Bhupender.httpdestination. I would assume your source code is incorrect here shouldn't be using testApp as the package path to the Images.xshttpdest.
Hi Thomas,
I was going through your video regarding outbound connectivity, it was really helpful.
(XSJS Outbound Connectivity SPS6 - YouTube)
I am facing one issue with the last part.
when i execute my .xsjs file
Found the following errors:
===========================
Error: HttpClient.getResponse: Can't get the response from the server. The following error occured: internal error occurred "Connection to www.loc.gov broke down while reading response." (line 11 position 0 in /workshop/sessiona/00/LatestXS/Bhupender/httpdestination/searchImages.xsjs)
line 11 := var response = client.getResponse();
Thanks
Bhupender
Does this error happen consistently? I've never seen it before but broken down while reading response makes it sound like you had a connection to the remote server and then lost it. Seems like something that would transitory. Have you tried other destinations? Are your proxy settings correct?
Hi Thomas,
I am not able to connect to this remote server even once.
And yes, I am able to connect to host = "download.finance.yahoo.com" which is explained in HANA developer guide.
And sir, As i am using AWS HANA instance. So i set useProxy = false;
let me know if i am going wrong somewhere.
Thanks
Bhupender
Hi Thomas,
In case i set the proxy then error comes to line "client.request(req, dest);"
Found the following errors:
===========================
Error: HttpClient.request: request failed. The following error occured: unable to establish connection to proxy:8080 - internal error code: resolving DNS host name failed.
This scenario is faced by one of our customers, who are not SAP Employee and their AWS instance is not running through the CAL.
Thanks
Bhupender
Did you find a resolution to this problem? I'm having the same issue here on a Hana 70 instance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same issue.
I read this comment maybe it could help you.
I moved the .xshttpdest in the same package where it is used and know it works.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.