Skip to content

Instantly share code, notes, and snippets.

@yaronn
Created April 21, 2012 17:43
Show Gist options
  • Save yaronn/2438720 to your computer and use it in GitHub Desktop.
Save yaronn/2438720 to your computer and use it in GitHub Desktop.
ws.js sample
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