Wcf.js - 直接在 Node.js 上调用 WCF Web 服务

openkk1 12年前

Wcf.js 可以让你直接在 Node.js 上调用 WCF Web 服务。

示例代码:

var BasicHttpBinding = require('wcf.js').BasicHttpBinding    , Proxy = require('wcf.js').Proxy    , binding = new BasicHttpBinding(          { SecurityMode: "TransportWithMessageCredential"          , MessageClientCredentialType: "UserName"          })    , proxy = new Proxy(binding, "http://localhost:7171/Service/clearUsername")    , message =  "<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'>" +                   "<Header />" +                     "<Body>" +                       "<GetData xmlns='http://tempuri.org/'>" +                         "<value>123</value>" +                       "</GetData>" +                      "</Body>" +                 "</Envelope>"  proxy.ClientCredentials.Username.Username = "yaron"  proxy.ClientCredentials.Username.Password = "1234"  proxy.send(message, "http://tempuri.org/IService/GetData", function(response, ctx) {    console.log(response)  });    

项目主页:http://www.open-open.com/lib/view/home/1336640628390