我需要从节点js调用WCF dotnet webservice,你们中的任何人都可以建议现在最好的模块。
只是一些引用应该足够了
由于
答案 0 :(得分:2)
答案 1 :(得分:2)
如果WCF服务有一个返回JSON的端点,您应该可以使用基本的node.js HTTP请求命中它。
以下是从节点发出HTTP请求的简单示例。这应该让你开始。将“www.google.com”替换为WCF服务器所在服务器的名称,并更新指向svc文件的路径:
var http = require('http');
var options = {
hostname: 'www.google.com',
port: 80,
path: '/',
method: 'GET'
};
var req = http.request(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('CHUNK: ' + chunk);
});
res.on('end', function () {
console.log('DONE');
});
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
req.end();