G Peruana

Greenhorn
+ Follow
since Oct 21, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by G Peruana

Yes, and I am debugging with chrome debugger.

The thing is, when no error is launched, the data returned is simply empty. This is why (I guess) it is an async method and the resume method is not reaching the way back. Something in the way I am implementing the callback is wrong. I looked over other forums and found more people having trouble for making this jersey example work and no solutions yet.


When error is launched (ONLY SOMETIMES) I get the following in Eclipse console


Thanks for the replies!!
Yes, I used chrome debugger.

Finally it was a missing comma.

Thanks a lot for your comments.
7 years ago
But how do I manage to locate the npe?
Thanks for you reply. It does not seem to be problem. if you include "dataType: "text",", which is the type received, I still get the same result.
Let me give you the complete code and further explanation:

I am trying to fulfill an invocation from jquery to an Asynchronous service (just following the asynchronous example fro jersey tutorial). I give below the two examples I tried (simple one and with callvback) and explain the results an errors. Any help with any of the examples is welcomed, I am just trying to guess what I am doing wrong.

First example:
In the service side I have the following code:



In the client side I have the following one



If I execute the html web I get the 'asy' alert (therefore asyncGet is being invoked) but I do not get any result in data.
If I add the empty return that is now commented in asyncGet (I read it in some forums) , I get the following error "SEVERE: Error while closing the output stream in order to commit response.
java.lang.NullPointerException"

If I test the callback example:


Using the same client code, what I get is
1) Currently alert asy is shown and in the server console "throwable" is shown; therefore the asyncGetWithCallback is being invoked. But still I do not get the data in the client.
2) From time to time if I test in a different browser window I get only the data (WORKING)

Any help is really appreciated.
I thought it would be more appropriate not to have to include so many jars in every Rest project. If it is not the case I am happy with including them:).
Thanks a lot for the answer!
7 years ago
I would like to know, if it is possible to avoid including all the jersey .jar in the rest service web-inf/lib project without using maven.

Is it possible to locate them somewhere else (maybe in the tomcat server) so that not to have to include them in every rest project?
7 years ago
With chrome debugger I got the error is [...] Origin is not allowed by access-control-allow-origin. However I made it work for a different external service.
I tried to add, for this service, "Access-Control-Allow-Origin: "*"," to the Ajax code, but it does not seems to be the correct way to do it.
7 years ago
It means I get an error message; if I show res.statusText it just says "error".
7 years ago
Shouldnt it get updated without the need to refresh?

The code might have some minor error because I tried to delete all comments and not relevant code.
I have tested it with the chrome plugin for rest client and it works.
7 years ago
Hi, I am invoking "GET" method for local restful services from jquery with success. But when I try an external service, I do not make it work.

<script type="text/javascript">
$.ajax({
type: "GET",
dataType: "text/xml",
url: "http://www.webservicex.net/geoipservice.asmx/GetGeoIP?IPAddress=158.42.38.1",
success: function(data){
alert("Working");
},
error:function(res){
alert("Not working ");
}
});
</script>

Does anybody see where is the error?
Thanks a lot
7 years ago
I am trying to send a POST request to a Restful service with jquery, where the type of data sent is xml.

The Rest service works since I tested it from Chrome Rest plugin. I made it work for GET XML, GET JSON and POST JSON, but no way with POST XML.

Here goes the code. I do not get any error, but the invocation does not succeeds:



Thanks a lot for your help!!
7 years ago
I am trying to invoke an asynchronous restful web service from jquery. The problem is that the HTTP client does not refresh when receiving the result, I have to refresh the browser manually. This is the jquery code I am using:

Any help is appreciated!!