从离子调用soap webservice

时间:2017-03-31 09:53:18

标签: angularjs soap ionic-framework

我正在尝试使用此方法调用soap webservice:http://mcgivery.com/soap-web-services-angular-ionic/但是我的屏幕只显示空白页而不是登录屏幕。可能是什么问题?

这是我的services.js代码:

.factory('loginService', ['$soap', function($soap){
var base_url = 'http://localhost/UserService3/WebService1.asmx';

return {
    GetUser: function(uname){
        return $soap.post(base_url,"getUserbyUsername", {Username: uname});
    }
};
}]) 

这是我的controller.js代码:

 .controller('loginCtrl', ['$scope', '$stateParams', '$location', '$state', 'sharedProperties2','ConnectivityMonitor', '$ionicLoading', 'loginService', 
function ($scope, $stateParams, $location, $state, sharedProperties2, 
ConnectivityMonitor, $ionicLoading, loginService) {

 $scope.show = function() {
    $ionicLoading.show({
      template: '<ion-spinner icon="android"></ion-spinner>',
      showBackdrop: false
    });
  };

$scope.hide = function(){
    $ionicLoading.hide();
  };

$scope.userdata = {}

$scope.enterlogin = function(usern,pass)
{
     userFactory.GetUser(usern).then(function(response) {
            alert('get = ' + JSON.stringify(response.data));
        })
}
}])

1 个答案:

答案 0 :(得分:0)

显然它无法看到添加的脚本angular.soap.js和soapclient.js的先前位置,所以我将2个文件放在lib文件夹中名为angular-soap的文件夹中。