Wcf.js - 直接在 Node.js 上調用 WCF Web 服務
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) });
本文由用戶 openkk1 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!