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 OO, Patterns, UML and Refactoring and the fly likes What should be the behavior of a good wrapper library? 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 » Engineering » OO, Patterns, UML and Refactoring
Bookmark "What should be the behavior of a good wrapper library?" Watch "What should be the behavior of a good wrapper library?" New topic
Author

What should be the behavior of a good wrapper library?

Ragunath Jawahar
Greenhorn

Joined: Jan 28, 2010
Posts: 15
I'm writing a Java wrapper library for a REST based web service. My question is, should the library reflect its behavior EXACTLY like the web service?

Sample prototype of the web service api call translated to java - getMessages(int startIndex, int numberOfMessages);

For instance, the web service will return an error response if the numberOfMessages parameter is more than 15.

Now,
1. Should I throw an exception from the library if the numberOfMessages parameter is greater than 15.

Or

2. Can I set the numberOfMessages parameter to 15 (the maximum value allowed) and make the api call.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Since you are adding a client-side layer between client program and web service, you can design it so that a web service call is never made with "incorrect" arguments. You shouldn't change the value in the wrapper layer, but return an error message to the client program.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What should be the behavior of a good wrapper library?
 
Similar Threads
How to make a web service call using jqSOAPClient.js
Java Poller ??
Consume secure web service
org.apache.axis2.AxisFault: 0 >= 0
some java interview Questions