aspose file tools*
The moose likes Web Services and the fly likes Consuming REST service using JDK API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Consuming REST service using JDK API " Watch "Consuming REST service using JDK API " New topic
Author

Consuming REST service using JDK API

Rithanya Laxmi
Ranch Hand

Joined: Jan 24, 2011
Posts: 136
Hi,

I have created REST WS (producer) using jersey, to consume the REST can i use JDK net package like URL or URLHttpConnection to consume the REST WS rather than creating the REST client API to consume it? So that irrespective of the REST implementer the client will always use the same JDK API to consume the REST WS. Please clarify.

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41508
    
  53
Yes, the classes built into the JRE are sufficient. However, clients may wish to use a library like Apache HttpClient instead.


Ping & DNS - my free Android networking tools app
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Note that since REST is an architectural style for addressing resources rather than a messaging API, I don't think it possible to come up with a universal client.

A simple GET request could return any resource from an XML document to an encrypted image. Just for a start, consider all the resource types a web browser might GET for a single page.

Then we get into POST, PUT, DELETE, etc etc. - in any case, the JDK will be sufficient for generating the request, but handling the resource returned may require a specialized library.

Bill

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Consuming REST service using JDK API