This set of Java Spring Multiple Choice Questions & Answers (MCQs) focuses on “SOAP Web Service”.
1. A web service contract is described using :-
a) Web Services Description Language
b) Web Services Description
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: In contract-last, you expose an existing service interface as a web service whose service contract is generated automatically.
2. There are two approaches to developing a web service, depending on whether you define the contract first or last.
a) True
b) False
View Answer
Explanation: A web service contract is described using Web Services Description Language (WSDL). In contract-last, you expose an existing service interface as a web service whose service contract is generated automatically. In contract-first, you design the service contract in terms of XML and then write code to fulfill it.
3. In contrast, the contract-first approach encourages you to think of the service contract first in terms of :-
a) XML
b) XML Schema(.xsd)
c) WSDL
d) All of the mentioned
View Answer
Explanation: In contrast, the contract-first approach encourages you to think of the service contract first, in terms of XML, using XML schema (.xsd) and WSDL.
4. In some cases, it’s also hard to map an object to XML (e.g., an object graph with cyclic references) because there’s actually an impedance mismatch between an object model and an XML model.
a) True
b) False
View Answer
Explanation: Just like that between an object model and a relational model.
5. Service exporters that can export a bean as a remote service based on the :-
a) RMI
b) Hessian
c) Burlap
d) All of the mentioned
View Answer
Explanation: Spring comes with several service exporters that can export a bean as a remote service based on the RMI, Hessian, Burlap, or HTTP Invoker remoting technologies.
6. Spring comes with a service exporter that can export a bean as a SOAP web service.
a) True
b) False
View Answer
Explanation: Spring doesn’t come with a service exporter that can export a bean as a SOAP web service. We will use Apache CXF, which is the de facto successor to XFire.
7. The standard for deploying web services on the Java EE platform as of Java EE 1.4:-
a) JAX-RPC
b) JAX
c) RPC
d) None of the mentioned
View Answer
Explanation: The standard for deploying web services on the Java EE platform as of Java EE 1.4 was called JAX-RPC. It supported SOAP 1.0 and 1.1, but didn’t support message-oriented web services.
8. To send objects across the wire, beans need to be encoded using the Java Architecture for XML Binding (JAXB).
a) True
b) False
View Answer
Explanation: JAXB supports many class types out of the box with no special support.
9. If you are deploying into a Java EE 5 (or better) container, you may simply create a bean that is annotated with:-
a) javax.jws.WebService
b) javax.jws.WebServiceProvider
c) all of the mentioned
d) none of the mentioned
View Answer
Explanation: If you are deploying into a Java EE 5 (or better) container, you may simply create a bean that is annotated with javax.jws.WebService or javax.jws.WebServiceProvider and deploy that into a container in your web application.
10. If you are using the JAX-RS Reference Implementation, this intermediary step will involve a tool called wsgen.
a) True
b) False
View Answer
Explanation: It will generate the configuration (a file called sun-jaxws.xml) and wrapper beans required to expose your service.
11. Spring provides a factory that can export beans annotated with:-
a) javax.jws.WebService
b) javax.jws.WebServiceProvider
c) all of the mentioned
d) none of the mentioned
View Answer
Explanation: Spring provides a factory that can export beans annotated with javax.jws.WebService or javax.jws.WebServiceProvider inside the Spring context and then publishes the services using the JAX-WS runtime.
12. Exposing a stand-alone SOAP endpoint using the:-
a) SimpleJaxWsServiceExporter
b) JAX-WS
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: Exposing a stand-alone SOAP endpoint using the SimpleJaxWsServiceExporter or the support for JAX-WS in a Java EE container in conjunction with Spring is simple, but these solutions ignore the largest cross-section of developers—people developing on Tomcat.
13. Tomcat doesn’t support JAX-WS by itself.
a) True
b) False
View Answer
Explanation: Tomcat doesn’t support JAX-WS by itself, so we need to help it by embedding a JAX-WS runtime. There are many choices, and you’re free to take your pick. Two popular choices are Axis2 and CXF, both of which are Apache projects.
14. CXF represents the consolidation of the Celtix and XFire projects, which each had useful SOAP support.
a) True
b) False
View Answer
Explanation: For our example, we’ll embed CXF since it’s robust, fairly well tested, and provides support for other important standards like JAX-RS, the API for REST-ful endpoints.
15. Factory to use our Spring bean as the implementation:-
a) jaxws:end
b) jaxws:endpoint
c) all of the mentioned
d) none of the mentioned
View Answer
Explanation: We tell the jaxws:endpoint factory to use our Spring bean as the implementation. We tell it at what address to publish the service using the address element.
Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Spring Books
- Practice Programming MCQs
- Check Information Technology Books
- Apply for Programming Internship