Skip to Content
avatar image
Former Member

call SOAP XML webservice using xsjs and xshttpdest

Hello All,

I need an urgent help on calling external service using xsjs.

I am getting an error "Error: HttpClient.request: request failed: internal error occurred \"Failed to send request to socket...rc = -1\"".

I have read many blogs regarding this error and tried to replicate the same but still I am getting this error.

My scenario is like I need to call an SOAP webservice by passing username and password. If its authenticated successfully, the SOAP service will trigger an Email.

Also I have uploaded the required certificate on XS trust connection.

Please find my below code:


try {
    var soapenv = 
'<?xml version="1.0" encoding="utf-8"?>'+
'<soapenv:Envelope xmlns:soapenv="" xmlns:xsi="" xmlns:xsd="" xmlns:cxf="" xmlns:web="">'+
' <cxf:invoke>'+
' </cxf:invoke>'+
' <web:logonRequest>'+
'   <userName>ABC</userName>'+
'   <password>XYZ</password>'+
' </web:logonRequest>'+
	var dest = $.net.http.readDestination("com.system.test", "external");
	var client = new $.net.http.Client();
	var req = new $.web.WebRequest($.net.http.POST,"");
	req.contentType = "text/xml";
	client.request(req, dest);
	var response = client.getResponse();
	$.response.contentType = "application/json";
catch (e) {
    // return the error as JSON for debugging
     var errorResponse = {"error": e.toString()};
     $.response.status = $.net.http.INTERNAL_SERVER_ERROR;
     $.response.contentType = "application/json";

Can anyone please help me to figure out what I am actually missing here.



xshttpdest.png (7.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 25, 2017 at 10:11 PM
    Add comment
    10|10000 characters needed characters exceeded