Как предоставить услугу wsdl с node js - PullRequest
0 голосов
/ 27 января 2020

Как создать сервер wsdl soap с Node js? Я нашел npm soap, но я немного запутался. Я слушаю express сервер, но когда я набираю путь, который прослушивает soap сервер, ничего не происходит.

const soap = require('soap');
const myService = {
 MyService: {
  MyPort: {
   MyFunction: args => {
    return {
      name: args.name,
    };
   },
  },
 },
};
const xml = require('fs').readFileSync('myservice.wsdl', 'utf8');
module.exports = { soap, xml, myService };

Это мой express сервер:

require('@babel/register')({ extensions: ['.js', '.ts'] });
require('dotenv').config();
const app = require('../app');
const config = require('../config');
const { soap, xml, myService } = require('../soap/WSDLServer');

const SERVER_PORT = config.port || 4000;

app.listen(SERVER_PORT, () => {
 console.log(`api server is running in :${SERVER_PORT} port`);
 soap.listen(app, '/wsdl', myService, xml);
});
...