I am using webstorm IDE, and trying to get response from wso2ESB
in angularJS using http. But I'm unable to get response from ESB(Server). All I am getting is error callback method " unexpected error " is called. When I use SoapUI
to check request/response it works fine.
var app= angular.module("myApp", []);
app.controller("HttpGetController", function ($scope,$http) {
$scope.getData = function () {
$http({
method: 'GET',
url,
headers: {
'Accept': 'application/json',
'Access-Control-Allow-Origin:http' : 'myUrl'
}
}).then(function successCallback(response) {
$scope.data=data;
},function errorCallback(response) {
alert("unexpected error" + response.status);
});
}
});
Probably because you are not setting value correctly when the promise is resolved,
.then(function successCallback(response) {
$scope.data=data;
}
Should be
.then(function successCallback(response) {
$scope.data=response.data;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.