I am new to AngularJS and SOAP and I am doing a small application that performs a soap call to public APIs. The problem is that I get this error: No "Access-Control-Allow-Origin" on headeris present. I've searched a lot, and I have found out that this error is related to CORS. How can I solve it? I'm using Chrome and I found a plugin that allows it and now I get error 500, so I don't know if I resolved it or if it is something else. Here's my code.
<!DOCTYPE html>
<html>
<head>
<title>Chiamata SOAP</title>
<script src="lib/angular.min.js"></script>
<script src="lib/soapclient.js"></script>
<script src="lib/angular.soap.js"></script>
<script>
var myApp = angular.module('myApp', ['angularSoap'])
.factory("testService", ['$soap',function($soap) {
var base_url = "http://www.webservicex.net/globalweather.asmx?wsdl";
//$soap.setCredentials("admin", "admin");
return{
GetCitiesByCountry: function(){
return $soap.post(base_url, "GetCitiesByCountry ", {CountryName:"Italy"});
}
}
}])
.controller('soapCtrl', function($scope, testService){
$scope.onClickCall = function(){
console.log("text before call")
testService.GetCitiesByCountry().then(function(response){
console.log("Testo dopo la chiamata")
console.log(response);
$scope.data = response.data;
});
}
});
</script>
</head>
<body ng-app="myApp">
<div ng-controller="soapCtrl">
<span>Effettua la chiamata SOAP </span><button ng-click="onClickCall()">Invia</button>
</div>
</body>
</html>