Abdul Aleem
Abdul Aleem

Reputation: 709

IONIC | SOAP based web-service | exception: 'Access-Control-Allow-Origin' missing

I am developing mobile application using IONIC framework and I want to access SOAP based web-service, i have found this TUTORIAL.

I am accessing publicly deployed soap based web-service. I have tested the mentioned SOAP based web-service in SOAP-UI and i am able to access the web-service, but when i am accessing the same web-service from ionic framework, it throws an exception:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.webservicex.net/globalweather.asmx?wsdl. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

Can anyone let me know whats the issue?

Upvotes: 3

Views: 1334

Answers (2)

Abdul Aleem
Abdul Aleem

Reputation: 709

CORS is something that is enabled on the server. you have to make sure that the headers that are sent by the queried server have

Access-Control-Allow-Origin *;

Once that is done, the issue should be resolved. The XML request is being blocked in your case, because these headers are not present in the server response.

More info can be found here, http://www.w3.org/wiki/CORS_Enabled

BUT

For development purpose you can try to use chrome extension as workaround in your development phase.

try it: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi

NOTE: In Production you should enable it on your server side. But during development, you can try plug-in to disable security.

Upvotes: 5

Gene
Gene

Reputation: 2218

It might be the whitelisting problem. Install ionic whitelist plugin via this command:

ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git

Try whitelisting all network traffic via in your 'config.xml':

<allow-navigation href="*" />

Thou , this practice of is usually not recommended.

More info here: http://docs.ionic.io/docs/cordova-whitelist

Upvotes: 0

Related Questions