AJAX is a technique for improving the user experience. You are able to
update the user interface without posting back and redisplaying the
entire page to the user.
Web services are services accessed over http using xml standards that
allow software systems to communicate using a standard protocol, I can
write a web service implemented in java and use it with a c# client for
example.
AJAX is about user interfaces, web services are about systems
interfaces. If you write an html form with some fancy AJAX that's not a
web service. How does my java application talk to your web service? It
doesn't!
It very possible to design an AJAX system with the EJB or webservice.
There is only one thing you must note. Ajax is using HTTP verbs, that
means it only talks to Servlet for (java) or CGI, or anything that is
using HTTP.
Now if you really need to make use of EJB or webservices.
This is the basic design:
AJAX ---HTTP--> Servlet ---> EJB / WebService
AJAX ---HTTP--> Webservice
For directly accessing webservices, you need to construct your SOAP message in your javascript code. Then send it thru POST.
You will get a SOAP message where you need to parse the content.
For EJB, there is always a requirement for the server-side code that accepts HTTP requests, to be able to access EJB.
1 comment:
Nice and simple explanation.
I like simplicity :)
Thanks.
Post a Comment