ws.js icon indicating copy to clipboard operation
ws.js copied to clipboard

SSL key

Open zbessler opened this issue 11 years ago • 3 comments

I see in the readme that you support soap over SSL, but I cant find any documentation or examples on how you implement which key you use for SSL.

I currently have a setup to make use of the X509BinarySecurityToken and that adds everything to the request great, but how to I tell it what cert to use for SSL?

zbessler avatar Dec 11 '14 18:12 zbessler

X509BinarySecurityToken is a message security feature (not related to ssl). The message security samples in the README show how to use certificate.

SSL, is different, it is transport security. If you are the client than usually you do not have a certificate and the server will send it in runtime so nothing to do. If you do have a client ssl certificate then you can configure the npm 'request' module to use it in ws.js file: lib/handlers/client/http.js.

yaronn avatar Dec 23 '14 16:12 yaronn

Hi @yaronn, in the case we have key and cert...

it is enough to have the agentOptions object into ctx like this?

  let ctx = {
    request: xml,
    url: url,
    action: action,
    contentType: 'application/soap+xml',
    agentOptions: {
      key: certificate.key,
      cert: certificate.cert
    }
  };

And then

var handlers =  [new ws.Mtom(), new ws.Http()];
ws.send(handlers, ctx, function (ctx) {
...
});

jcampanaaxa avatar Oct 21 '16 06:10 jcampanaaxa

Hi, I assume you use ssl. This should be enough. In the end all these settings are propagated to the request module here: https://github.com/yaronn/ws.js/blob/5ea2b0510f9724f98b317b0b00172720fb2e7404/lib/handlers/client/http.js#L17

so you should debug to verify they reach there and debug request if necessary.

yaronn avatar Oct 21 '16 22:10 yaronn