My company has thousands of existing xml web services and is starting to adopt AngularJs for new projects.
The tutorial over at http://angularjs.org/ uses json servi
I created a service named HttpService
having a function called getRequestedContent
in which I am using angular http call to my service "http://localhost:8080/showserverstartupinfo" which returns a xml as follows:
########
##########
...and I parse the above xml and populate my div with content of xml element.
HttpService.getRequestedContent('/showserverstartupinfo').then(
function(content) {
//successCallback
var xml = content.data;
document.getElementById('serverName').innerHTML =
xml.getElementsByTagName("SERVERNAME")[0].childNodes[0].nodeValue;
}, function(data) {
//errorCallback
});
getRequestedContent function in HttpService(Angularjs) as follows:
getRequestedContent : function(request) {
var url = this.getRootContextPath() + request;
return $http({
method : 'GET',
url : url,
transformResponse : function(data) {
return $.parseXML(data);
}
});
}