Hi, Could any one please suggest a better open source Java API for invoking REST services? Also wanted to know if Restlet API supports NTLM authentication.
Thanks
Hi, Could any one please suggest a better open source Java API for invoking REST services? Also wanted to know if Restlet API supports NTLM authentication.
Thanks
It's REST - the whole point is you don't need an API per se, just HttpURLConnection. You should be able to interact with any truly RESTful service with the basic Java SDK alone. You can get fancier with Apache Commons HTTPClient - but it's not a necessity.
I am using resteasy as the rest frameworks and it works just fine and easy (both to rewrite and to test, same as easymock). As a sample code:
@Path("/webservice")
public class Web {
@GET
@Path("{web}")
@ProduceMime("application/xml")
public String test(@QueryParam("param") String param, @PathParam("web") String web)
{ // code here } }
So this get will receive a call from /webservice/web?param=lalala and return a string in the application/xml format
Check out Restlet. It has a good client API.
Example usage:
Request request = new Request(Method.GET, "http://my/rest/api");
Client client = new Client(Protocol.HTTP);
Response response = client.handle(request);
//get response representation and process