May 2004
Beginner to intermediate
1032 pages
23h 48m
English
So far you have looked at simple message exchange. This section examines other issues when exchanging SOAP messages.
As well as XML information in the SOAP body, SAAJ allows you to add and retrieve header information and attachments.
The SOAPHeader can be obtained from the SOAPEnvelope with the getHeader method. If you are creating a message, you can populate the header using the addHeaderElement method that returns a SOAPHeaderElement. You can then add text or attributes to this header element, as shown in the following:
Name txName = envelope.createName("TransactionId", "acme", "http://acme.com/transactions"); SOAPHeaderElement headerElement = header.addHeaderElement(txName); headerElement.addTextNode("78d2892ea8af625323c7"); ...Read now
Unlock full access