Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"<header>" +
"" +
"" +
"123" +
"" +
"" +
""
var ctx = { request: request
, url: "http://localhost:7171/Service/soap11wsa0408" //can also send to www.google.com if just testing the pipeline
, action: "http://tempuri.org/IService/GetData"
, contentType: "text/xml"
}
var handlers = [ new ws.Addr("http://schemas.xmlsoap.org/ws/2004/08/addressing")
, new ws.Http()
]
ws.send(handlers, ctx, function(ctx) {
console.log("response: " + ctx.response);
})
</header>
function AddAddressing(addr, handlers)
{
if (!addr) return
var v = messageVersionToAddressingVersion(addr)
//we unshift and not pop. wsa channel must be first so it is before security.
//otherwise security cannot sign the wsa.
if (v) handlers.unshift(new ws.Addr(v))
}
{ "key": fs.readFileSync("client.pem").toString()})
var signature = new ws.Signature(x509)
signature.addReference("//*[local-name(.)='Body']")
signature.addReference("//*[local-name(.)='Timestamp']")
//validateResponseSignature determines if we should validate any incoming signature.
var sec = new ws.Security({"validateResponseSignature": true},
[ x509,
signature
])
//only required if you specified validateResponseSignature as true
sec.options.responseKeyInfoProvider = new FileKeyInfo("server_public.pem")
var handlers =
[ new ws.Addr("http://www.w3.org/2005/08/addressing")
, sec
, new ws.Http()
]
request = "" +
"<header>" +
"" +
"" +
"123" +
"" +
"" +
""
var ctx = { request: request
, url: "http://localhost:7171/Service/sign_body_timestamp_wsa"
, action: "http://tempuri.org/IService/GetData"
</header>