background image

Running the SOAP Fault Example

<< SOAP Fault Example | Running SOAPFaultTest >>
<< SOAP Fault Example | Running SOAPFaultTest >>

Running the SOAP Fault Example

11. Right-click the project and choose Build Project.
To run the program using NetBeans IDE, follow these steps:
1. Right-click the fault project and choose Properties.
2. Select Run from the Categories tree.
3. In the Arguments field, type the following:
1.1
This argument specifies the version of SOAP to be used in generating the message.
4. Click OK.
5. Right-click the project and choose Run Project.
6. Right-click the project and choose Properties.
7. Select Run from the Categories tree.
8. In the Arguments field, type the following:
1.2
9. Click OK.
10. Right-click the project and choose Run Project.
To build and run SOAPFaultTest using Ant, go to the directory
tut-install/javaeetutorial5/examples/saaj/fault/. Use one of the following commands:
ant run-fault -Dsoap=1.1
ant run-fault -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 readability):
Here is what the XML message looks like:
<SOAP-ENV:Envelope xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/><SOAP-ENV:Body>
<SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO=
"http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO=
"http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail></SOAP-ENV:Fault>
Code Examples
Chapter 19 · SOAP with Attachments API for Java
625