jQuery in Action, 3rd edition
The moose likes Web Services and the fly likes restlet web service not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "restlet web service not working" Watch "restlet web service not working" New topic

restlet web service not working

gilbert engle

Joined: Jun 03, 2009
Posts: 24
public class MyTestClientResource {

public static void main(String[] args) throws Exception {

ClientResource clientResource = new ClientResource(
MyTestResource testResource = clientResource.wrap(MyTestResource.class);

// Retrieve the JSON value
Customer result = testResource.retrieve();

System.out.println("CUSTOMER " + result);
if (result != null) {

public interface MyTestResource {

public Customer retrieve();

public void store(Customer customer);

public void stop() throws Exception;

public void remove() throws Exception;


public class TestServerResource extends ServerResource implements MyTestResource {

private static volatile Customer myCustomer = Customer.createSample();
private static Server server = null;

public static void main(String[] args) throws Exception {
server = new Server(Protocol.HTTP, 8182, TestServerResource.class);

public Customer retrieve() {
System.out.println("GET request received");
System.out.println("CUSTOMER( " + myCustomer + ")");
return myCustomer;

public void store(Customer customer) {
System.out.println("PUT request received");
myCustomer = customer;

public void stop() throws Exception {
System.out.println("POST request received");

public void remove() throws Exception {
System.out.println("DELETE request received");
myCustomer = null;


runnning MyTestClientResource results in


I carefully copied all of the source code from the example but it just doesn't work. Any ideas? Thank you very much

source code example


gilbert engle

Joined: Jun 03, 2009
Posts: 24
OK, trying to get this stuff to work on your own is crazy. The pieces and parts that are presented in the user's guide are incomplete. I finally located some working source files.


I agree. Here's the link: http://aspose.com/file-tools
subject: restlet web service not working
It's not a secret anymore!