如何使用Node JS提供wsdl服务

时间:2020-01-27 05:52:27

标签: javascript node.js xml soap wsdl

如何使用Node js创建wsdl soap服务器?我找到了npm肥皂,但有点困惑。 我正在监听Express服务器,但是当我输入哪个监听肥皂服务器的路径时,什么也没发生。

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 };

这是我的快递服务器:

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);
});

0 个答案:

没有答案