Skip to Content
-1
Mar 10, 2021 at 06:03 AM

Returning Status 500: read ECONNRESET on consuming Northwind OData Service - XSA

487 Views

I am trying to consume northwind odata service in XSA application and getting error as "read ECONNRESET".

I have followed the below link to consume the external service
SAP HANA, XS Advanced - Access an external HTTP service

Below is the folder structure of my XSA application

Below is the my mta.yaml file

ID: Demo2
_schema-version: '2.1'
version: 0.0.1
modules:
  - name: Northwind
    type: nodejs
    path: Northwind
    provides:
      - name: Northwind_api
        properties:
          url: '${default-url}'
    requires:
      - name: EXTERNAL_HTTP1
resources:
  - name: EXTERNAL_HTTP1
    type: org.cloudfoundry.existing-service
    parameters:
      service-name: EXTERNAL_HTTP1
    properties:
      EXTERNAL_HTTP1_SERVICE: '${service-name}'

Below is my server.js

/*eslint no-console: 0, no-unused-vars: 0*/
"use strict";


var xsjs  = require("@sap/xsjs");
var xsenv = require("@sap/xsenv");
var port  = process.env.PORT || 3000;


var options = {
	anonymous : true, // remove to authenticate calls
	auditLog : { logToConsole: true }, // change to auditlog service for productive scenarios
	redirectUrl : "/index.xsjs"
};


// configure HANA
try {
	options = Object.assign(options, xsenv.getServices({ hana: {tag: "hana"} }));
} catch (err) {
	console.log("[WARN]", err.message);
}


// configure UAA
try {
	options = Object.assign(options, xsenv.getServices({ uaa: {tag: "xsuaa"} }));
} catch (err) {
	console.log("[WARN]", err.message);
}


// start server
xsjs(options).listen(port);


console.log("Server listening on port %d", port);

Below is my package.json

{
  "dependencies": {
    "@sap/xsenv": "^2",
    "@sap/xsjs": "^6"
  },
  "description": "my description",
  "devDependencies": {
    "@sap/xsjs-test": "^3"
  },
  "files": [],
  "main": "server.js",
  "name": "Northwind",
  "scripts": {
    "start": "node server.js",
    "test": "node testrun.js"
  },
  "engines": {
    "node": "10.x"
  },
  "version": "1.0.0"
}

Please help with the issue.

Attachments