gyc gyc - 2 months ago 18
AngularJS Question

Angularjs soap library throws a typeError on Firefox, not in Chrome

I'm using the soap service for AngularJS from Andrew McGivery

It works perfectly when called from Chrome but it returns a typeError on Firefox and IE11.


TypeError: e is null at angular.soap.js line 16


The code in question is as follows:

.factory("$soap",['$q',function($q){
return {
post: function(url, action, params){
var deferred = $q.defer();

//Create SOAPClientParameters
var soapParams = new SOAPClientParameters();
for(var param in params){
soapParams.add(param, params[param]);
}

var soapCallback = function(e){
//ERROR THROWN ON LINE BELOW
if(e.constructor.toString().indexOf("function Error()") != -1){
deferred.reject("An error has occurred.");
} else {
deferred.resolve(e);
}
}

SOAPClient.invoke(url, action, soapParams, true, soapCallback);

return deferred.promise;
},
setCredentials: function(username, password){
SOAPClient.username = username;
SOAPClient.password = password;
}
}
}]);


e in Chrome is the object returned by my webservice (user object), in Firefox it's null and I don't know where to look in the library to debug the problem.

UPDATE:

My controller looks like this:

.controller('SoapCtrl', function($soap) {

this.login = function(credentials) {

$soap.post('MYAPI', 'MYMETHOD', {login: credentials.login, password: credentials.password}).then(function(data) {
console.log(data.userid);
});
}

})


I also tried calling the same webservice from the jquery plugin jquery.soap inside my angular application and I get the expected behaviour in both Chrome and Firefox.

LAST UPDATE

Since this is a professional project, we decided to move on to a plugin that works. jquery.soap

2 issues have been posted on the author's page with no answer for the moment.

I would have awarded the bounty to a valid answer but half the bounty is going automatically to the answer with 2 upvotes...

Answer

in the function SOAPClient._getElementsByTagName
I change the line
return document.getElementsByTagName(tagName);
For
return document.getElementsByTagNameNS("*", tagName);

work for me!