1. A web service is any piece of software that makes itself available over the internet and uses a
standardized XML messaging system. XML is used to encode all communications to a web
service. For example, a client invokes a web service by sending an XML message, then waits for
a corresponding XML response. XML request /response is not important now as technology evolved.
2. Types :
a. SOAP(“Big”) web service:
use XML messages that follow the Simple Object Access Protocol (SOAP) standard.
A formal contract must be established to describe the interface that the web service
offers. WSDL can be used to describe the details of the contract, which may include
messages, operations, bindings, and the location of the web service. You may also
process SOAP messages in a JAX-WS service without publishing a WSDL.
Uses JAX-WS API for its functionality.
Java API for XML Web Services (JAX-WS) is a technology for building web services and clients that
communicate using XML and also Remote Procedure Call-oriented (RPC-oriented) web services.
In JAX-WS, a web service operation invocation is represented by an XML-based protocol, such as SOAP.
The SOAP specification defines the envelope structure, encoding rules, and conventions for representing
web service invocations and responses. These calls and responses are transmitted as SOAP messages
(XML files) over HTTP.
On the server side, the developer specifies the web service operations by defining methods in the Java
programming language. A client creates a proxy (a local object representing the service) and then simply
invokes methods on the proxy. With JAX-WS, the developer does not generate or parse SOAP messages. It
is the JAX-WS runtime system that converts the API calls and responses to and from SOAP messages.
The basic steps for creating a web service and client are as follows:
o Code the implementation class.
o Compile the implementation class.
o Package the files into a WAR file.
o Deploy the WAR file. The web service artifacts, which are used to communicate with clients, are
generated by the GlassFish Server during deployment.
o Code the client class.
o Use a wsimport Ant task to generate and compile the web service artifacts needed to connect to
the service.
o Compile the client class.
o Run the client.
The @PostConstruct method is called by the container before the implementing class begins responding
to web service clients.
The @PreDestroy method is called by the container before the endpoint is removed from operation.
NOTE: JAXB Marshalling is the process of writing Java objects to XML file. Unmarshalling is
the process of converting XML content to Java objects.
lInk for Contract First, Contract Last Approach and flow of Soap Webservice: Like in our
project , how we are working