Web service vs function call

Q:

When should I use a web service?

 

What my understanding was is that every time my web app I'm designing has to go outside its boundaries to talk to external functionality ie an api, I would use a web service to handle the communications. But within the boundary I'v seen a web service used where I could use a function and call it.

 

 For example, I will have a simple class which will take parameters and work out the difference between two dates and populate a textbox with the answer. Very simple class, and the problem decomposition and syntax isn't hard. However, I know of fellow developers who do such tasks using a web service and some with just a class they call.

 

Also, with the advent of WCF, is there any need for standard for standard web services? 

 What is the difference between the two? Is there a performance benefit of one over the other?


 

A:

You should use a Web Service or a WCF service (which is just a unified remoting technology that provides a common framework for web services, remoting, etc.) when you want to cross boundaries for data that can be consumed by many different apps/web sites irregardless of the platform.  To do what your function would do, I don't see why you'd want to use a service.  The dll that provides your method would be faster and make more sense.  For providing an api or central logic/data access, use a service.

A:

 >Also, with the advent of WCF, is there any need for standard for standard web services?
WCF functionality at runtime can deployed as web services or COM.

Web services are ideal for situations where interoperability is required, but situations do occur where system architects use web services where direct database access would be far better. 

A:

Also, with the advent of WCF, is there any need for standard for standard web services?

WCF has not arrived...

...for Java

...for programs supposed to run without .NET

...for mainframes

...for mobile phones

So the statement about WCF obsoleting other things is just only true if your horizon is limited to current .NET technologies.

But even then, it makes no sense to say "WCF obsoletes web services", as WCF endorses them. It obsoletes ASP.NET web services as programming model, because it replaces them. Put up a standard HTTP Endpoint with SOAP protocol fo your WCF, and guess what - you have a web service. All WCF now gives you is a better, more powerfull programming model, compared to the old web services.

posted @ 2008-08-04 13:13  KK in cnblog  阅读(218)  评论(0编辑  收藏  举报