What do you see if before you call Message#send you do

    System.println(env.toString());

Scott Nichol

----- Original Message -----
From: "Cyril Vidal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 19, 2002 6:01 AM
Subject: SOAP Apache 2.2 and header blocks.


Hi,



I have problem to set a Header into a SOAP Message with Apache SOAP 2.2

Here's the code to add a header to my message, but unfortunately, it
doesn't seem to work.

When I look at the message by example through TunnelGui, I can't see my
header.

Does Apache support the Header blocks or not?

Thanks a lot for your help,

Regards,

Cyril.



// create a vector for collecting the header elements

Vector headerElements = new Vector();

// Create a header element in a namespace

org.w3c.dom.Element headerElement =

doc.createElementNS(URI,"jaws:MessageHeader");

headerElement.setAttributeNS(URI,"SOAP-ENV:mustUnderstand","1");

// Create subnodes within the MessageHeader

org.w3c.dom.Element ele = doc.createElement("From");

org.w3c.dom.Text textNode = doc.createTextNode("Me");

org.w3c.dom.Node tempNode = ele.appendChild(textNode);

tempNode = headerElement.appendChild(ele);

ele = doc.createElement("To");

textNode = doc.createTextNode("You");

tempNode = ele.appendChild(textNode);

tempNode = headerElement.appendChild(ele);

ele = doc.createElement("MessageId");

textNode = doc.createTextNode("9999");

tempNode = ele.appendChild(textNode);

tempNode = headerElement.appendChild(ele);

headerElements.add(headerElement);

//Create the SOAP envelope

org.apache.soap.Envelope envelope = new org.apache.soap.Envelope();

//Add the SOAP header element to the envelope

org.apache.soap.Header header = new org.apache.soap.Header();

header.setHeaderEntries(headerElements);

envelope.setHeader(header);

_______________________________

Cyril Vidal
Email: [EMAIL PROTECTED]
Web: http://www.planetexml.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to