I'm implemeting a webclient to consume a RESTful webserv using a POST call.
I'm using Jersey API for it.
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
public class MyJerseyClient {
public void updateGame(String url) {
Client client = Client.create();
WebResource webResource = client.resource(url);
ClientResponse response = webResource.type("application/json").post(ClientResponse.class);
if (response.getStatus() != 200) {
System.out.println("o/p >> ERROR!!");
} else {
System.out.println(response.getEntity(String.class););
}
}
}
I've imported external jars using Project > Properties > Java Build Path > Add External Jars.
But still getting an error -
Can someone please point me what I might be missing here?
While the required jersey-client
JAR file is in your build path, it doesnt appear to be on your client's runtime classpath.