aspose file tools*
The moose likes Web Services and the fly likes How can I get response back from rest service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How can I get response back from rest service" Watch "How can I get response back from rest service" New topic
Author

How can I get response back from rest service

Mark Curlette
Ranch Hand

Joined: May 26, 2011
Posts: 46

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

Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
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

Joined: May 26, 2011
Posts: 46

Hello Emanuel,
I don't understand what you meant. Could you please elaborate?

Thanks!
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
Your code right now:



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

My suggestion:



URL to try: /RestSimpleApp/orders/foo
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
You can also try this URL: /RestSimpleApp/orders/foo?testid=1
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
from your web.xml



Are you not forgetting something? See url-pattern.
Mark Curlette
Ranch Hand

Joined: May 26, 2011
Posts: 46

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.


Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 641
should it not be
http://localhost:8080/RestSimpleApp/rest/orders/1 ? with your original code not with foo.


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Max White
Ranch Hand

Joined: Jun 28, 2008
Posts: 85
Hi,
Do the following change and then try



instead of



Hope you got the point.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I get response back from rest service