The MoviesOrderService Class: The onMessage Method

The onMessage method shown below is used to handle the incoming messages for movies orders. The method receives the SOAP message as a parameter. By making a call to retrieve the SOAP part of the message and to retrieve the content of the message, we are able to retrieve an XML document that represents the message. Embedded within this XML document (as a subtree) is the XML document which represents our movies order.

Four lines of Java code are then used to convert the source object, an object that implements javax.xml.transform.Source, into a string representation of the XML document. This is done by creating a ByteArrayInputStream and wrapping it with a StreamResult (javax.transform.stream.StreamResult ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software 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.