你如何创建 node-soap wsdl 文件?
How do you create node-soap wsdl file?
我正在阅读有关如何创建服务器 Web 服务的节点肥皂文档。除了如何创建 myservice.wsdl(根据下面的代码片段)之外,我了解有关创建 Web 服务的所有内容。如果有人根据 node-soap 文档创建了 web 服务,请指导我如何创建 wsdl 文件。提前谢谢你。
var myService = {
MyService: {
MyPort: {
MyFunction: function(args) {
return {
name: args.name
};
},
// This is how to define an asynchronous function.
MyAsyncFunction: function(args, callback) {
// do some work
callback({
name: args.name
});
},
// This is how to receive incoming headers
HeadersAwareFunction: function(args, cb, headers) {
return {
name: headers.Token
};
},
// You can also inspect the original `req`
reallyDetailedFunction: function(args, cb, headers, req) {
console.log('SOAP `reallyDetailedFunction` request from ' + req.connection.remoteAddress);
return {
name: headers.Token
};
}
}
}
};
var xml = require('fs').readFileSync('myservice.wsdl', 'utf8');
//http server example
var server = http.createServer(function(request,response) {
response.end('404: Not Found: ' + request.url);
});
server.listen(8000);
soap.listen(server, '/wsdl', myService, xml);
//express server example
var app = express();
//body parser middleware are supported (optional)
app.use(bodyParser.raw({type: function(){return true;}, limit: '5mb'}));
app.listen(8001, function(){
//Note: /wsdl route will be handled by soap module
//and all other routes & middleware will continue to work
soap.listen(app, '/wsdl', myService, xml);
});
Node.js SOAP 模块的 None(据我所知)为您创建了一个 WSDL 文件。
您可以使用服务来创建 WSDL。
一个例子是 http://marin.jb.free.fr/wsdl/,您可以使用它为您想要的任何服务创建 WSDL 文件。
我正在阅读有关如何创建服务器 Web 服务的节点肥皂文档。除了如何创建 myservice.wsdl(根据下面的代码片段)之外,我了解有关创建 Web 服务的所有内容。如果有人根据 node-soap 文档创建了 web 服务,请指导我如何创建 wsdl 文件。提前谢谢你。
var myService = {
MyService: {
MyPort: {
MyFunction: function(args) {
return {
name: args.name
};
},
// This is how to define an asynchronous function.
MyAsyncFunction: function(args, callback) {
// do some work
callback({
name: args.name
});
},
// This is how to receive incoming headers
HeadersAwareFunction: function(args, cb, headers) {
return {
name: headers.Token
};
},
// You can also inspect the original `req`
reallyDetailedFunction: function(args, cb, headers, req) {
console.log('SOAP `reallyDetailedFunction` request from ' + req.connection.remoteAddress);
return {
name: headers.Token
};
}
}
}
};
var xml = require('fs').readFileSync('myservice.wsdl', 'utf8');
//http server example
var server = http.createServer(function(request,response) {
response.end('404: Not Found: ' + request.url);
});
server.listen(8000);
soap.listen(server, '/wsdl', myService, xml);
//express server example
var app = express();
//body parser middleware are supported (optional)
app.use(bodyParser.raw({type: function(){return true;}, limit: '5mb'}));
app.listen(8001, function(){
//Note: /wsdl route will be handled by soap module
//and all other routes & middleware will continue to work
soap.listen(app, '/wsdl', myService, xml);
});
None(据我所知)为您创建了一个 WSDL 文件。
您可以使用服务来创建 WSDL。
一个例子是 http://marin.jb.free.fr/wsdl/,您可以使用它为您想要的任何服务创建 WSDL 文件。