473,508 Members | 2,216 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 5481
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**@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.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
2115
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...
13
1752
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
3402
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...
7
1795
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...
0
1051
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...
4
2141
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...
4
6792
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...
8
4390
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...
15
13481
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 ...
5
8614
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
7127
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...
0
7331
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,...
1
7054
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...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5056
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...
0
4713
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...
0
3204
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1564
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 ...

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.