I am new to ionics. Just trying to hit Soap-api (this is my first time on ions). I studied this following link and tried to hit the API in the same way as described in the link below. Here is the link: - https://github.com/andrewmcgivery/angular-soap
Just trying to implement Login-Api in ionic.
Here is my sample code, please see: - In index.html, I defined the following lines: -
<script src="lib/ionic/js/ionic.bundle.js"></script> <script src="cordova.js"></script> <script src="js/app.js"></script> <script src="js/controllers.js"></script> <script src="js/services.js"></script> <script src="js/soapclient.js"></script> <script src="js/angular.soap.js"></script>
In app.js : -
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services','starter.angularSoap']) .state('login', { url: '/login', templateUrl: 'templates/login.html', controller: 'LoginCtrl' })
In the controller class : -
angular.module('starter.controllers', []) .controller('LoginCtrl', function($scope, LoginService) { $scope.data = {}; $scope.login = function() { LoginService.LoginUser($scope.data.username, $scope.data.password).then(function(response){ $scope.response = response; alert(response); }); } })
And in service.js I define : -
angular.module('starter.services', []) .factory("LoginService", ['$soap',function($soap){ var base_url ="http://192.168.0.17:90/index.php//api/v2_soap?wsdl=1"; return { LoginUser: function(username, password){ return $soap.post(base_url,"LoginUser", {apiUser: username, apiKey: password}); } } }])
And in angular.soap.js : -
angular.module('starter.angularSoap', [])
The error I get is: - http://piratepad.net/ep/pad/view/ro.tNK8MFROASU/latest
I do not get any response. Can anyone tell me where I'm going wrong? I will be very grateful for your help.
Thank you
source share