This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 41182
    
  45
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: 12761
    
    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
 
Similar Threads
Java 7 JAX-WS: Is JAX-WS an API or implementation?
REST webservice consumers should change their API to support REST
Issues related to RESTful web servicers
Readonly Web services
REST WS in place of SOAP