... class from package javax.xml.bind. JAXB (Java Architecture for XML Binding) is a set of classes for converting POJOs to and from XML. There are many related classes in the same package that implement the serializations we perform, but the JAXB class contains easy-to-use wrappers for common operations. After creating the welcome message (lines 21–22), we create a StringWriter (line 23) to which JAXB will output the XML. Line 24 calls the JAXB class’s static method marshal to convert the String containing our message to XML format. Line 25 calls StringWriter’s toString method to retrieve the XML text to return to the client.

Testing the RESTful Web Service

Section 32.6.4 demonstrated testing a SOAP service using GlassFish’s Tester page. Glass-Fish ...

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.