10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

19<br />

CHAPTER 19<br />

SOAP with Attachments API for <strong>Java</strong><br />

SOAP with Attachments API for <strong>Java</strong> (SAAJ) is used mainly for the SOAP messaging that goes<br />

on behind the scenes in JAX-WS handlers and JAXR implementations. Secondarily, it is an API<br />

that developers can use when they choose to write SOAP messaging applications directly rather<br />

than use JAX-WS. <strong>The</strong> SAAJ API allows you to do XML messaging from the <strong>Java</strong> platform: By<br />

simply making method calls using the SAAJ API, you can read and write SOAP-based XML<br />

messages, and you can optionally send and receive such messages over the Internet (some<br />

implementations may not support sending and receiving). This chapter will help you learn how<br />

to use the SAAJ API.<br />

<strong>The</strong> SAAJ API conforms to the Simple Object Access Protocol (SOAP) 1.1 and 1.2 specifications<br />

and the SOAP with Attachments specification. <strong>The</strong> SAAJ 1.3 specification defines the<br />

javax.xml.soap package, which contains the API for creating and populating a SOAP message.<br />

This package has all the API necessary for sending request-response messages.<br />

(Request-response messages are explained in “SOAPConnection Objects” on page 587.)<br />

Note – <strong>The</strong> javax.xml.messaging package, defined in the <strong>Java</strong> API for XML Messaging (JAXM)<br />

1.1 specification, is not part of the <strong>Java</strong> <strong>EE</strong> platform and is not discussed in this chapter. <strong>The</strong><br />

JAXM API is available as a separate download from http://java.sun.com/webservices/<br />

index.jsp.<br />

This chapter starts with an overview of messages and connections, giving some of the<br />

conceptual background behind the SAAJ API to help you understand why certain things are<br />

done the way they are. Next, the tutorial shows you how to use the basic SAAJ API, giving<br />

examples and explanations of the commonly used features. <strong>The</strong> code examples in the last part of<br />

the tutorial show you how to build an application. <strong>The</strong> case study in Chapter 36, “<strong>The</strong> Coffee<br />

Break Application,” includes SAAJ code for both sending and consuming a SOAP message.<br />

583

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!