Spring Questions and Answers – Web Services with XML Marshalling and service endpoints

This set of Java Spring online test focuses on “Web Services with XML Marshalling and service endpoints”.

1. Spring-WS supports using XML marshalling technology to marshal and unmarshal objects to and from XML documents.
a) True
b) False
View Answer

Answer: a
Explanation: This technology is also known as object/XML mapping (OXM) because you are actually mapping objects to and from XML documents.

2. To implement endpoints with an XML marshalling technology, you have to extend the:-
a) AbstractMarshallingPayload
b) AbstractMarshalling
c) AbstractMarshallingPayloadEndpoint
d) None of the mentioned
View Answer

Answer: c
Explanation: To implement endpoints with an XML marshalling technology, you have to extend the AbstractMarshallingPayloadEndpoint class and configure an XML marshaller for it.

3. Marshaller for JAXB 1.0:-
a) org.springframework.oxm.jaxb.Jaxb1Marshaller
b) org.springframework.oxm.jaxb.Jaxb2Marshaller
c) org.springframework.oxm.castor.CastorMarshall
d) org.springframework.oxm.xmlbeans.XmlBeansMarshaller
View Answer

Answer: a
Explanation: JAXB 1.0 org.springframework.oxm.jaxb.Jaxb1Marshaller.
advertisement
advertisement

4. Marshaller for JAXB 2.0:-
a) org.springframework.oxm.jaxb.Jaxb1Marshaller
b) org.springframework.oxm.jaxb.Jaxb2Marshaller
c) org.springframework.oxm.castor.CastorMarshall
d) org.springframework.oxm.xmlbeans.XmlBeansMarshaller
View Answer

Answer: b
Explanation: JAXB 2.0 org.springframework.oxm.jaxb.Jaxb2Marshaller.

5. Marshaller for Castor:-
a) org.springframework.oxm.jaxb.Jaxb1Marshaller
b) org.springframework.oxm.jaxb.Jaxb2Marshaller
c) org.springframework.oxm.castor.CastorMarshall
d) org.springframework.oxm.xmlbeans.XmlBeansMarshaller
View Answer

Answer: c
Explanation: Castor org.springframework.oxm.castor.CastorMarshaller.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Marshaller for XMLBeans:-
a) org.springframework.oxm.jaxb.Jaxb1Marshaller
b) org.springframework.oxm.jaxb.Jaxb2Marshaller
c) org.springframework.oxm.castor.CastorMarshall
d) org.springframework.oxm.xmlbeans.XmlBeansMarshaller
View Answer

Answer: d
Explanation: XMLBeans org.springframework.oxm.xmlbeans.XmlBeansMarshaller.

7. Marshaller for JiBX:-
a) org.springframework.oxm.jaxb.Jaxb1Marshaller
b) org.springframework.oxm.jaxb.Jaxb2Marshaller
c) org.springframework.oxm.castor.CastorMarshall
d) org.springframework.oxm.jibx.JibxMarshaller
View Answer

Answer: d
Explanation: JiBX org.springframework.oxm.jibx.JibxMarshaller.
advertisement

8. Marshaller for XStream:-
a) org.springframework.oxm.jaxb.Jaxb1Marshaller
b) org.springframework.oxm.jaxb.Jaxb2Marshaller
c) org.springframework.oxm.xstream.XStreamMarshaller
d) org.springframework.oxm.jibx.JibxMarshaller
View Answer

Answer: c
Explanation: XStream org.springframework.oxm.xstream.XStreamMarshaller.

9. Spring-WS supports various XML marshalling APIs.
a) Castor
b) JAXB 1.0
c) XMLBeans
d) All of the mentioned
View Answer

Answer: d
Explanation: Spring-WS supports various XML marshalling APIs, including JAXB 1.0, JAXB 2.0, Castor, XMLBeans, JiBX, and XStream.
advertisement

10. For some marshalling APIs, the object model must be generated by them so that they can insert marshalling-specific information.
a) True
b) False
View Answer

Answer: a
Explanation: Because Castor supports marshalling between XML messages and arbitrary Java objects, you can start creating the following classes by yourself.

11. A marshalling endpoint requires:-
a) marshaller
b) unmarshaller
c) all of the mentioned
d) none of the mentioned
View Answer

Answer: c
Explanation: A marshalling endpoint requires both the marshaller and unmarshaller properties to be set. Usually, you can specify a single marshaller for both properties. For Castor, you declare a CastorMarshaller bean as the marshaller.

12. Castor requires a mapping configuration file to know how to map objects to and from XML documents.
a) True
b) False
View Answer

Answer: a
Explanation: You can create this file in the classpath root and specify it in the mappingLocation property (e.g., mapping.xml).

13. Spring-WS supports annotating an arbitrary class as a service endpoint by:-
a) @Endpoint
b) @End
c) @Point
d) None of the mentioned
View Answer

Answer: a
Explanation: Spring-WS supports annotating an arbitrary class as a service endpoint by the @Endpoint annotation, without extending a framework-specific class.

14. When you are using XML marshalling, WebServiceTemplate requires both the marshaller and unmarshaller properties to be set.
a) True
b) False
View Answer

Answer: a
Explanation: You can also set them to WebServiceGatewaySupport if you extend this class to have WebServiceTemplate auto-created.

15. A Spring-WS client can also marshall and unmarshal the request and response objects to and from XML messages.
a) True
b) False
View Answer

Answer: a
Explanation: As an example, we will create a client using Castor as the marshaller so that you can reuse the object models.

Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring for online test, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.