Welcome to Java4u

A Single Place for all Java Resources

Looking for something?

Subscribe to this blog!

Receive the latest posts by email.

.Just enter your email below if you want to subscribe!

Email

Tuesday, June 24, 2014

SOAP:JAX-WS

Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP). As described by the World Wide Web Consortium (W3C), web services provide a standard means of interoperating between software applications running on a variety of platforms and frameworks. Web services are characterized by their great interoperability and extensibility, as well as their machine-processable descriptions, thanks to the use of XML. Web services can be combined in a loosely coupled way to achieve complex operations. Programs providing simple services can interact with each other to deliver sophisticated added-value services. 
  • Web service can be written in any language java, .net, c++, python etc..;
  • Web service standard in interoperability (java web service can call .net code) & (java code can call .net web service)
Web services use XML messages that follow the Simple Object Access Protocol (SOAP) standard, an XML language defining a message architecture and message formats. Such systems often contain a machine-readable description of the operations offered by the service, written in the Web Services Description Language (WSDL), an XML language for defining interfaces syntactically.
 
E.g. let’s take getProducts () as a method as created a business service for it & this business service is deployed in your application server.
Here A, B & C are this .classes in the same application server & they are free to call this java  method to get the list of products .And if u want to provide this feature to users, so u could have like MVC Module that makes this available as a web application
 So the user can actually enter the URL and can see the list of products on their web browser, which is actually making call to this web service method getProducts(), so the MVC module  has a call to getProducts() & shows the products in a nice HTML designed format.
Lets take another server 2  in another machine , which contains one deployed application, and from this application we want to call this getProducts () method & show list of all products in this application.
Yes this is possible by packaging the business service method in .jar file, and deploying this jar file in this server2 & calling the business method   which is available in the jar file & this getProducts() is calling to a database, which has the list of products & this database is hosted along the sever 1 .

Dis-advantages:
  1. Server 2 has different database structure &  here data base which is hosted with server 1 has different products list which we are not interested.
  2. And when we create a version 2 for  getProducts(), we need to re- package the .jar file  & application need to rebuild and redeploy in server 2, by this way the new functionality is provided in machine server 2
Advantages:
  1. If the getProducts() call could directly call the business service method which is hosted in server 1,if it would directly call the instance this would be the best to get the service & this instance is directly access to the database & when there is a version change & functionality change we will have the latest list of products.
  2. This directly call will be worked only by using WEB SERVICE. Here it will allow 2 different machines and 2 different codes to be able to talk to each other over the network by using web service technology.
  

 

0 comments: