axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kent Tong <k...@cpttm.org.mo>
Subject Peculiar behavior of addHeader
Date Sun, 05 Dec 2004 11:18:04 GMT
Hi,

I'm studying the security example in Axis 1.1, in particular the
SignedSOAPEnvelope class. To sign a message, it needs to add
a header:

	SOAPEnvelope env;
	...
	SOAPHeaderElement header =
		new SOAPHeaderElement(
		XMLUtils.StringToElement(SOAPSECNS, "Signature", ""));
	env.addHeader(header);

If I change it to:

	SOAPEnvelope env;
	...
	SOAPHeaderElement header =
		new SOAPHeaderElement(SOAPSECNS, "Signature");
	env.addHeader(header);

It also runs, but the signature element generated as an extra
"mustUnderstand" attribute:

<soapenv:Envelope
	soapenv:actor="some-uri" soapenv:mustUnderstand="1" ...>
	<soapenv:Header>
		<SOAP-SEC:Signature soapenv:mustUnderstand="0">
		...

But this doesn't happen if XMLUtils.StringToElement is used:

<soapenv:Envelope
	soapenv:actor="some-uri" soapenv:mustUnderstand="1" ...>
	<soapenv:Header>
		<SOAP-SEC:Signature>
		...

Why is that so?

Thanks in advance!

Mime
View raw message