/scripts/ahub.form.attachments.js
0

HANA XS JS - Web service call error Request Failed

Apr 04, 2017 at 11:00 PM

380

avatar image

Hi, I'm calling a web service from XS Engine but I get a socket error as follows please help.

HttpClient.request:request failed:internal error occurred "Failed to send request to socket...rc = -1"

HttpDest

description = "Servicio Validacion";
host = "cfdiws.xxxxx.com";
port = 443;
pathPrefix = "/XXXXX/services/CFDi?wsdl";
proxyType = none;
proxyHost = "";
proxyPort = 0;
authType = none;
useSSL = true;
timeout = 30000;

XSJS File

try{
var dest = $.net.http.readDestination("PORTAL.services", "edicom");
var client = new $.net.http.Client();
var req = new $.web.WebRequest($.net.http.GET, "/XXXXX/services/CFDi?wsdl");

client.request(req, dest);
var response= client.getResponse();

$.response.contentType = "application/xml";
$.response.setBody(response);
$.response.status = $.net.http.OK;
}
catch(err){
$.response.contentType = "text/plain";
$.response.setBody("Error while executing query: [" + err.message + "]");
$.response.returnCode = 200;
}


10 |10000 characters needed characters left characters exceeded

@Ronald! Did you figure the issue? I am seeing the same error.

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Oliver Schmidt Apr 19, 2017 at 02:41 PM
0

Hi Ronald,
I don't have seen this error before but i want to rule out some possible mistakes.

Please refer to the demo here and verify the following information:

1) Does this refer to the correct package and name of the destination?

The first argument shouls be the package of the destination and the second should be the name of the destination

var dest = $.net.http.readDestination("PORTAL.services", "edicom");

2) Also check if you are correctly using the path prefix. In the example the path prefix doesn't reappear while creating the request. The prefix is added one time while calling the destination and shouldn't be used twice.

P.S: The destination should be in the same folder or a subfolder of the folder where your xsjs file is located.

Greetings and i hope it helps,

Oliver Schmidt

Share
10 |10000 characters needed characters left characters exceeded
Skip to Content