Google

Apr 2, 2014

Java Web Service Pre Interview written test Questions and Answers

Q1. A web service protocol stack from bottom to top consists of

a) HTTP, SOAP, description language, UDDI
b) SMTP, XML messaging, WSDL, Service discovery
c) HTTP, XML messaging, WSDL, UDDI
d) HTTP, XML-RPC, WSDL, UDDI
e) HTTP, WSDL, SOAP, UDDI


A1. The answer is a,b,c, and d. The e is not right beacuse of the order.

This is an evolving standard, but the basic Web service protocol stack is (aka web service components)comprised of
  • Service transport is the lowest layer in the stack, and is responsible for transporting messages between applications. Currently, this layer includes hypertext transfer protocol (HTTP), Simple Mail Transfer Protocol (SMTP), file transfer protocol (FTP), and newer protocols, such as Blocks Extensible Exchange Protocol (BEEP).
  • XML messaging layer is responsible for encoding messages in a common XML format so that messages can be understood at either end. Currently, this layer includes XML-RPC and SOAP.
  • Service description layer responsible for describing the public interface to a specific web service. Currently, service description is handled via the Web Service Description Language (WSDL or WADL[for RESTful]).
  • Service discovery layer is responsible for centralizing services into a common registry, and providing easy publish/find functionality. Currently, service discovery is handled via Universal Description, Discovery, and Integration (UDDI).

Q2. What are the key roles played in a Web service

a) Service provider, Service requestor, Service registry
b) producer, consumer, Service registry
c) producer, consumer
d) publish, bind, find

A2. The answer is a,b,c, and d.

Q3. Which of the following are in the WSDL document structure?

a) types, message, port type, binding
b) input, output, binding, exception
c) types, input, output, exception
d) input, output, operations, binding

A3. The anser is a.

types: The data types used by the web service.

message: The input and output messages used by the web service.

port type: The operations performed by the web service. This is analogous to a class in Java programming. This also defines the input/output via messages. This is the most important part of the wsdl.

binding: The communication protocol used by the web service.


Q4. What are the different types of operations available in a WSDL?

a) One-way
b) Request-Response
c) Solicit-Response
d) Notification or fire and forget

A4. The anser is a, b, c, and d. Supports all 4 types of operations.

One-way: The operation (or endpoint) recieves a message, but will not return a response.
Request-Response: The most common one. The operation (or endpoint) recieves a request message and responds with a response message.
Solicit-Response: The operation (or endpoint) sends a request message and recieves a correlated response message.
Notification or fire and forget: The operation (or endpoint) sends a request message, but will not wait for a response.


Q. What is the difference between Request-Response and Solicit-Response?
A. Solicit-Response is a push operation like Notification, but waits for a response. Request-Response is a pull operation.

The only way to tell the difference between a request-response operation and a solicit-response operation is the ordering of the input and output elements. In request-response, the input child element comes first. In solicit-response, the output child element comes first.


Q5. Which of the following are true?

a) SOAP is a protocol and REST is a concept without any defined spec at all
b) SOAP is a XML-based message protocol, while REST is an architectural style
c) You can send SOAP envelopes in a REST application.
d) The REST verbs are "get", "put", "post" and "delete" and the nouns are identified by URLs.
e) SOAP allows many different verbs to be applied to many different nouns.

A5: The answer is a,b,c,d, and e. All are true.

a, b, and c are true because they state the fact that SOAP is an XML based message protocol and REST is a concept or architectural style.

d is true because RESTful url define the noun via the urls like

http://localhost:8080/accounting-services/1.0/forecasting/account/123/transaction/567
http://localhost:8080/accounting-services/1.0/forecasting/account/123/transactions/search?txn-date=20120201
http://localhost:8080/accounting-services/1.0/forecasting/account/123/transaction

e is true because you use different functions in SOAP port-type definition

Q6. Though both RESTful web series and SOAP web service can operate cross platform, they are architecturally different to each other. Which of the following statements are correct?

a) REST is more simple and easy to use than SOAP, hence currently more popular.
b) REST uses HTTP protocol for producing or consuming web services while SOAP uses XML.
c) REST is lightweight as compared to SOAP and preferred choice in mobile devices and PDA's.
d) REST supports different format like text, JSON and XML while SOAP only support XML.
e) REST web services call can be cached to improve performance.
f) SOAP provides more comprehensive security and transaction management.

A6: all are correct. SOAP Vs RESTful web service comparison


Q7. Which of the following statements are correct?

a) JAX-WS is an API for SOAP based web service.
b) JAX-RS is an API for RESTFul web service.
c) SOAP invokes services by calling RPC method, REST just simply calls services via URL path.
d) Apache CXF framework only supports JAX-WS
e) Jersey and RESTEasy are reference implementations of JAX-RS.

A7. a, b, c, and e are correct. d is incorrect because Apache CXF supports both JAX-WS and JAX-RS.




You may also like:  Java Web Services Interview Questions and Answers

Labels: ,

1 Comments:

Anonymous Anonymous said...

Good questions. Thanks for sharing.

1:23 AM, April 04, 2014  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home