Created
April 21, 2012 17:43
-
-
Save yaronn/2438720 to your computer and use it in GitHub Desktop.
ws.js sample
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 ws = require('ws.js') | |
, Http = ws.Http | |
, Security = ws.Security | |
, UsernameToken = ws.UsernameToken | |
var request = '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">' + | |
'<Header />' + | |
'<Body>' + | |
'<EchoString xmlns="http://tempuri.org/">' + | |
'<s>123</s>' + | |
'</EchoString>' + | |
'</Body>' + | |
'</Envelope>' | |
var ctx = { request: request | |
, url: "http://service/security" | |
, action: "http://tempuri.org/EchoString" | |
, contentType: "text/xml" | |
} | |
var handlers = [ new Security({}, [new UsernameToken({username: "yaron", password: "1234"})]) | |
, new Http() | |
] | |
ws.send(handlers, ctx, function(ctx) { | |
console.log("response: " + ctx.response); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment