background image

SOAP Fault Example

<< Running Attachments Example | Running the SOAP Fault Example >>
<< Running Attachments Example | Running the SOAP Fault Example >>

SOAP Fault Example

Running Attachments.
Attachment attached_text has content type text/plain
Attachment contains:
Update address for Sunny Skies, Inc., to
10 Upbeat Street
Pleasant Grove, CA 95439
USA
Attachment attached_image has content type image/jpeg
SOAP Fault Example
The example SOAPFaultTest.java, based on the code fragments in the sections
"Creating and
Populating a SOAPFault Object" on page 610
and
"Retrieving Fault Information" on page 611
,
creates a message that has a SOAPFault object. It then retrieves the contents of the SOAPFault
object and prints them. You will find the code for SOAPFaultTest in the following directory:
tut-install/javaeetutorial5/examples/saaj/fault/src/
Like HeaderExample, the SOAPFaultTest class contains code that allows you to generate either a
SOAP 1.1 or a SOAP 1.2 message.
Building and Running the SOAP Fault Example
To build the program using NetBeans IDE, follow these steps:
1. In NetBeans IDE, choose Open Project from the File menu.
2. In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/saaj/.
3. Select the fault folder.
4. Select the Open as Main Project check box.
5. Click Open Project Folder.
A Reference Problems dialog appears. Click Close.
6. Right-click the fault project and choose Resolve Reference Problems.
7. In the Resolve Reference Problems dialog, select the first of the missing JAR files and click
Resolve.
The missing files are activation.jar, javaee.jar, and appserv-ws.jar.
8. Navigate to the as-install/lib/ directory.
9. Select the missing JAR file (activation.jar, for example) and click Open.
In the Resolve Reference Problems dialog, all the files have green check marks to the left of
their names.
10. Click Close.
Code Examples
The Java EE 5 Tutorial · September 2007
624