Top 100+ Restful Java Web Services Interview Questions And Answers
Question 1. In Which Scenarios Restful Web Services Are Preferred Over Soap Ones?
Answer :
RESTful Web Services are preferred when:
a) The Web Services are absolutely stateless.
B) When records may be cached to enhance performance.
C) Schema of records may be agreed between carrier purchaser and provider company.
D) Bandwidth is confined.
Question 2. How Do You Refer Or Identify Resources In Rest Design Idiom?
Answer :
Resources are diagnosed via their particular URLs.
Web Service Testing Interview Questions
Question three. Is Rest Stateless Or Stateful Client-server Architecture?
Answer :
REST is stateless consumer-server structure.
Question four. Name The Java Api That Is Used For Building And Deploying Restful Web Services?
Answer :
JAVA API for XML Web Services (JAX-WS) and
JAVA API for XML RESTful Web Services (JAX-RS).
Web Service Testing Tutorial
Question five. How Web Service Interface For Restful Web Services Are Described?
Answer :
There isn't any formal way of describing the Web Service interfaces. To conquer this, provider producer and carrier patron agree on schemas that describe the information being exchanged.
Web Services Interview Questions
Question 6. Name Few Of The Jax-rs Implementations?
Answer :
Jersey, RESTEasy, Restlet are to name some.
Question 7. If I Plan To Use The Jersey Distribution For Restful Web Services, Do I Need To Download It?
Answer :
Yes. But in case you are using NetBeans IDE 6.0, downloading is not required.
Web Services Tutorial Core Java Interview Questions
Question 8. How Are Resources Addressed?
Answer :
Each useful resource is uniquely addressable the use of a familiar syntax to be used in hypermedia hyperlinks.
Question nine. In Restful Architecture, What Represents The Application State And Functionality?
Answer :
Uniquely Addressable Resources constitute the software nation and functionality.
Java-Springs Interview Questions
Question 10. What Is Shared Between Restful Resource That Is Used For Transfer Of State Between Client And Resource?
Answer :
A uniform interface is shared among sources that contains of a set of nicely?described operations, content material kinds and optionally helping code?on?call for.
Core Java Tutorial
Question 11. How Do You Annotate A Method To Respond To Http Get Requests?
Answer :
javax.Ws.Rs.Get annotation specifies that the annotated technique will serve HTTP Get request.
CSS Interview Questions
Question 12. Name The Most Commonly Http Methods Used In Designing Restful Services?
Answer :
PUT, GET, POST, DELETE.
Web Service Testing Interview Questions
Question thirteen. Define One-to-one Mapping Between Http Methods And Crud Operations?
Answer :
PUT maps to Create, GET maps to Retrieve, POST maps to Update, DELETE maps to Delete.
Java-Springs Tutorial
Question 14. What Are Idempotent Methods?
Answer :
A approach is said to be idempotent if repeated calls to it does no longer motive duplicates.
Question 15. In Order To Answer Http Put Requests, How Will You Annotate Your Resource Methods?
Answer :
The @PUT annotation is used to reply HTTP PUT requests.
Java Abstraction Interview Questions
Question 16. Why Put Methods Is Idempotent?
Answer :
PUT is used to create a resource and repeating the operation need to never create another reproduction of the resource.
CSS Tutorial
Question 17. What Is The Purpose Of Javax.Ws.Rs.Httpmethod?
Answer :
HttpMethod annotation is used to companion the name of a HTTP approach with an annotation.
Restful internet provider Interview Questions
Question 18. List Resource Method Designator Annotations?
Answer :
@GET, @PUT, @POST, @DELETE
Web Services Interview Questions
Question 19. Define Root Resource Class?
Answer :
Root resource magnificence is essentially a POJO (Plain Old JAVA Objects) that is annotated with @Path and has as a minimum one method annotated with @Path or have at least a single useful resource approach.
Restful net provider Tutorial
Question 20. Define Resource Method?
Answer :
Method of a resource elegance that is annotated with useful resource technique designator annotation is referred to as Resource Method.
Amazon Web Services (AWS) Interview Questions
Question 21. How To You Specify Relative Path Of A Resource In Restful Web Service?
Answer :
The @Path annotation is used to specify relative URI direction.
E.G.
@Path("/take a look at")
Question 22. How Can You Embed Variables In The Uri?
Answer :
Variables can be embedded in the URI syntax (called URI course template). The variables are substituted at runtime.
@Path("/test/username")
Spring MVC Framework Tutorial
Question 23. How Embedded Variables Are Represented In The Uri Syntax?
Answer :
Embedded variables are denoted by means of curly braces.
Spring MVC Framework Interview Questions
Question 24. How Can You Obtain The Value Of A Method Parameter In Restful Resource Method?
Answer :
@PathParam may be used on method parameter of a resource approach to achieve the fee for a way parameter.
E.G.
@GET
@Produces("textual content/simple")
public String getWelcomeMsg(@PathParam("username") String userName)
...
Core Java Interview Questions
Question 25. How Can You Define A Regular Expression For A Variable Say Username?
Answer :
@Path("users/username: [a-zA-Z][a-zA-Z_0-9]*")
Question 26. What Happens If Regular Expression Of A Uri Embedded Variable Is Not Matched?
Answer :
A 404 (Not Found) response will arise.
Soap Web Services Interview Questions
Question 27. Will The Following Direct To The Same Resource? @course("/test/") @route("/take a look at")
Answer :
Yes. By default, both should factor to the same resource, although Jersey has arection mechanism this is disabled through default.
Java-Springs Interview Questions
Question 28. Explain How To Specify Mime Media Types Of A Resource That Is Sent Back To The Client?
Answer :
@Produces annotation is used for this cause..
E.G.
@Produces("text/plain")
Question 29. Is It True That @produces Can Only Be Applied At Method Level?
Answer :
False. It can be implemented at each the elegance and technique stages.
Question 30. Can @produces Annotation Be Overridden In A Restless Resource? Give Example?
Answer :
Yes. In the following instance, the default MIME kind is about as text/undeniable but doGetAsHtml method overrides it to text/html.
@Path("/testResource")
@Produces("text/undeniable")
public elegance TestResource
@GET
public String doGetAsPlainText()
...
@GET
@Produces("text/html")
public String doGetAsHtml()
...
Question 31. How Can You Declare More Than One Media Type In The Same @produces Declaration?
Answer :
@Produces("utility/simple","application/xml", "utility/json")
Question 32. Assume That There Is A Resource Class Capable Of Producing More Than One Mime Media Type For Get. How Will Be The Response Method Chosen?
Answer :
Resource method is chosen depending on the most proper media kind as declared with the aid of the purchaser in the request header.
E.G.
Accept: textual content/simple.
Question 33. How Will You Specify The Mime Media Types Of Representations A Restful Resource Can Use?
Answer :
@Consumes annotation is for use.
CSS Interview Questions
Question 34. Write A Method That Is Triggered On Post Request And Takes Text/undeniable As Input?
Answer :
@POST
@Consumes("textual content/simple")
public void postMessage(String message)
...
Question 35. At Which Levels, @consumes Can Be Applied?
Answer :
@Consumes may be applied at each the elegance and method degrees.
Question 36. Give An Example Of Declaring More Than One Media Type In @consumes Declaration?
Answer :
@POST
@Consumes("utility/plain","software/xml")
public void postMessage(String message)
...
Java Abstraction Interview Questions
Question 37. Can Restful Web Services Support Multiple Types Of Response (mime) Formats?
Answer :
RESTful Web Services, through confirming to HTTP, does guide multiple styles of reaction (MIME) formats e.G. XML, JSON, PLAIN and so forth.

