views:

165

answers:

4

I have a website (ASP.NET) and some winforms(.Net 2.0) for a project (written in C#). I use the webservice (IIS6) for task that both require like sending email inside the business.

I think Webservice is nice but I would like from your experience what should and what should not be in a webservice?

+1  A: 

Well it sounds like you have a limited Service Oriented Architecture (at least, that's what I think you're getting at), which according to Gartner means you'll be rich soon. :)

I find that the benefit of SOA for me really comes down to the heterogeneity of the systems involved (sounds like yours doesn't qualify there because it's all .NET), and the negative of SOA is primarily because of the verbose nature of XML. True, you don't need XML for SOA, but it's the current majority, IMHO.

But if you're not concerned about the bandwidth/parsing penalties, who cares? Maybe you're not piping through 10,000 service calls a minute. With this style of implementation, you're following DRY, just with a WS instead of a sub, and you're adhering to a standard that is by nature compatible with multiple systems.

There's worse approaches.

Pseudo Masochist
+1  A: 

In My Opinion:

Web services should be reserved for code that

  1. You either can't or don't want to distribute; or,
  2. code that needs to seriously scale up.

One example is custom business logic that multiple applications need access to.

Code you don't want to put into web services include:

  1. code that is performance based;
  2. code that applies only to the application in question.
Chris Lively
and maybe :3. Security sensitive code ?
Andrei Rinea
Thanks for the clarification. I figured that fell under code you don't want to distribute.
Chris Lively
A: 

It seems like the new trend for web services/SOA is to more or less expose a light-weight middle tier that your host application can use. Instead of having individual method calls exposed through a service (as in your example), SOA-oriented applications have extensive Data/Operation contracts that act as the "traditional" middle tier assembly.

Gabriel Isenberg
A: 

As little as possible, while still being useful.

By default, DON'T put every field of the return objects in the return data, and DON'T expose every method of an existing class.

read this too...