Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Webservices returning large amount of data - need suggestions

Thread view: 
DarthLuch@gmail.com - 03 May 2006 22:43 GMT
I'd like to get suggestions on best practice way to return a large
amount of xml data using a webservice function.

Here's what I do today:
Using java, I write a function that will return an array of some
object. I write the function to loop through the database, getting each
record, perform any needed manipulations on it, then add each modified
record to an array. At the end, I marshall the array to a string (using
Castor) and return the xml-representation of it. I then use Apache Axis
to expose the function as a web-service. I know this is not a
well-though design, but it is easy to program. So now the problem I'm
having is that I run out of memory... With a large amount of data it
will eventually crash once it reaches its breaking point of adding so
many items to the array. I also know that taking the entire object and
marshalling it to a string to be returned is probably not the best way
either. Any suggestions and pointers would be appreciated.

My clients will usually deploy to a Tomcat server, using the default
settings. I'm not sure if there's even a way to increase the memory
allotted to it, but I'm not sure that is the best way to proceed anyway.
seank76 - 03 May 2006 23:42 GMT
If I understand the problem correctly, you just need to be able to
return a huge string via webservice, right?
The first thing that comes to my mind is to implement iterator type of
service.
In other words, you would only return a predefined size of string and
the client will have to call "hasNext()" method to see if there are
more, etc.
This way you always know exactly how much memory is required regardless
of the length of the string.
I guess if the performance matters and multiple hits to the web-methods
are not desired, this might not be the ideal solution for you...
Luch - 04 May 2006 00:01 GMT
Yeah multiple hits to the webmethods is not desired. I also prefer that
the methods stay state(or session?) less, and each method is it's own
instance, etc.
Would like other ideas.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.