Java Spring online test 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
Answer: a
Clarification: 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
Answer: c
Clarification: 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
Answer: a
Clarification: JAXB 1.0 org.springframework.oxm.jaxb.Jaxb1Marshaller.
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
Answer: b
Clarification: 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
Answer: c
Clarification: Castor org.springframework.oxm.castor.CastorMarshaller.
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
Answer: d
Clarification: 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
Answer: d
Clarification: JiBX org.springframework.oxm.jibx.JibxMarshaller.
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
Answer: c
Clarification: 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
Answer: d
Clarification: Spring-WS supports various XML marshalling APIs, including JAXB 1.0, JAXB 2.0, Castor, XMLBeans, JiBX, and XStream.
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
Answer: a
Clarification: 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
Answer: c
Clarification: 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
Answer: a
Clarification: 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
Answer: a
Clarification: 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
Answer: a
Clarification: 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
Answer: a
Clarification: As an example, we will create a client using Castor as the marshaller so that you can reuse the object models.
