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 / July 2005

Tip: Looking for answers? Try searching our database.

web service structure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
asha - 15 Jul 2005 18:50 GMT
Hi, I am new to .net so excuse me.

I need to create mutiple webservices (for multiple clients). The webmethods
would essentially have the same parameters except for the return values. say
they pass us an id, then depending on webserice called I might need to return
values, if client A calls methodA then just return name and phone but for
client B calling methodA  return name,phone and adress..  I want some
reuasability  in code (since I read the same data from database each time but
some other processing differ) and want to return the output as custom object.

I have been trying to use abstract class to define all the webmethods.. not
very successful ..
If I create a custom object having all possible fields is it possible to
hide the non-required fields (i.e. Address when client A access the service
for them), should I  return XMLDocument..

what is the best design pattern for webservice..
François Lemaire - 16 Jul 2005 13:02 GMT
For me, the best pattern for web service is :
- create XML schemas describing your data and the XML messages you will
send. There is a functionality (xs:extension) which permits you to create a
complex data type that "inherit"  from another complex data type.
- create classes from your XML schema with the xsd.exe tool
- define the operations your service needs and prepare your service class
- code your service

You can code an abstract class extending the WebService class containing all
the operations you need for your clients, and inherit from it for each of
your client ; in this concrete class, you expose the right methods as web
service methods (the WebMethod attribute is not inherited, too bad...)

You can check this article :
http://www.theserverside.net/articles/showarticle.tss?id=ExpertSOA_Excerpt
( I'm not from the family of the guy writing the book, I swear, but it's
very good if you want to learn web services the right way)

Regards

François

> Hi, I am new to .net so excuse me.
>
[quoted text clipped - 13 lines]
>
> what is the best design pattern for webservice..
Todd Plambeck - 18 Jul 2005 03:49 GMT
You could parse the dataset returned from the database into another dataset
then return the resulting product.  For example, you return a dataset with 1
table with columns name, phone, address.  Since client A is calling,
determine this however you have planned, we create a new datatable, copy the
2 datacolumns we want into a new datatable, add that to a new dataset and
return it.  I don't think you can serialize a datatable, at least I never
could, so the need for putting the new table into a new dataset.  Client B,
same deal just include the address as well.  If you are sending any sizeable
amounts of data through you web services, I would strongly recommend using
WSE and creating a compression/decompression extension.  After it serializes
the data into XML, you'll have more data fluff then a gallon of Cool Whip.
It'll speed up your app immensely.

HTH

Todd

> Hi, I am new to .net so excuse me.
>
[quoted text clipped - 20 lines]
>
> what is the best design pattern for webservice..

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.