You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by Massimiliano Masi <ma...@gmail.com> on 2009/05/04 15:52:20 UTC
Localname of the securityHeader is set to null
Hi,
I don't know if it is a FAQ (in this case, sorry), but I've the
following problem.
I create a new Envelope like this:
Document envelope = docBuilder.newDocument();
DOMImplementation impl = docBuilder.getDOMImplementation();
envelope = impl.createDocument("http://www.w3.org/2003/05/soap-envelope",
"soapenv:Envelope", null);
Element envelopeElement = envelope.getDocumentElement();
WSSecHeader wsseHeader = new WSSecHeader();
wsseHeader.insertSecurityHeader(envelope);
the outcome is:
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:null="http://www.w3.org/2003/05/soap-envelope"
null:mustUnderstand="true"><wsu:Timestamp
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="Timestamp-4047165"><wsu:Created>2009-05-04T13:48:06.335Z</wsu:Created><wsu:Expires>2009-05-04T13:58:06.335Z</wsu:Expires></wsu:Timestamp></wsse:Security></soapenv:Header></soapenv:Envelope>
that is NOT correct:
xmlns:null="http://www.w3.org/2003/05/soap-envelope" null:mustUnderstand="true"
null instead of soapenv. Am I wrong?
Thank you in advance,
Massimiliano
--
Massimiliano Masi
http://www.mascanc.net/~max
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org
RE: Localname of the securityHeader is set to null
Posted by Colm O hEigeartaigh <co...@progress.com>.
Hi Massimiliano,
DOM does not explicitly add namespace declarations, you have to add them
yourself. So in your example:
envelope = impl.createDocument(namespace, "soapenv:Envelope", null);
Element envelopeElement = envelope.getDocumentElement();
envelope.setAttribute("xmlns:soapenv", namespace);
You should see the soapenv prefix declarared correctly then.
Colm.
-----Original Message-----
From: Massimiliano Masi [mailto:massimiliano.masi@gmail.com]
Sent: 04 May 2009 14:52
To: wss4j-dev@ws.apache.org
Subject: Localname of the securityHeader is set to null
Hi,
I don't know if it is a FAQ (in this case, sorry), but I've the
following problem.
I create a new Envelope like this:
Document envelope = docBuilder.newDocument();
DOMImplementation impl = docBuilder.getDOMImplementation();
envelope =
impl.createDocument("http://www.w3.org/2003/05/soap-envelope",
"soapenv:Envelope", null);
Element envelopeElement = envelope.getDocumentElement();
WSSecHeader wsseHeader = new WSSecHeader();
wsseHeader.insertSecurityHeader(envelope);
the outcome is:
<soapenv:Header>
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse
curity-secext-1.0.xsd"
xmlns:null="http://www.w3.org/2003/05/soap-envelope"
null:mustUnderstand="true"><wsu:Timestamp
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssec
urity-utility-1.0.xsd"
wsu:Id="Timestamp-4047165"><wsu:Created>2009-05-04T13:48:06.335Z</wsu:Cr
eated><wsu:Expires>2009-05-04T13:58:06.335Z</wsu:Expires></wsu:Timestamp
></wsse:Security></soapenv:Header></soapenv:Envelope>
that is NOT correct:
xmlns:null="http://www.w3.org/2003/05/soap-envelope"
null:mustUnderstand="true"
null instead of soapenv. Am I wrong?
Thank you in advance,
Massimiliano
--
Massimiliano Masi
http://www.mascanc.net/~max
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org