I am trying to make a request get
to a web service using the module $http
of angularjs
, my code is as follows, (it is inside a factory):
getCurrentPositionByClientName: function(){
var deferred = $q.defer();
console.log("getbyclientename");
$http({
method: 'GET',
url: 'http://url-webservice.com/etc/etc',
headers: {
'Content-Type': "application/xml"
}
}).then(function(result){
deferred.resolve(result);
}, function(error){
deferred.reject(error);
});
return deferred.promise;
}
So far so good, it makes the connection and the request well, the problem I have is that the response is returning to me in xml format in theory, but with special characters like the following:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://www.tempuri.org/">
<NewDataSet>
<Table>
<ItemName>108</ItemName>
<ItemID>37</ItemID>
<IMEI>207728640</IMEI>
<ActualDate>2017-08-02T15:44:09-06:00</ActualDate>
<Lat>24.055410999999999</Lat>
<Lon>-110.288417000000000</Lon>
<Direction>0.00</Direction>
<Speed>0.0240</Speed>
<Cause />
<TriggerValue />
<EntityType>VEHICLE</EntityType>
<IgnitionStatus>1</IgnitionStatus>
</Table>
<Table>
<ItemName>113</ItemName>
<ItemID>39</ItemID>
<IMEI>207224564</IMEI>
<ActualDate>2017-08-02T15:47:58-06:00</ActualDate>
<Lat>24.157910999999999</Lat>
<Lon>-110.312152000000000</Lon>
<Direction>128.00</Direction>
<Speed>10.6840</Speed>
<Cause />
<TriggerValue />
<EntityType>VEHICLE</EntityType>
<IgnitionStatus>2</IgnitionStatus>
</Table>
</NewDataSet>
</string>
My question is: How can I show instead of showing the special characters the <
and >
correctly? or is it necessary to make a conversion or is there a problem with my Content-type
when making the request?