60.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"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
...
Message information
...
</soap:Envelope>
61.What does a SOAP namespace defines?
SOAP namespace defines the Envelope as a SOAP Envelope.
An example:
xmlns:soap=http://www.w3.org/2001/12/soap-envelope
62.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.
63.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:
SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding"
64.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.
65.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.
66.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
67.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.htmlu
68.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.
69.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.
70.What are HTTP methods supported by REST?
- GET;
- POST;
- PUT;
- DELETE;
- OPTIONS;
- HEAD.
71.Whether can use GET request instead of POST to create a resource?
It is not possibly, because GET can’t change a resource.
72.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.
73.What is WADL?
WADL (Web Application Description Language) is a XML description of a deployed RESTful web application.
74.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.
http://restlet.com/
75.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.
https://jersey.java.net/
76.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;
- AXB 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.
http://resteasy.jboss.org/
77.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.
78.What tool are required to test REST services?
Firefox “poster” plugin for RESTFUL services. https://addons.mozilla.org/en-us/firefox/addon/poster/
79.What does a @Path annotation do?
@Path annotation binds URI pattern to a Java method.
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@Path("/persons")
public class PersonRestService {
@GET
public Response getPerson() {
return Response.status(200).entity("getPerson is called").build();
}
@GET
@Path("/vip")
public Response getPersonVIP() {
return Response.status(200).entity("getPersonVIP is called").build();
}
}
On calling URI: “/persons” result: getPerson is called
On calling URI: “/persons/vip” result: getPersonVIP is called
80.What does a @PathParam do?
@PathParam annotation injects the value of URI parameter that defined in @Path expression.
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
@Path("/persons")
public class PersonRestService {
@GET
@Path("{id}")
public Response getPersonById(@PathParam("id") String id) {
return Response.status(200).entity("getPersonById is called, id : " + id).build();
}
}
On calling URI: “/persons/1” result: getPersonById is called, id : 1
|