1) Introduction
In this technical article, let us see how it is possible to access Web Services from JSF Applications. JSF Application resides in the Web Tier of a typical Enterprise Application, whereas Web Services are External Services that reside in the Application Tier. We make use of Java EE 5 for developing the Sample Application in the final section of this article. It is assumed that readers have sufficient knowledge of JSF and Web Services before continuing this article. They also can have a glance over the introductory JavaBeat article on Java Server Faces before proceeding with this.
2) Web Services
2.1) Introduction
Web Services have been there in the software market over a decade of years and they are gaining more popularity in the recent years. Web Services provide an integration layer between two heterogeneous Applications. With Web Services, it is now possible to access a Java Application that is running in some remote machine with the client being any of the compliant languages like C, C++ or C#. This ensures that Web Services promote language interoperability. It is not necessary that both the Server and Client Application must be running in the same platform, thereby making it platform independent. Web Services alone is not a standard, instead it is a combination of several standards like SOAP, WSDL etc.
2.2) SOAP
SOAP stands for Simple Object Access Protocol and this is used in Web Services for transmitting messages between the Client and the Server. Technically, a SOAP message is in Xml format that conforms to a well defined schema. It means that a Client Application will construct its request in a SOAP message and send the message to the Server. The Server after unpacking the SOAP message will analyze the type of request and will return a suitable response in the form of a SOAP message.
2.3) WSDL
WSDL stands for Web Service Description Language and this is the Client facing interface for accessing the Web Service. A typical WSDL file, which is also in Xml format, will list down all the possible Web Service that can be accessed over the Internet. Not only it will list down all the Web Services, but also the various supported operations that a particular Web Service will support