node.js - Calling SOAP API through proxy with node-soap client -
i using node-soap module , it's working fine, except when working behind proxy. can't manage find way set proxy can request api.
soap.createclient(url, function(err, client) { client.myfunction(args, function(err, result) { console.log(result); }); });
it's written in docs :
the options argument allows customize client following properties: request: override request module. httpclient: provide own http client implements request(rurl, data, callback, exheaders, exoptions).
is way go?
in soap.createclient()
options set 'request'
request object has 'proxy'
set using request.defaults()
.
let request = require('request'); let request_with_defaults = request.defaults({'proxy': proxy_url, 'timeout': 5000, 'connection': 'keep-alive'}); let soap_client_options = {'request': request_with_defaults}; soap.createclient(wsdl_url, soap_client_options, function(err, client) {
Comments
Post a Comment