lula / ngx-soap

Simple SOAP client for Angular
MIT License
66 stars 61 forks source link

CORS issue #68

Open wmorawski opened 4 years ago

wmorawski commented 4 years ago

I'm getting the CORS error even if I'm using proxy.

// auth.service.ts
const promise = this.soap.createClient('/Listener.svc?wsdl');

and my proxy is:

{
    "/Listener": {
      "target": "https://xxx:50156",
      "secure": true,
      "logLevel": "debug",
      "changeOrigin": true
    }
  }

So first request is ok and I'm getting the wsdl file, but inside this I've got

<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="https://xxx:50156/Listener.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="https://xxx:50156/Listener.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="https://xxx:50156/Listener.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/AcoClasses"/>
<xsd:import schemaLocation="https://xxx:50156/Listener.svc?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/myAco"/>
<xsd:import schemaLocation="https://xxx:50156/Listener.svc?xsd=xsd4" namespace="http://schemas.datacontract.org/2004/07/"/>
<xsd:import schemaLocation="https://xxx:50156/Listener.svc?xsd=xsd5" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>

And my proxy doesn't handle requests to https://xxx:50156 and here I'm getting CORS. Any solution?

AndreyBespamyatnov commented 3 years ago

Hi,

CORS usually not that library-related question, cause it is a server-side setting, so you have to enable CORS on the web server side and you should allow your local domain. You can read more by this link: https://enable-cors.org/