English 中文(简体)
What does it mean "to write a web service"?
原标题:

I just asked a question about whether it was possible to write a web-page-checking code and run it from free web server, and one supporter answered and said that it was possible only if I run "a web service" as simple script won t do that. He also suggested that I used Google App Engine service. I wonder what does it mean to write a "web service" and how is it different from writing a script?

最佳回答

A web service essentially provides the capability of RPC (Remote Procedure Calling) on top of the protocol of the web (HTTP). A URL implements an API which accepts a set of function arguments and returns a value. Different approaches are used to implement this RPC mechanism on top of HTTP protocol. XML-RPC defines a simple mechanism to specify the arguments and response using XML. SOAP is a much advanced version of XML-RPC. JSON-RPC lets you specify the procedure arguments and return values using JSON (JavaScript Object Notation).

Several programming languages come with built-in support for developing and working with web services. For example in Python, xmlrpclib provides the client side functionality of XML-RPC protocol. The XmlRpcServer library in Python makes it very easy to develop an XML-RPC based web server. Web services are interoperable in the sense that the client and server can be easily implemented in different programming languages and they don t need to worry about the details of each other.

Web services are different from other RPC mechanisms like COM/CORBA/JAVA s RMI. These RPC mechanism use binary data for exchange of arguments and results. The web services uses text oriented protocols like XML/JSON to implement the RPC protocol. Hence they are heavier from the perspective of communication overhead. They are still very good for development of loosely coupled systems. One big advantage they have is the fact that they are not tied to a specific programming language.

问题回答

By "web service" one normally refers to a service available through HTTP protocol. The protocol sitting on top of HTTP can vary (XML, SOAP, JSON etc.).

But of course one can "complicate" the definition at will :-)

This is example of web service: http://www.webservicex.net/CurrencyConvertor.asmx?op=ConversionRate

When you scroll down you will see you can supply two parameters and get result back. Webservices can support different methods of communication. You can communicate with it using XML, SOAP, or HTTP GET/POST.

So web-service is a special type of script which main function is to expose method to public use (you can set access permissions a well), perform calculations on server-side and return output.





相关问题
What does it mean "to write a web service"?

I just asked a question about whether it was possible to write a web-page-checking code and run it from free web server, and one supporter answered and said that it was possible only if I run "a web ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Dynamically building a command in bash

I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...

Why does Scala create a ~/tmp directory when I run a script?

When I execute a Scala script from the command line, a directory named "tmp" is created in my home directory. It is always empty, so I simply deleted it without any apparent problem. Of course, when I ...

Ivy, ant and start scripts

I have a project that uses ant to build and ivy for dependencies. I would like to generate the start scripts for my project, with the classpath, based on the dependencies configured in Ivy, ...

热门标签