Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To return a dataset in a web service or not?

Is there a best practice in regards to returning (or NOT returning datasets) from .NET web services? One camp says that we should promote interoperability and use XML schemas to define the web service payload, the other camp says we should return datasets because it's straightforward in Visual Studio and get's the job done more quickly.

Some arguments in the anti-dataset camp:

  • Datasets are not WSI compliant
  • Datasets seem to rarely be supported by 3rd party software

Some arguments in the pro-dataset camp:

  • They are very handy and quick to build in Visual Studio.
  • We (my company) only develops in .NET so interoperability is not an issue
  • Datasets on the client side have advantages for ease of use
like image 568
Maladon Avatar asked Oct 14 '22 12:10

Maladon


1 Answers

Use Datasets? I would say a thousand times no. They are not interoperable with other toolkits (as you mention). Sure, your only consumers right now are .NET but things can change quickly and it's nice to be prepared.

See The XML Files for some reading.

Also, if you are developing new services, write them using WCF. Then you can expose them however you want. If the service and consumer are internal and both are .NET then you can use the TCP binding for better performance. Then later on when someone else wants to communicate with your service you can add a new web service binding so their Java app (for example) can interoperate with your service. See Choosing the right WCF binding for a handy flowchart.

like image 189
Randy supports Monica Avatar answered Nov 04 '22 20:11

Randy supports Monica