-
-
Save yaronn/2790644 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var wcf = require('wcf.js') | |
, fs = require("fs") | |
, TextMessageEncodingBindingElement = wcf.TextMessageEncodingBindingElement | |
, HttpTransportBindingElement = wcf.HttpTransportBindingElement | |
, SecurityBindingElement = wcf.SecurityBindingElement | |
, CustomBinding = wcf.CustomBinding | |
, Proxy = wcf.Proxy | |
var binding = new CustomBinding( | |
[ new SecurityBindingElement({AuthenticationMode: "MutualCertificate"}) | |
, new TextMessageEncodingBindingElement( | |
{MessageVersion: "Soap11WSAddressing10"}) | |
, new HttpTransportBindingElement() | |
]) | |
var proxy = new Proxy(binding, "http://localhost:7171/Service") | |
proxy.ClientCredentials.ClientCertificate.Certificate = | |
fs.readFileSync("client.pem").toString() | |
var message = "<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'>" + | |
"<Header />" + | |
"<Body>" + | |
"<GetData xmlns='http://tempuri.org/'>" + | |
"<value>123</value>" + | |
"</GetData>" + | |
"</Body>" + | |
"</Envelope>" | |
proxy.send(message, "http://tempuri.org/IService/GetData", | |
function(message, ctx) { | |
console.log(ctx) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment