140 likes | 159 Views
Java Web Services. Orca Knowledge Center – Web Service key concepts. Introduction. Internet or WWW resulted in the appearance 0f heterogeneous applications.
E N D
Java Web Services Orca Knowledge Center – Web Service key concepts
Introduction • Internet or WWW resulted in the appearance 0f heterogeneous applications. • Since they are built using different development languages, it becomes really difficult to ensure accurate communication between applications. • Here is where web services come in. • Web services provide a common platform that allows multiple applications built on various programming languages to have the ability to communicate with each other.
What is Web Service? • A web service is a software module which is designed to perform a certain set of tasks. • A web service enables communication among various applications by using open standards such as HTML, XML, WSDL, and SOAP. • The web services can be searched for over the network and can also be invoked accordingly. • When invoked the web service would be able to provide functionality to the client which invokes that web service.
How Web Services Work • A Web Service is described by a document in XML format, in the XML language known as WSDL (Web Services Description Language). This describes the service in terms of the operations, messages, and bindings that it contains, and may provide a URL at which the service may be called. • The structure of the messages is described using XML Schema (XSD) which is either contained in, or referred to by, the WSDL. • The messages sent to, and received from, the web service are all in the form of XML that complies to the schema, and which follows the protocols described by the WSDL, using an XML protocol known as SOAP (for Simple Object Access Protocol)
XML & Web Services • Requests are made through what is known as Remote Procedure Calls(RPC), which are calls made to methods which are hosted by the relevant web service. • The main component of a web service is the data which is transferred between the client and the server, and that is XML. • XML provides a common platform or language for application developed on various programming languages to talk to each other.
SOAP Messages • Web services data is represented and send between application using something known as SOAP (Simple Object Access Protocol) The data is sent over normal HTTP. • The data which is sent from the web service to the application is represented as a SOAP message. • The SOAP message is nothing but an XML document, that contains WS method’s data. • Since the document is written in XML, the client application calling the web service can be written in any programming language.
Web service Components • In order for a web service to be fully functional, there are certain components that need to be in place. • These components need to be present irrespective of whatever development language is used for programming the web service. • In this way, we can say that a Web Service is world common language that enables clients and different application to talk to each other.
SOAP (Simple Object Access Protocol) • SOAP is known as a transport-independent messaging protocol. • SOAP is based on transferring XML data as SOAP Messages.
WSDL (Web services description language) • A web service cannot be used if it cannot be found. The client invoking the web service should know where the web service actually resides. • The WSDL file is again an XML-based file which basically tells the client application what the web service does. • By using the WSDL document, the client application would be able to understand where the web service is located and how it can be utilized.
Universal Description, Discovery and Integration (UDDI) • UDDI is a standard for describing, publishing, and discovering the web services that is provided by a particular service provider. • UDDI provides a repository on which WSDL files can be hosted. • The client application will have complete access to the UDDI, which acts as a database containing all the WSDL files. • It is like a phone directory, that contains the information about a given person.
Why web services • Exposing Business Functionality on the network. • WS functionalities can be provided and transmitted over HTTP protocol, that means it can be used over Internet. • Interoperability amongst applications. • Instead of writing specific code which can only be understood by specific applications, you can write generic code that can be understood by all applications. • A Standardized Protocol which everybody understands. • Web services use standardized industry protocol for the communication. All the four layers (Service Transport, XML Messaging, Service Description, and Service Discovery layers) uses a standard, well-defined protocols to communicate.
JAX-WS vs. JAX-RPC • JAX-RPC is a specification/API for Java developers to develop SOAP based interoperable web services. This API is now obsolete, and may be dropped from the next JEE version. • JAX-WS is the successor to JAX-RPC. It requires Java 5.0, and is not backwards-compatible to JAX-RPC.
JAXB • JAXB stands for Java Architecture for XML Binding. It is used to convert XML to java object and java object to XML. JAXB defines an API for reading and writing Java objects to and from XML documents. • JAX-WS uses JAXB to manage all of the data binding tasks. • You can use the JAXB binding language to define custom binding declarations or specify JAXB annotations to control the conversion of data between XML and Java.