5

Are there any general guidelines to understand when I should consider using (as a eat-your-own-dogfood) and providing web services, and when I shouldn't worry about them? Or, any reading materials you can point me to?

My project is in PHP but I don't mind if it's language agnostic.

1
  • Note that web services are "just" a special case of remote procedure calls (allowing one computer to ask another computer a question and get the answer back across the network).
    – user1249
    Dec 12, 2011 at 20:23

3 Answers 3

9

Basically, you should implement a web service when you have functionality that, for whatever reason, requires centralization on a computer you control, but that needs to be directly accessed by consumers on many machines that you may not control.

Typically, the reasons for such centralization are:

  • The functionality requires access to a large dynamic data store that would be infeasible to distribute in its entirety to all users.
  • The functionality requires serious computational muscle that, again, would be infeasible to provide to all users or to expect them to have available.
  • The functionality exists to provide some sort of controlled access to confidential information or features. You simply cannot trust anything on the remote end of an Internet connection.
  • The functionality must be platform-independent so that it can be consumed by programs run on a variety of platforms. No one programming language is 100% platform-independent, but many communications layers (such as WSDL/SOAP and HTML/HTTP) are.

In all cases, it is necessary to distinguish the functionality being talked about as being more involved than serving up web pages. The actual mechanism used is actually very similar, but the intended recipient is not a browser (and thus an end user simply needing a UI), but code (which will use the results of your service in its own program for its own purposes).

To do this, you expose your functionality as a web service, which clients can send requests to and to which you can choose, if everything seems kosher, to respond.

8

There is no all encompassing answer to this - it depends on many variables.

In general, one should implement a web service when there is a need to provide an API (internally and/or externally) that will have multiple users (as in different applications) and that should be consumed over the network (using HTTP).

If there is only one application that will use the API (or at least the only expected one), there is not much point in making a web service (I would question the need for an API in such a case).

0
3

I don't know enough about your project. In addition to other answers already posted, Web services allow data consumers to access data across the internet without knowing how the data is stored or where it is stored or even the format of the storage. The contract between the client and the service is all you need to know.

If you expect that your application will be used by many systems and you don't want to expose either your data model or the logic used to access this data for whatever reason to these other systems and still want them to get some or all of the data, Web Services is a good candidate for that.

Web Services is the core of SOA. SOA allows your system to be easier to integrate and integrate with. For the service consumer, it is always easier to just use the service than to build the mechanisms for it.

Web Services are platform independent.So you could call the service to get the data regardless of the technology of the service. However, both the service consumer and the service must agree on the data exchange format, etc.

"There are currently two schools of thought in developing web services: the traditional, standards-based approach (SOAP) and conceptually simpler and the trendier new kid on the block (REST)." See Rest vs SOAP

Web Services are good choice when you accessing data on different databases since it abstracts the data sources.

Web Services is used by data stores that use NoSQL, such as Amazon SimpleDb and others. Web Services are used by Business Process Modeling tools to create processes from BPM flows.

Web Services and SOA are large subjects in IT today. There are entire books devoted to these subjects.

The site Many Videos has lots of videos on the subject.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.