Q-14. What Do You Understand by Payload in Restful Web Service?
Q-14. What Do You Understand by Payload in Restful Web Service?
Ans. Request body of every HTTP message includes request data called as Payload.
This part of the message is of interest to the recipient.
We can say that we send the payload in the POST method but not in <GET> and
<DELTE> methods.
Q-15. What is the upper limit for a payload to pass in the POST
method?
Ans. <GET> appends data to the service URL. But, its size shouldn’t exceed the
maximum URL length. However, <POST> doesn’t have any such limit.
So, theoretically, a user can pass unlimited data as the payload to the POST method.
But, if we consider a real use case, then sending a POST with large payload will
consume more bandwidth. It’ll take more time, and present performance challenges to
your server. Hence, a user should take action accordingly.
Ans. Caching is a process of storing server response at the client end. It makes the
server save significant time from serving the same resource again and again.
The server response holds information which leads a client to perform the caching. It
helps the client to decide how long to archive the response or not to store it at all.
Ans.
SOAP REST
1. SOAP is a protocol through which two 1. Rest is a service architecture and design for network-
computer communicates by sharing the XML based software architecture.
document.
2. SOAP supports the only XML format. 2. It supports many different data formats.
6. It runs on HTTP but envelopes the message. 6. It uses the HTTP headers to hold meta information.
Q-18. What are the tools available for testing web services?
Ans. Following tools can help in testing the SOAP and RESTful web services.
1. SOAP UI tool.
2. Poster for Firefox browser.
3. The Postman extension for Chrome.
Q-19. Explain the factors that help to decide about the style of web
service to use? SOAP or REST?
Ans. In general, using REST-based web service is preferred due to its simplicity,
performance, scalability, and support for multiple data formats.
However, SOAP is favorable to use where service requires an advanced level of
security and transactional reliability.
But you can read the following facts before opting for any of the styles.
1. Does the service expose data or business logic? To expose data REST will be a
better choice and SOAP for logic.
2. If the consumer or the service providers require a formal contract, then SOAP can
provide such a contract via WSDL.
3. Need to support multiple data formats. REST supports this.
4. Support for AJAX calls. REST can use the XMLHttpRequest.
5. Synchronous and asynchronous calls – SOAP enables both
synchronous/asynchronous operations whereas REST has built-in support for
synchronous.
6. Stateless or Stateful calls -REST is suited for stateless operations.
Here are some of the advanced-level facts that you can consider as well.
Q-20. Can you tell us which Java API helps in developing a RESTFul
web service?
Ans. There are many frameworks and libraries available that a developer can use to
create RESTful web services in Java. For example, the JAX-RS library is a standard
way to develop a REST web service.
Also, Jersey is another most popular implementations of JAX-RS which offers more
than what the specs recommend. There are others like RESTEasy, RESTlet, and
Apache CFX.
If you like Scala, then you should be using the Play framework to develop RESTful
web services.