background image

Running Header Example

<< Building and Running the Header Example | DOM and DOMSource Examples >>
<< Building and Running the Header Example | DOM and DOMSource Examples >>

Running Header Example

To build and run HeaderExample using Ant, go to the directory
tut-install/javaeetutorial5/examples/saaj/headers/. Use one of the following commands:
ant run-headers -Dsoap=1.1
ant run-headers -Dsoap=1.2
When you run HeaderExample to generate a SOAP 1.1 message, you will see output similar to
the following:
----- Request Message ----
<SOAP-ENV:Envelope xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<ns:orderDesk xmlns:ns=
"http://gizmos.com/NSURI"
SOAP-ENV:actor=
"http://gizmos.com/orders"/>
<ns:shippingDesk xmlns:ns=
"http://gizmos.com/NSURI"
SOAP-ENV:actor=
"http://gizmos.com/shipping"/>
<ns:confirmationDesk xmlns:ns=
"http://gizmos.com/NSURI"
SOAP-ENV:actor=
"http://gizmos.com/confirmations" SOAP-ENV:mustUnderstand="1"/>
<ns:billingDesk xmlns:ns=
"http://gizmos.com/NSURI"
SOAP-ENV:actor=
"http://gizmos.com/billing"/>
</SOAP-ENV:Header><SOAP-ENV:Body/></SOAP-ENV:Envelope>
Header name is {http://gizmos.com/NSURI}orderDesk
Actor is http://gizmos.com/orders
mustUnderstand is false
Header name is {http://gizmos.com/NSURI}shippingDesk
Actor is http://gizmos.com/shipping
mustUnderstand is false
Header name is {http://gizmos.com/NSURI}confirmationDesk
Actor is http://gizmos.com/confirmations
mustUnderstand is true
Header name is {http://gizmos.com/NSURI}billingDesk
Actor is http://gizmos.com/billing
mustUnderstand is false
When you run HeaderExample to generate a SOAP 1.2 message, you will see output similar to
the following:
----- Request Message ----
<env:Envelope xmlns:env=
"http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<ns:orderDesk xmlns:ns=
"http://gizmos.com/NSURI"
Code Examples
The Java EE 5 Tutorial · September 2007
616