Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Design question for web service return classes

Reply
Thread Tools

Design question for web service return classes

 
 
Clint
Guest
Posts: n/a
 
      04-19-2006
So I'm working on a web service that will be going into a relatively
high-volume website. One of the questions I've got right now is in
designing the classes that will be returned by the service.

Let's say that the fundamental class is a store. Got the basic information
about the store (address, name, phone numbers, etc). Now, I also have a
list of the inventory items a store carries, the people associated with the
store (owner, employees, etc), as well as other details. My first thought
was to build a monolithic class called Store, with the other objects stuffed
into collection classes (like InventoryItems, and People).

The problem with that is that when someone hits the GetStoreByID (or even
worse, GetStoreCollection), they'll be getting tons of information that they
may or may not need. So my next thought was to break down the collections
to just a collection of ID's, rather than a full object. Does that make
sense? Because an InventoryItem has a bunch of data associated with it
which would be in the object. This approach seems somewhat more efficient,
but still has some overhead.

The final solution would be just to provide the Store information, with
additional methods to GetInventoryItemsByStoreID, and GetPeopleByStoreID.
Then, if a consumer needs the other information, they'd have to make a
separate call to get it. Each class is streamlined as much as possible, in
terms of data. It does mean more round-trips to the web service (call once
to get the store information, then call another function to get the
inventory items, then another time to get the people. However, it's not
like the second method, which would require an additional call for each item
and each person, which would be ugly, I think.

Actually, there's one other way I've heard of for distributed applications,
but I'm not sure about doing it with a web service. And that's to put some
magic in the "get" property, so that if the sub-object doesn't exist, it
goes off and retrieves it at that time. This means that if the consumer
doesn't need the data, it doesn't bring it back. But to the consumer, it's
not more coding work to get that data.

Anyway, any ideas you architects have, or resources to kick things off would
be appreciated. The problem is that each way "works". The question is more
about what way works best, and what's "more standard". There will be one
primary consumer of the web service, which will be a web site. I could
model everything off the pages it's displaying, and deal with any changes
that come up later, I guess.

TIA,

Clint


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does timer in Web Service Global.asax block my Web Service from processing web-site requests? Leo Violette ASP .Net Web Services 0 04-17-2009 12:39 AM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
C++ Design Principles for Ruby - Classes of Classes. John Carter Ruby 1 08-03-2005 02:02 PM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM
Noobilicious question: Exposing two interfaces on the same web service(C# web service) WTH ASP .Net Web Services 1 02-15-2005 06:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57