6
I am creating an application using phonegap + Onsen framework that will be powered by Web Services (Restful).
But I can’t seem to get a conversation going between the two.
My call to the Web Service is like this:
$http.get('http://localhost:8080/WhereToJamServer/ws/colacao/getDataAtual', {})
.success(function(data) {
alert(data);
})
.error(function() {
alert('error');
});
And my web service is like this:
@Path("/colacao")
@GET
@Path("getDataAtual")
@Produces(MediaType.TEXT_HTML)
public String getDataAtual() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
return sdf.format(new Date());
}
If I change localhost for 10.0.2.2 or my machine’s local IP (Ipv4) does not work either.
NOTE: When I call the URL by the browser works normally.
Any suggestions?
Tests are being performed on an emulator or on a real device?
– Vinícius Gobbo A. de Oliveira
in a real apparatus
– vogeloco
When you call the URL from the browser of your machine or of the real apparatus?
– brazilianldsjaguar
When I call the URL by the browser my PC works normally. By mobile I did not get to test. When I get home I will test this too.
– vogeloco
I found the solution .... edited the post!
– vogeloco
Just a hint, @vogeloco: the general procedure for when you find the solution yourself is to answer the question itself and accept the answer, so it is clear in the system that the question has been answered.
– fsanches
It’s done @fsanches, thanks!
– vogeloco