views:

123

answers:

3

What is the difference between using a "Web Service" and calling a server page such as JSP/ASPX?

To me it looks like a Web Service is just a framework around the server pages. For e.g. I can have a JSP page that takes:

mypage.jsp?method=getupdate&param1=23&param=44 (I can also send these variables through POST)

In my JSP page I can call the appropriate method based on the value of "method" and return a value back to the caller client app. Is this the raw form how a Web Service actually works? OR is there more to a Web Service call like someone told me that when you call a page, it is rendered but a Web Service is not rendered. But What if I remove the HTML code from JSP page then?

So when we say XML Web Service, the difference is that the client and the server both wrap/unwrap the requests/responses using XML and POST it to the Web Service page.

A: 

You are correct to say that web services are a layer on top of the server pages. One of the common types of web services are SOAP web services that wrap requests and response into XML to achieve interoperability between different platforms/frameworks.

Darin Dimitrov
So if I have want to have a Web Service for "just" my application written in some language, I dont need to use SOAP or any other protocol. I can have my own format of data and my own way of calling the methods.
A9S6
You can certainly do that, but in this case you shouldn't call your page a Web Service.
Vinko Vrsalovic
A: 

Web Services are a well defined set of standards defined by the W3C and other relevant bodies, which mostly define an architecture that runs over a network to communicate diverse applications while ensuring interoperability, discoverability and some other relevant criteria.

You can certainly create a server page just for your application without SOAP or XML-RPC. It's just that you shouldn't call it a "Web Service" unless it outputs SOAP or XML-RPC and provides a WSDL description for itself, because that leads to confusion and show you don't know what the "standard Web Services" mean.

Vinko Vrsalovic
I wont call the page as a Web Service because the word "Web Service" does not signify a single server page but a whole set of classes, resources, pages and more. Also, will there be a difference if any in the execution of a server page and a Web Service?
A9S6
A Web Service could be a single page as well. It's just that if you invent your own protocol that's not listed in Web Services specs, you shouldn't call it a web service. Execution-wise there is no necessary difference, it's just code, only that instead of outputting HTML, it outputs SOAP or XML-RPC (XML).
Vinko Vrsalovic
How do REST web services fit in you definition of having to 'output SOAP or XML-RPC' and provide a WSDL? I'm not even sure what you mean by 'outputing' xml-rpc.
Bedwyr Humphreys
It should say "outputs SOAP or XML-RPC messages" instead, sorry. What I mean is that the response instead of containing HTML, contains XML describing a remote procedure call message. I personally think that "REST web service" is a misnomer. You can implement web services (in the WS-* standards sense) using the REST architecture or choose not to. But I feel this is a lost battle, just like 'cracker' v/s 'hacker'.
Vinko Vrsalovic
A: 

Sites like Facebook and Flickr that have much the same kind of public APIs are calling them 'web services' and I don't see that you're doing anything different.

Vinko seems to have some objection to polluting the 'Web Service' moniker but there's plenty of room under the W3 definition of a web service to include what you're doing.

As for Web services having to output SOAP or XML and provide a WSDL? I think there's a few REST advocates that would argue that point.

Bedwyr Humphreys
You can implement discoverability and use in a REST-style architecture, or not. The problem I personally have with calling EVERY KIND of API that receives parameters and returns responses (in any format whatsoever) a web service is that it dillutes the meaning effectively making it meaningless. [Continues...]
Vinko Vrsalovic
Before I could be sure that if my app would communicate with some other app using Web Services I would barely need the other app devs support. I'd simply grab the WDSL and call the appropriate (documented) methods, receiving any kind of (potentially complex) response. Now, when everything is a 'web service', I have to wait for their documentation and see if it is a 'real' web service, or just some cooked up API where I have to implement an ad-hoc parser and see what structures do they return and implement specific response parsing code for each different API.
Vinko Vrsalovic