• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

problems in calling the websrvice

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Ranch Hand
Posts: 271
15
Android Angular Framework Spring AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 271
15
Android Angular Framework Spring AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic