Consuming the SAAJ Web Service

To use your Web Service you need a client. For the purposes of this exercise, this client will be a standard Java class with a main method. However, it could also be a J2EE component such as a JSP or EJB or a non-Java client. The client will create a SOAP message containing a given location, send the service a request for a list of jobs at that location and print out the list when it returns.

Sending a Basic SOAP Message

The SAAJ API provides a simple way to send a straightforward SOAP message. An SAAJ client will create a SOAP message using the SAAJ API and send that message to a SOAP server at a specified URL.

The first thing to do is create the SOAP message. To do this, you need an instance of the MessageFactory ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second 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.