Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added proxy option to soap request using axios proxy #17

Merged
merged 1 commit into from
Mar 29, 2019

Conversation

razone
Copy link
Contributor

@razone razone commented Mar 28, 2019

--Added config to allow the use of proxy
--Changed from axios to axios https proxy fix to allow proxy to https

@coveralls
Copy link

Pull Request Test Coverage Report for Build 86

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 85: 0.0%
Covered Lines: 10
Relevant Lines: 10

💛 - Coveralls

@circa10a circa10a merged commit dd522b6 into circa10a:master Mar 29, 2019
@manuel-delaiglesia
Copy link

manuel-delaiglesia commented Jun 7, 2021

I am connected through a corporate proxy. When using this proxy option, I get:

SOAP FAIL: Error: Request failed with status code 404
e <!DOCTYPE html>
<html>
    <head>
        <title>The resource cannot be found.</title>
...
    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>The resource cannot be found.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.
            <br><br>

            <b> Requested URL: </b>/webservice/<remaining path>.asmx<br><br>
...

Note that the requested address appears partially.
easy-soap-request version: 3.4.0

@circa10a
Copy link
Owner

circa10a commented Jun 8, 2021

Can you try version 2.5.0? @manuel-delaiglesia

@manuel-delaiglesia
Copy link

manuel-delaiglesia commented Jun 10, 2021

Can you try version 2.5.0? @manuel-delaiglesia

Tested using version 4.1.3 and failed.
Tested using version 2.50 also failed. When testing this version, had to move url parameter outside structure:

module.exports = function soapRequest(url, headers, xml, timeout = 10000, proxy = false) {
  return new Promise((resolve, reject) => {
    axios(url,{
      method: 'post',

to avoid this error:
SOAP FAIL: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received an instance of Object

@circa10a
Copy link
Owner

That version just uses raw function parameters where starting with v3+, an object is used

@manuel-delaiglesia
Copy link

manuel-delaiglesia commented Jun 10, 2021

Test success using version 4.1.3.
Was following https://stackoverflow.com/questions/62286878/cant-make-https-soap-call-through-corporate-proxy-getaddrinfo-enotfound
wich was using Axios in a wrong way:
https://masteringjs.io/tutorials/axios/proxy

replace:

let httpsProxyAgent = require('https-proxy-agent');
var agent = new httpsProxyAgent({hostname:<>, port:<>, rejectUnauthorized:false});

with: var proxy = {host:<>, port:<>};

and:
const { response } = await soapRequest({ url: url, headers: sampleHeaders, xml: xml, timeout: 1000000, proxy: {httpsAgent: agent }});
with
const { response } = await soapRequest({ url: url, headers: sampleHeaders, xml: xml, timeout: 1000000, proxy});

The documentation should be updated since it shows no way to use proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants