background image

Running SOAPFaultTest

<< Running Attachments | SOAPFaultTest to generate a SOAP >>
<< Running Attachments | SOAPFaultTest to generate a SOAP >>
168
SOAP
WITH
A
TTACHMENTS
API
FOR
J
AVA
When you run Attachments using this command line, you will see output like the
following:
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
Attachment attached_image has content type image/jpeg
SOAPFaultTest.java
The example
SOAPFaultTest.java
, based on the code fragments in the sections
Creating and Populating a SOAPFault Object (page 147) and Retrieving Fault
Information (page 149),
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:
<INSTALL>/javaeetutorial5/examples/saaj/fault/src/
Running SOAPFaultTest
To run SOAPFaultTest, you use the file
build.xml
that is in the directory
<INSTALL>/javaeetutorial5/examples/saaj/fault/
.
Like HeaderExample, this example contains code that allows you to generate
either a SOAP 1.1 or a SOAP 1.2 message.
To run SOAPFaultTest, use one of the following commands:
asant run -Dsoap=1.1
asant run -Dsoap=1.2
When you run SOAPFaultTest to generate a SOAP 1.1 message, you will see
output like the following (line breaks have been inserted in the message for read-
ability):
Here is what the XML message looks like:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">