Java Reference
In-Depth Information
<category>LITERATURE</category>
</ns2:book>
</S:Body>
</S:Envelope>
The results of running the program are:
Invoking...
TITLE=King Lear
After specifying Source as your parameter to Dispatch<T> , you have to transform the results
into something usable within the application. You parse the result into a DOM tree and then
use XPath to extract the title of the topic you got back in response.
In general, you probably won't need to use such a low-level API and can instead rely on gen-
erated artifacts from a tool such as wsimport to do this work for you. Either way you'll get
good flexibility. Notice that using SAAJ requires a lot of knowledge about the structure of the
XML you are sending and receiving. You do not have to go through a stub generation step
when using SAAJ. But you still need to know the WSDL location and the service name and
ports, and you need to understand how to use the returned XML. It is fair to argue, however,
that if you were working with JAXB to give you a Java view, you'll have the same entity
structure regardless of the implementation semantics, and if you don't know that a book has a
title, you're out of luck either way.
You may already have your data in an XML format, however, in which case using SAAJ is a
terrific fit.
Search WWH ::




Custom Search