views:

555

answers:

4

My client provides various data related to a consumers shopping habits in grocery stores based on their membership.

One of their vendors wants to tap into the data and build an intranet site for the company. All my client is willing to provide is some form of web service so that the vendor could consume the data as they need and build their intranet site using that data.

What would be a recommended way to provide this data? 2.0 webservice or some sort of .NET REST service or WCF service?

The data is stored on sql.

An example of a search, a hypothetical search could be to get data where consumers bought sugar and bought pie crust between certain dates which could result in 0..n records which need to be sent back to the vendor for their consumption.

A: 

If you do not need to reuse the web service in other application, I would suggest ASP.NET MVC. It is quite easy to serialise data in JSON format in ASP.NET MVC and consume it using jQuery.

oykuo
The webservice is not going to be reused and is dedicated to one vendor. The data is going to be XML sent back to the vendor
+2  A: 

Not sure exactly what the requirements are, but you might also consider looking into ADO.NET Data Services : http://msdn.microsoft.com/en-us/data/bb931106.aspx

This framework can simplify adding RESTful access to relational data.. and return results in JSON, XML, etc..

markt
Using ADO.NET Data Services is the best way because it is driven off your data structure and does not require you to code the web service layer. It is a big time saver if you just want to make your data remotely accessible over the web. And you can secure it for your B2B purposes. The MVC option may be OK for a small set of data, but the serialization features are simplified for use with a web interface, while the ADO.NET Data Services route will give you a richer data serialization detail and automatic features.
Brennan
+1  A: 

I think it really depends on what format you want to provide the data in. If you are thinking SOAP, then WCF is the way to go. If you want to provide XML or JSON, then you could do either WCF or MVC. If both ends are going to be .NET then a SOAP solution is probably ok. If there is a possibility of having to support other platforms from the service, then I'd look at using JSON or XML. My preference would probably be JSON/XML and MVC at this point just because the setup of WCF seems like overkill for a simple web service. Older style web services in .NET are being phased out in favor of WCF so I probably wouldn't go that route.

tvanfosson
tvanfosson: I would prefer the data to be XML so the vendor can consume it with their systems. With MVC, would the vendor be able to call the service with parameters whose serach condition could contain <,>,=, !=, INBetween clauses? I would be happy if you could explain this or direct me to websites which you recommned would be good.
Using MVC you could have different actions for each operation taking appropriate arguments. Or you could pass the operation as a string and reconstruct the query on the server. I'd prefer the former -- seems more secure than taking in string parameters. Say ...FindSalesBetween/20090430/20090501/item1:item2:item3 or FindSalesLessThan/100/item1:item2:item3. If you didn't need to be RESTful, but RESTlike you could use POSTs for the queries and pass some of the parameters. This might enable it to be more flexible.
tvanfosson
+4  A: 

Although WCF is a simple way to get a rest service up, particularly if you are consuming it with a .net client, I prefer rolling my own services using ASP MVC.

It gives you much finer grained control over your resources. You can watch HTTP headers for authentication information, content types, etc or return custom HTTP status codes depending on the result of the action. You won't be constrained to the WCF conventions. You will have to do more manual work when consuming the services, but I feel that the end result is worth it.

Scott Holden