Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2005

Tip: Looking for answers? Try searching our database.

Dataset vs. XMLDocument

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JoshKaos - 24 Mar 2005 19:55 GMT
I am in the process of rewriting a WebService.  The WebMethods are all
returning XMLDocuments.  First, they get a Dataset of records and then walk
through the Dataset to populate the XMLDocument which is then passed to the
Web application which then pushes the XMLDocument into a Dataset in order to
use the data.

Now my question is should I just skip the XMLDocument process and just pass
the Dataset itself back from the WebService?  Is there more overhead passing
the Dataset back than passing the XMLDocument back?  This webservice will be
hit by between 50 to a 100 users on a constant basis so speed of data
delivery is crucial.

Thanks,
Jim Rand - 24 Mar 2005 20:32 GMT
Take a look at http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx and their DIME example.

Rather than returning the dataset, the server does something like this:

 MemoryStream memoryStream = new MemoryStream(1024);
 GZipOutputStream gzipStream = new GZipOutputStream(memoryStream);
 ds.WriteXml(gzipStream);
 gzipStream.Finish();
 memoryStream.Seek(0, SeekOrigin.Begin);

 DimeAttachment dimeAttachment = new DimeAttachment("application/x-gzip",
                           TypeFormat.MediaType,memoryStream);
      sc.Attachments.Add(dimeAttachment);

And the client does this:

 GZipInputStream gzipInputStream = new GZipInputStream(sc.Attachments[0].Stream);
 MemoryStream ms = new MemoryStream(1024);
 int nSize = 2048;
 byte[] writeData = new byte[2048];

 while (true)
 {
   nSize = gzipInputStream.Read(writeData, 0, nSize);
   if (nSize > 0)
    ms.Write(writeData, 0, nSize);
   else
   break;
 }
   
 ms.Seek(0, SeekOrigin.Begin);

 DataSet ds = new DataSet();
 ds.ReadXml(ms);
The net result of all of this is that you wind up passing the dataset as a zipped attachment - just like a zipped image.

> I am in the process of rewriting a WebService.  The WebMethods are all
> returning XMLDocuments.  First, they get a Dataset of records and then walk
[quoted text clipped - 9 lines]
>
> Thanks,

Rate this thread:







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



©2008 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.