Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How can I get response back from rest service

 
Ranch Hand
Posts: 46
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to get a response back from rest service, but it gave me a http 404 error saying " The requested resource (/RestSimpleApp/orders/1) is not available."

My code looks like this





My web.xml is




I call my code from the IE browser window as :

http://localhost:8080/RestSimpleApp/orders/1

and it gave me


Http status 404 on /RestSimpleApp/orders/1
description The requested resource (/RestSimpleApp/orders/1) is not available.

I don't know what is going on? please give me some hint if you can.

Thanks so much in advance.

Tom

 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried to not use a variable in your @Path declaration? Like @Path("foo") and then hit the url : /RestSimpleApp/orders/foo. If that works, it means you have set up everything correctly, and you either cannot use a parameter in the @Path declaration or you are not doing it correctly.
 
Mark Curlette
Ranch Hand
Posts: 46
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Emanuel,
I don't understand what you meant. Could you please elaborate?

Thanks!
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code right now:



URL you're trying: /RestSimpleApp/orders/1

My suggestion:



URL to try: /RestSimpleApp/orders/foo
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also try this URL: /RestSimpleApp/orders/foo?testid=1
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from your web.xml



Are you not forgetting something? See url-pattern.
 
Mark Curlette
Ranch Hand
Posts: 46
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I tried both URLS : /RestSimpleApp/orders/foo and URL: /RestSimpleApp/orders/foo?testid=1
for sample code, but it still gave me "The requested resource (/RestSimpleApp/orders/foo) is not available " error




I even tried to add / to Path("/foo") but it still did not work.


 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
should it not be
http://localhost:8080/RestSimpleApp/rest/orders/1 ? with your original code not with foo.
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Do the following change and then try



instead of



Hope you got the point.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!