Неверный протокол с использованием узла- soap (NodeJS, SOAP) - PullRequest
0 голосов
/ 12 февраля 2020

Я разрабатываю сервис для выполнения запроса SOAP, но я столкнулся с ошибкой, и библиотека не может открыть проблему на github.

node- soap

Реализация:

const URL = 'https://nfe.sefaz.go.gov.br/nfe/services/NFeConsultaProtocolo4?wsdl'
const wsSecurity = new soap.ClientSSLSecurityPFX(cert.pfx, cert.passphrase)

const options = {
  preserveWhitespace: false,
  disableCache: true,
  returnFault: true,
  forceSoap12Headers: true,
  wsdl_options: {
    forever: false,
    rejectUnauthorized: false,
    strictSSL: false,
    pfx: cert.pfx,
    passphrase: cert.passphrase,
    connection: 'keep-alive'
  }
}
const client = await soap.createClientAsync(URL, options)
client.setSecurity(wsSecurity)
const response = await client.methodAsync(...header)
...

Поэтому при запуске я получаю следующую ошибку:

TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
at new ClientRequest (_http_client.js:119:11)
at Object.request (http.js:42:10)
at Request.start (/mnt/storage/Projetos/NodeJS/dfe-rfb-service/node_modules/request/request.js:751:32)
at Request.write (/mnt/storage/Projetos/NodeJS/dfe-rfb-service/node_modules/request/request.js:1491:10)
at end (/mnt/storage/Projetos/NodeJS/dfe-rfb-service/node_modules/request/request.js:549:18)
at Immediate.<anonymous> (/mnt/storage/Projetos/NodeJS/dfe-rfb-service/node_modules/request/request.js:578:7)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
at process.topLevelDomainCallback (domain.js:126:23)
...