forked from ismetkizgin/nodejs-soap-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (28 loc) · 711 Bytes
/
server.js
File metadata and controls
31 lines (28 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var soap = require("soap");
var app = require("express")();
var fs = require("fs");
var xml = fs.readFileSync("service.wsdl", "utf8");
const cors = require("cors");
app.use(cors());
var port = 5001;
var serviceObject = {
HelloService: {
HelloServiceSoapPort: {
HelloFunction: (args) => {
console.log("Hello Function Start");
return `Hello ${args.name.toUpperCase()}`;
},
},
},
};
app.listen(port, function () {
console.log("Listening on port " + port);
var wsdl_path = "/hello";
soap.listen(app, wsdl_path, serviceObject, xml);
console.log(
"Check http://localhost:" +
port +
wsdl_path +
"?wsdl to see if the service is working"
);
});