I'm trying to understand the difference between Web Services and Websites.
In college, I learned how to build a website up by writing servlets and JSPs. However, I want to build"websites" using methods that people are using right now.
But I'm confused with the term of Web Services / Websites.
I was reading on JAX-RS, and it seems that JAX-RS is used for web services, and then I figured out there's a server side and client side. Does it mean that this application was created to communicate with each other using HTTP? An example is chat room that communicates through HTTP port? Then does this have nothing to do with creating website?
Does this means that JAX-RS is not used for building websites?
I'm being confused over this topic already. Can someone point me to the right direction?
Thanks
Website you have developed using JSP and Servlet can be categorized as a fully fledged web application where there is a backend (database, etc) and a UI front end for user interaction.
Webservices on the other hand are a set of services exposed through a set of URL or URI which doesn't necessarily have a UI front end for direct user interaction. More like an API.
For Example, Facebook can be considered as a dynamic website and Facebook Developer API which provides different services for third party (such as authentication, friends list, messages etc) can be considered as web service.
I was reading on JAX-RS, and it seems that JAX-RS is used for web services, and then I figured out there's a server side and client side
Yes JAX-RS is mostly used in web services and web services do have a client side. This client is mostly another application written to call the web service and rarely has user interaction.
Does this means that JAX-RS is not used for building websites?
No it is possible to use JAX-RS to build websites also. If you layer your web services using JAX-RS and then create web pages with Javascript or Flex or some other client to consume and produce for those JAX-RS web services then you can build a web site.
JAX-RS is a specification for RESTful Web Services with Java.
A service provides certain operations(server side). A client consumes the operations of a service. So a website could be a client of a service.
A web site can be used to collect and send data to services as well as display the results.
For example you login to a website to purchase a flight. The website asks for date of departure, departure city/state, destination city/state. Once you enter this information the website collects this data and builds a request and invokes some service. In return the service responds with flights that meet your date and destination requirements. The site parses this information and displays this data for you to choose the desired flight.
The website provides a user experience suitable for the data retrieved/displayed.
The web service enables the passing of this data via a defined request/response.
Related
I am planning an application that will have a web front end (maybe ember) but I want to keep my options open for a native desktop application and/or an android application. I would like the all of the backend logic to be exposed as a RESTful service. The problem that arises in my mind is about user authentication. Since a RESTful service can't keep state on the server, I would need to keep it on the client in javascript. However this is wildly insecure do to the fact that users have the ability to edit the javascript data. What is the correct way to make a client side application communicate with a RESTful backend? I realize that I could just store state on the server anyways(inside the session object), but i would like to follow the REST paradigm. What is the de facto solution for this problem? Thanks in advance.
I am new to the angularJS.Earlier we were developing our web application with the gwt at client side.
Now we decided to move to AngularJS from GWT because our application speed have became slow and also because of some of the awesome features of AngularJS. I have gone through the documents and did some practice about basic AngularJS.
In GWT, We used GWT-RPC mechanism to communicate with the server, but i could not be able to get mechanism that i have to communicate with the server in AngularJS. Please let me know procedure to deal with server to get, put, delete etc..data in AngularJS.
If possible please give me a link to get the sample project.
Any Suggestions would be great.
you can use one of the three alternatives below
You have to use $resource to make a RESTFULL communication with the server thats the prefered way in angularJS
you can get started with this
as you are from java background i suggest you to see AngularJS Example Using a Java RESTful Web Service
$http service is a core Angular service that facilitates communication with the remote HTTP servers via the browser's XMLHttpRequest object or via JSONP.
Restangular is an AngularJS service that simplifies common GET, DELETE, and UPDATE requests with a minimum of client code. It's a perfect fit for any WebApp that consumes data from a RESTful API.
Nice article on how to leverage AngularJS with Google Cloud Platform and, in particular, Google Cloud Endpoints
AngularJS + Cloud Endpoints: A Recipe for Building Modern Web Applications
We are currently working on a project which includes Mobile Apps and a front-end website. The backend server has already been built and running as Java Application under Tomat, which support all the APIs.
I am wondering, if a front-end website could be built under same domain or across domain, and calling the same APIs from the backend server? like what Mobile App does?
By the way, all the front-end does not need to communicate with database, the data will be retrieved through server APIs.
I only done mobile apps, and a web greener, if there is anything misunderstanding, please comment, thanks:)
Update
Is it possible to use WordPress or Drupal to build this front-end website? or should I built myself with pure html?
I am wondering, if a front-end website could be built under same domain or across domain, and calling the same APIs from the backend server? like what Mobile App does?
Short answer: Yes.
Slightly longer answer:
Provided that the front-end web pages don't include or generate any URLs that refer to the backend site, there should be no cross-site issues. If possible, this is the architecture you should aim for.
If you do need the front-end web pages to include backend URLs1, then there are ways to deal with this ... is the user's web browser supports the relevant technologies; e.g. CORS.
1 - ... and the browser needs to be able to resolve / fetch them.
If the backend is exposed as webservices, a front end webapp can call those services via ajax if they are in the same domain. If they are cross domain, it gets a little trickier because of the Same Origin Policy (there are techniques like JSONP and CORS to help with that).
In my java based web application (struts 2 and hibernate 3). I have made a web-service using apache axis.
The web-service has to return data from the database which will be used by the android application.
Now, that service obviously has to be published on a public ip so that I can access it in the android app.
What are the options to publish it on free public ip's or domains ?
Would it be better if I use REST instead of apache-axis to make a web-service? What is JAX?
And for android developers , How a web service is consumed in android?
Please answer its urgent and important.
In order to publish on the web you need to put it on a web enabled server, you can do it in several ways:
Turn your computer to a server (thuis is one article, just search in google "how to turn my computer to web server").
Upload your files to a free host
Upload your files to a paid host (usually for a very small fee)
REST vs SOAP (apache-axis):
I would recommend going with REST as it is more lighweight and more flexible (it enables you to get a response as xml,json,html while soap is usually just XML).
JAX-RS id java API for creating REST web services. Look at the jersey framework.
AJAX is a way to send/get data asynchronously and is used wideley in web applications.
How a web service is consumed in android can wideley vary depending on the technology you are using.
Well, past few days I am trying to put plans for my chess server project on the table. It is planned to be made of several web services which interact mutualy. Web services are planned to be made with Java language and deployed onto Apache Tomcat 7.0.20 with Axis2 1.6.0 web service engine.
So far, there will be authentication web service, player pool web service, validation web service and 'bussiness logic' web service which will be only web service known to client application. All clients requests will be done through this service and forwarded respectively.
All players moves must go through web services because of move validation, history and so on. Problem occurs when other player needs to be informed of opponents played move. Persistant client request (to discover is opponent played move) towards service is out of question because player turn change must be immidiate when opponent play his move. How to achive this using java web services and eralier mentioned technologies? Is it possible to web service contacts opposed player and inform him about opponents move? Is there another way to do this with this scope of technologies?
Edit: Client application is planned to be desktop application, possibly Java or C#.
One option for Tomcat-to-web-browser push communication is Comet (sometimes called CometD or Bayeaux).
From the wiki article:
Comet is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it.
(Note: Emphasis Mine)
What this means is that the server can notify the client of pending changes without the browser specifically polling. With a good JavaScript framework (such as Dojo or this jQuery plugin), you can seamlessly work with older browsers by polling.
Some good links for learning more about Comet:
RESTful Web Services and Comet
Comet Slideshow Example on Grizzly
Advanced IO and Tomcat
Dojo Foundation CometD
Hopefully this helps.
You do not state your client technology (browser? desktop app?)
Anyway, there is no direct solution if you are addressing home users. To work with home users, you would need them to open / NAT the needed port to their computer so you can access their PC. It is very complicated to the average home user.
For browser it is even more complicated as they are clients, not servers. Maybe some framework might be used to simulate a server inside a browser (I think there is at least one but I cannot recall its name), but that would work like just by repeating ajax calls to the server until a change is made.
And last, if you are checking the server every second, that would be a latency low enough even for "fast-chess".