This question already has answers here:
What is the difference between a web API and a web service?
(13 answers)
Closed 6 years ago.
I have already gone through to the couple of tutorials to find the answer of this question but I did not find out the exact one. Everyone discusses about the api which we generally use with our project as a dependency but I always ask this question in context of web only.
What do you think about it?
Is there any difference between these two terms : Web Services and Web API
ya definitely there is difference between both of this frameworks.
In .net web services are built using wcf framework and web api are built using webapi framework.
If you are beginner i would say that web api is nothing but advanced and well developed form of web services.
web api are built as they can serve any type of devices in any format(content-type) of data.
Actually webapi vs web service is such concept that is difficult to explain but very easier to understand by doing some mock labs or experiments.
Related
This question already has answers here:
Servlet vs RESTful
(3 answers)
Closed 6 years ago.
I have created many REST web services providing JSON before using PHP and NodeJS and I know the concept.
Now I want to re-implement those web services using Java instead. After doing some research for how to implement web services in Java, I found some standards or libraries like JAX-RS, Spring or Jersey. However I not know the difference between all of them.
I wonder why we do not make a simple servlet which will be called through HTTP request and returns the result in the JSON format. And if I wanted to use one of these standards, what would be the best choice to implement web services that accepts HTTP requests and returns JSON?
You can use a stone to drive a nail into the wall. For sure you can. But why would you do that if you have a hammer available? Using the proper tool will make your life a lot easier.
In a similar way, you can create REST applications using only the Servlet API. However, there are other APIs that are designed to create REST applications. So, why don't you use them?
JAX-RS and Jersey
JAX-RS, currently defined by the JSR 339, is the standard Java API for creating RESTful web services and it's built the top of the Servlet API.
It's important mention that JAX-RS is an specification. In order to use it, you will need an implementation, such as Jersey, which is the reference implementation.
A few resources that may be useful:
JAX-RS 2.0 specification
Jersey documentation
Spring Framework
The Spring Framework allows you to create RESTful web services and it can be easly integrated with other Spring projects.
A few resources that may be useful:
Spring Framework website
Spring Framework documentation
Guide to build a RESTful web service with Spring Framework.
Other resources you may consider useful
Why use a framework for RESTful services in Java instead of vanilla servlets
Why use JAX-RS / Jersey?
Spring 4 vs Jersey for REST web services
Difference between JAX-RS and Spring Rest
You can do it using Servlet API actually. But you won't get all the benefits of JAX-RS like url mapping, parameters injection, ... You would have to write all this "by hand".
By the way, the difference between JAX-RS and Jersey is that JAX-RS is a specification, a standard and Jersey is an implementation of that standard. There are other implementations as well (RestEASY for example). Spring also has a module for REST services.
I have searched a lot upon internet but still i didn't get the clear difference between web services and web APIs? Somewhere I read that all web services are API's but all API' are not web services. How?
What all I know is both allow to utilize the functionality of other applications.Can someone describe me clear difference?
I have been on the same journey to learn the differnce between Web API (not JUST API) vs Web Services.
First, we know for a fact that both use the Web as the communication tool as stated by #Kris.
While looking at these 2 videos, both serve as the "middleman" (the waiter in the restaurant) for a client to ask a Web Server to process and deliver a response.
Web Service (From 0:35)
API (In general) (From 1:12)
When I was looking for an actual differnce between the two, usually most articles and videos go on an unrelated comparison between "Web Services vs API" as they exclude the "Web" out of "Web API".
See this article, for example, which contains the title "Web API Vs Web Service...." yet, contain sub-titles like:
"Differences of API vs Web Service"
"Pros and Cons of Web Services vs API Service"
"Web Service vs API: Fueling Both With Scraping Robot’s API"
The only difference I could find is if we were to discuss this in .NET context.
Here's a question post related to this.
To sum it up, Web Services are used in the SOAP protocal while Web API is usually created in the RESTful way. The more detailed answers are in the post but ultimatelly do not answer the main question that is asked.
Conclusion: The question raised in the public domanin has no clear definition to what is difference between the two, thus the 2 terms are ,for the most part,
interchangeable
All web services are APIs. An API is an Application Programming Interface. But there are offline APIs, which are not web services. There are APIs for all things from Office to Websites. The API is just a defined interface to be able to control/communicate with some software. Web Services just provide that means of connecting over the web.
There is more to discuss when you are talking about APIs which are communication protocols and data formats, but you get the basic idea.
An API (Application Program Interface) is the interface through which another program can communicate with a program.
A web service in this context is one of those programs with an API. 'Web' means that it is accessible via the web, mostly via HTTP. A service usually has a well defined purpose.
For instance a date web service's purpose could be to provide the current date. The API of my service would have a single 'endpoint': get the date. The service then implements this API. It somehow retrieves the date and sends it back.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am new to web services programming. Recently I started learning web services but there I came across various specifications like:
REST
JAX-WS
JAX-RPC
etc.
Kindly update me that does these technologies occur in parallel or some are old versions and others are new versions of the same.
Also do I need to follow a hierarchy while learning these or I could start with any one randomly.
Thanks in advance
rest is a new way of implementing and describing web services via HTTP methods and URIs. Java helps with implementing such web services with jax-rs standard. REST services are often easy to interact with using browser, curl or any HTTP client. See StackOverflow API for an example.
jax-ws is similar to JAX-RS but provides standard way of implementing soap web services (older but also better recognizable in industry). SOAP is much more complex than REST, all messages are sent inside XML envelope, but the protocol is not restricted to HTTP and request-response.
jax-rpc is outdated and currently deprecated:
JAX-RPC 2.0 was renamed JAX-WS 2.0
REST: Representational State Transfer (REST) is a style of software architecture for distributed systems such as the World Wide Web.
http://en.wikipedia.org/wiki/Representational_state_transfer
Java API for XML Web Services (JAX-WS), is a set of APIs for creating web services in XML format (SOAP) mkyong.com/tutorials/jax-ws-tutorials/
JAX-RPC: Java APIs for XML-based Remote Procedure Call (JAX-RPC)
http://www.ibm.com/developerworks/library/ws-jaxrpc1/
As you notice from above descriptions, first one is a architecture and the rest are Jaa APIs.
You may start with REST then based on your requirement choose the API.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
can anybody give me some example?
A web service will expose an API.
Not all APIs are web services - any library will have an API.
APIs are the public interface of a piece of code - it is what you can call from within your code. It may be a web service, but it could also be a JavaScript library, a compiled library for your platform (say .NET assembly, java JAR, a PE DLL and more).
API is more of an abstract concept it is a programatic interface for your application it can be implemented in veraity of methods and technologies. Webservice is a spesific implemenation of such concept that using SOAP and HTTP technologies.
API is an acronym that stands for Application Programming Interface, as such it can be used to describe any piece of software you can use inside another software to develop an application or part of it. As an example the library/module/classes that allow you to open a file and read its contents is an API: you don't know how it works but you can use it into your software to achieve a possible complicate goal.
A web service is usually a remote piece of software capable of responding to web requests which provides some sort of functionality. Usually the word is used to indicate SOAP web services, but a RESTful application is a web service as well. In a broader sense of the word any web site is a web service as they provide a service over the web, but usually we do not consider them in that category because we refer to machine-to-machine interactions.
Now, if you consider that a web service can be used by your application to deliver part of your application logic then a web service IS an API.
They are same thing, Web Service is a specific type of API that is accessed over the web.
Facebook - offers a Web service / API
Twitter - offers a Web service / API
Windows - offers an API
An "Application Programming Interface" was originally used to describe the interface offered by system software(Windows) to be used by application programs (word, Microsoft paint etc...). The term API has since then evolved to encompass pretty much any software interface.
A web service is a software interface that is accessed over the web.
IMO API's that are accessed over the web should only be called Web Services, However the masses have started calling them API's - so that is what it is.
I wrote more about API's here: http://www.woodstitch.com/resources/what-is-an-api.php
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
what is the purpose of web services?
i mean isn't all web applications a web service ?
also why do people create API web services? is it to let developer's use the website's functions? kinda like facebook and youtube ?
is it possible to make a API for web service where you can use C++ or VB to use the functions? therefore, someone could make a desktop application based on your web application's API ?
how do you create a web service API and a web service ?
what is the purpose of web services?
Allow the easy consumption of a service using web technologies? I mean, you can potentially code your application to do what the browser does ( that's how many applications for stackoverflow have been done in the past )
The problems are:
it is much harder than using an API
Since there is no API, changes in the website do crash your application ( while responsible API's will allow you to use your old version )
i mean isn't all web applications a web service ?
Not at all. A web app is an specific application designed to be used by a webbrowser ( firefox, chrome, etc ) While a webservice is meant to be consumed by other application.
You can consume a webservice in pretty much any programming language out there.
also why do people create API web services? is it to let developer's use the website's functions? kinda like facebook and youtube ?
Not the website functionality but to allow them to create own applications that use some functionality of that website.
For instance YouTube allow you to upload videos with it's API, otherwise you'll have to "simultate" the HTTP post which can be problematic.
That way, some tools offer the capability of "uploading" your video directly from the app.
is it possible to make a API for web service where you can use C++ or VB to use the functions?
That's the point, among other programming languages.
therefore, someone could make a desktop application based on your web application's API ?
Exactly!!!
Here's an example of the Object-C application I use for Twitter ( tweetie http://www.atebits.com/tweetie-mac/ )
(source: cachefly.net)
how do you create a web service API and a web service ?*
It is not much different from creating a API for an internal fremework/product/library.
You have to define what are you going to offer ( your public interface, your services that is )
Create a list of in/out parameters and interchange formats ( XML, json, text/plain, YAML, whatever )
And finally provide and endpoint in the web ( or why not intranet )
Webservices could are harder to control than regular APIs, you have to check security concerns, work load etc.
To see a working API refer to that mentioned by Nathan here
There are basically two different types of webservices, one that is SOAP-based and the other is REST-based.
Either can be accessed by desktop applications. I have written applications, such as screensavers, that will interact with the server through both of these types of webservices.
An API is useful so that people can write applications, as you mentioned, to use these services, as, without applications using them, these webservices are pretty useless.
A SOAP-based webservice is basically just a web application that sends and receives using an xml message format that follows a standard.
A REST-based webservice is the cgi-based application that is similar to using an html form element, generally using GET, but, if you are doing anything that can be destructive, or change databases, you will want to use POST.
You can write applications using these APIs in any language, which is the advantage, as you can then choose which language is best for the server-side, and that has no impact on what you do on the client-side.
How to create a webservice will depend on which of the two main types you want to create, and which language you choose to use.
A web service is a type of program running on a web server built especially for other programs to use, by submitting information requests to it in a particular format (usually some information wrapped in XML).
The API part (Application Programming Interface) is usually a class or set of classes that have the code that knows how to format the information to make requests from the Web Service - so that your program only needs to make the usual function calls to the API classes.
It simplifies your use of the web service.
Here is an example of how to make one, and use it for .NET languages: http://www.codeproject.com/KB/XML/BeginnerWebService.aspx
Any program that uses the web for its interface is a web application, like this site or Facebook.
An Application Service Provider is a company that helps you write web apps (http://en.wikipedia.org/wiki/Application_service_provider) or provide other services.
Normally a API is developed to create program that interact with the site, like the Twitter API, that you can use Twitter functions in a program.
If you ever developed applications that rely on libraries or dlls in terms of windows programming. Think of a web service as a dll hosted on a web server that has a direct URL to it.
So your application or website can read the data exposed from the URL that you can use as function calls.
Web services transmits data via xml, once the language you write your application in can read xml, you can write it to make calls to the web service, that is passing parameters and the function name to the service, then if expecting a return value, your application reads the data from xml.