What are web services?
According to oracle docs, web services can be defined as
Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP). Web services provide a standard means of inter operating between software applications running on a variety of platforms and frameworks.
Main characteristics of the Web Services are:
Machine process able descriptions.
for example in simple words, when we call somebody so the person dialing and calling is the client  application , while person receiving the call is server applicationand "hello" word is the protocol as similar to HTTP request .
What is the difference between SOA and a web service?
SOA (Service-Oriented Architecture) is an architectural pattern that makes possible for
services to interact with one another independently.
Web Services is a realization of SOA concept, that leverages XML, JSON, etc. and common Internet protocols such as HTTP(S), SMTP, etc.
SOA is a system-level architectural style that tries to expose business. WOA is an interface-level architectural style that focuses on the means by which these service capabilities are exposed to consumers.
What is SOAP?
SOAP (Simple Object Access Protocol) is a transport protocol for sending and receiving requests and responses on XML format, which can be used on top of transport protocols such as HTTP, SMTP, UDP, etc.
What is REST?
REST (REpresentational State Transfer) is an architectural style by which data can be transmitted over transport protocol such as HTTP(S).
What is the difference between a REST web service and a SOAP web service?
Below are the main differences between REST and SOAP web service
·         REST supports different formats like text, JSON and XML; SOAP only supports XML;
·         REST works only over HTTP(S) on a transport layer; SOAP can be used different protocols on a transport layer;
·         REST works with resources, each unique URL is some representation of a resource; SOAP works with operations, which implement some business logic through different interfaces;
·         SOAP based reads can’t be cached, for SOAP need to provide caching; REST based reads can be cached;
·         SOAP supports SSL security and WS-security(Web Service-security); REST onlysupports SSL security;
·         SOAP supports ACID (Atomicity, Consistency, Isolation, Durability); REST supports transactions, but it is neither ACID compliant nor can provide two phase commit.
How to decide which one of web service to use REST or SOAP?
“REST vs SOAP” we can rephrased to "Simplicity vs Standard". Of course, "Simplicity" with REST at most cases wins, it wins in performance, scalability and support for multiple data formats, but SOAP is favored where service requires comprehensive support for security (WS-security) and transactional safety (ACID).
What is WSDL?
WSDL (Web Services Description Language) is an XML format for describing web services and how to access them.
What is JAX-WS?
JAX-WS (Java API for XML Web Services) is a set of APIs for creating web services in XML format.
What is JAXB?
JAXB (Java Architecture for XML Binding) is a Java standard that defines how Java objects are converted from and to XML. It makes reading and writing of XML via Java relatively easy.
Can we send soap messages with attachments?
Yes, we can send different formats such as PDF document, image or other binary file with soap messages as an attachment. Messages send using the binary data. SOAP messages is attached with MIME extensions that come in multipart/related. 
An example:
MIME-Version: 1.0
Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml;
        start="<claim061400a.xml@ javahungry.com>"
Content-Description: This is the optional message description.
<?xml version='1.0' ?>
<theSignedForm href="cid:claim061400a.tiff@javahungry.com"/>
Content-Type: image/tiff
Content-Transfer-Encoding: binary
Content-ID: <claim061400a.tiff@javahungry.com>
...binary TIFF image...
What is MTOM?
MTOM (Message Transmission Optimization Mechanism) is a mechanism for transmitting large binary attachments with SOAP messages as raw bytes, allowing for smaller messages.
What is XOP?
XOP (XML-binary Optimized Packaging) is a mechanism defined for the serializationof XML Information Sets that contain binary data, as well as deserialization back into the XML Information Set.
What is a SOAP envelope element?
SOAP envelop element is the root element of a SOAP message which defines the XML document as a SOAP message.
An example:
<?xml version="1.0"?>
  Message information
What does a SOAP namespace defines?
SOAP namespace defines the Envelope as a SOAP Envelope.
An example:
What is the SOAP encoding?
SOAP encoding is a method for structuring the request which is suggested within the SOAP specification, known as the SOAP serialization.
What does SOAP encodingStyle attribute defines?
SOAP encodingStyle defines the serialization rules used in a SOAP message. This attribute may appear on any element, and is scoped to that element's contents and all child elements not themselves containing such an attribute. There is no default encoding defined for a SOAP message.
An example:
What are 2 styles web service’s endpoint by using JAX-WS?
·         RPC (remote procedure call) style web service in JAX-WS;
·         document style web service in JAX-WS.
What is encoding rules for header entries?
·         a header entry is identified by its fully qualified element name, which consists of the namespace URI and the local name. All immediate child elements of the SOAP Header element must be namespace-qualified.
·         the SOAP encodingStyle attribute may be used to indicate the encoding style used for the header entries.
·         the SOAP mustUnderstand attribute and SOAP actor attribute may be used to indicate how to process the entry and by whom.
What is the wsimport tool?
The wsimport tool is used to parse an existing Web Services Description Language (WSDL) file and generate required files (JAX-WS portable artifacts) for web service client to access the published web services: https://docs.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html
What is the wsgen tool?
The wsgen tool is used to parse an existing web service implementation class and generates required files (JAX-WS portable artifacts) for web service deployment: http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsgen.html
What the tool are required to test SOAP services?
SOAPUI tool for SOAP WS: http://www.soapui.org/
What is the difference between SOAP and other remote access techniques?
SOAP is simple to use and it is non - symmetrical unlike DCOM or CORBA is highly popular and usually have complexity in them.
SOAP provides greater platform independent with the language independence unlike DCOM or CORBA doesn't provide any of these.
SOAP uses HTTP as its transport protocol and the data are being saved in XML format that can be ready by human, whereas DCOM or CORBA have their own binary formats that are used to transport the data in complicated manner.
SOAP identify the object other than URL endpoint. SOAP objects are stateless and it is hard to maintain that. Whereas, it is not hard to maintain in case of other remote access techniques.
What is a resource in a REST?
A resource is a unique URL with representation of an object which we can get contents via GET and modify via PUT, POST, DELETE.
What are HTTP methods supported by REST?
·         GET;
·         POST;
·         PUT;
·         DELETE;
·         OPTIONS;
·         HEAD.
Whether can use GET request instead of POST to create a resource?
It is not possibly, because GET can’t change a resource.
What is the difference between PUT and POST?
Need to use PUT when can update a resource completely through a specific resource. For example, if know that an article resides at http://javahungry.blogspot.com/article/123, can PUT a new resource representation of this article through a PUT on this URL. If do not know the actual resource location for instance, when add a new article, can use POST.
PUT is idempotent, while POST is not. It means if use PUT an object twice, it has no effect.
What is WADL?
WADL (Web Application Description Language) is a XML description of a deployed RESTful web application.
What are frameworks available to implement REST web services?
Jersey, Restlet, EasyRest, etc.
What is the Restlet framework?
Restlet is a lightweight, comprehensive, open source RESTful web API framework for the Java platform.
It has advantages such as
·         websocket and server-sent events support;
·         HTTP/2 support;
·         transparent HTTP PATCH support;
·         client cache service;
·         fluent APIs.
What is the Jersey framework?
Jersey is open source framework for developing RESTful Web Services in Java that provides support for JAX-RS APIs and serves as a JAX-RS (JSR 311 & JSR 339) Reference Implementation. It has advantages such as
·         contains support for Web Application Description Language (WADL);
·    contains Jersey Test Framework which lets run and test Jersey REST services inside JUnit;  
·         supports for the REST MVC pattern, which would allow to return a View from Jersey services rather than just data.
What is the RESTeasy framework?
RESTeasy is a JBoss project, which implements of the JAX-RS specification. It has benefits such as
·  fully certified JAX-RS implementation; supports HTTP 1.1 caching semantics including cache revalidation;
·    JAXB marshalling into XML, JSON, Jackson, Fastinfoset, and Atom as well as wrappers for maps, arrays, lists, and sets of JAXB Objects;
·         OAuth2 and Distributed SSO with JBoss AS7;
·         rich set of providers for: XML, JSON, YAML, Fastinfoset, Multipart, XOP, Atom, etc.
What is the difference between AJAX and REST?
in Ajax, the request are sent to the server by using XMLHttpRequest objects; REST have a URL structure and a request/response pattern the revolve around the use of resources;
Ajax eliminates the interaction between the customer and server asynchronously; REST requires the interaction between the customer and server;

Ajax is a set of technology; REST is a type of software architecture and a method for users to request data or information from servers.
Request to Download PDF

Post A Comment: