Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problems in calling the websrvice

 
Mohammad Rahmani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run my first rest web service using jersey, here is the client code

https://gist.github.com/donkarlo/031108fc26acca658b93f5166bf114b5

and here is the rest service

https://gist.github.com/donkarlo/6462c95d0eef566329d0b15a700c7870

if needed here are the web.xml (the last lines are related to this problem)
https://gist.github.com/donkarlo/fda69a9487bf05783751bb2f153f5619

and the pom.xml
https://coderanch.com/forums/posts/insert/1

I first run the whole project whci is located in folder called noondreams

the is go to HomeServiceClient.java  and run the file and I get this error

Exception in thread "main" java.lang.RuntimeException: Failed : HTTP error code : 404

thank you



 
L Foster
Ranch Hand
Posts: 209
11
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Mohammad.
I have not yet looked at the links.  But I can already give a bit of advice which may help.
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes The Http 404 error code means "Not Found".  For example, if I were to hit coderanch with a misspelling like "coderanch.com/spiderman", I would get a 404 error.  Some server was contacted, but did not have the resource (the rest of the URL) to return.

In the world of RESTful web services, this often means that you have misunderstood what URL your service will be exposing.  To me, that is often a bit challenging.  So have a look at this link as well.  REST With Java using Jersey, and that might help.  I feel that there needs to be some way to have Jersey (or whatever) dump to the log what URLs are being exposed, much as EJBs will dump their JNDI names.  I don't think this happens, but it would be nice.  Responses?
 
L Foster
Ranch Hand
Posts: 209
11
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing, Mahammad, is you may wish to post the contents of at least the REST service code and the client code directly to these pages (especially if it is not too long).  You can also probe the RESTful service with "curl" or "wget".  Those tools are surprisingly powerful for testing--you can setup all the 'methods' (POST, PUT, GET, HEAD).
 
I love a good mentalist. And so does this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!