473,586 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

web service structure

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

Nov 23 '05 #1
2 5486
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/article...ertSOA_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

"asha" wrote:
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..

Nov 23 '05 #2
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

"asha" <as**@discussio ns.microsoft.co m> wrote in message
news:9F******** *************** ***********@mic rosoft.com...
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..

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2119
by: rgerla | last post by:
I'm trying to serialize a compount structure set for a web service, the sturctures are something like this: Public Structure UserPhone Public phonenumber As String Public phonetype As Char End Structure Public Structure userdata Public firstname As String Public lastname As String
13
1760
by: Dave | last post by:
I have a structure declared as: private struct StandardFrame { public byte frame; public UInt32 integrityCheck; public UInt32 sequenceNo; public UInt32 dataLength;
16
3411
by: Jm | last post by:
Hi All Is it possible to determine who is logged onto a machine from inside a service using code in vb.net ? I have found some code that seems to work under vb6, but doesnt under .NET ? Any help is greatly appreciated Thanks
7
1805
by: Doug Stiers | last post by:
I have a VB app that I'm installing as a Windows Service. I want a subroutine in the app to run every 30 minutes during business hours. How do I do this in VB? I set the startup type as automatic so it's always running. Is there some kind of timer event I can use? Thanks, Doug
0
1056
by: Ahmet | last post by:
Hi All, I have a web service app in which i have my business logic (BL) and a dll with structures that carries data between web service and client. When i showed the web service BL from client as Web Service referance, it recognized methods tagged with WebMethod and in Referance.cs files it also out one copy of th same structure that i have...
4
2142
by: gregory_may | last post by:
I have a web service that is returning several data elements. Currently I am just exporting as a single string element with Pipe delimiters between my data. How do I "return" my data elements as an XML structure (rather than one big string)? Thanks!
4
6801
by: Jason Richmeier | last post by:
I am sure this has been asked at least once before but I could not find anything when searching. If I set the value of the ExitCode property to 1066 for a windows service, the text "A service specific error occured: 0." How do I (if it is possible) change the value of the zero to something custom (like a "look in the event log for further...
8
4394
by: amazon | last post by:
I have a following structure that I am using with array list: Private Structure arrayliststruct Public Name As String Public value As String Public type As String End Structure and following function to format arraylist the way I want and calling it from button click event: Private Function formatarray(ByVal inarray As ArrayList, _
15
13496
by: Joseph Geretz | last post by:
I'm a bit puzzled by the current recommendation not to send Datasets or Datatables between application tiers. http://support.microsoft.com/kb/306134 http://msdn2.microsoft.com/en-us/library/ms996381.aspx Formerly, with classic Microsoft DNA architecture, the ADO Recordset was a primary transport medium, recommended for transmitting data...
5
8627
by: Frank Hauptlorenz | last post by:
Hello, I recognized some days ago, that returning a DataTable blocks my WCF-Service. Is this a known bug? If I add this table to a new DataSet() and return this, it works. Thank you, Frank
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.