Signing multiple objects?
Brad Cox
bradjcox at gmail.com
Tue Nov 1 23:31:45 GMT 2011
OK I tried to follow but feel dumber than ever.
The whole point of the library is that you don't (usually) work with DOM
Elements, etc. You work with
XMLObject provider instances.
and
So you build an Envelope XMLObject, then build a Header XMLObject and add
it to the Envelope
I lose the bubble right there. I'm trying to add SAML headers to a DOM
document whose body already exists and whose header is initially empty. But
everything I try discards the existing DOM.
I tried following those instructions literally like this:
Element soapEnvelope = document.getDocumentElement();
Element soapHeader = DOMUtil.getSoapHeader(soapEnvelope);
Element soapBody = DOMUtil.getSoapBody(soapEnvelope);
Envelope envelope = (Envelope) Configuration.getBuilderFactory()
.getBuilder(Envelope.DEFAULT_ELEMENT_NAME)
.buildObject(soapEnvelope);
Header header1 = envelope.getHeader(); // null
Body body = envelope.getBody(); // null
but header1 and body are null.
Header header = (Header) Configuration.getBuilderFactory()
.getBuilder(Header.DEFAULT_ELEMENT_NAME)
.buildObject(soapHeader);
This one is at least != null but header has no methods for adding children,
such as the security element shown below.
Tried getOrderedChildren(), but that's not modifiable. The commented-out
text is what I was trying before.
List<XMLObject> hdrChildren = header.getOrderedChildren(); // can't use
this; unmodifiable list
Security security = newSecurity();
hdrChildren.add(security);
// security.setParent(soapHeader);
// SecurityMarshaller secM = new SecurityMarshaller();
// Element securityElmt = secM.marshall(security, document);
// soapHeader.appendChild(securityElmt);
I'm sure its something very simple (software problems always are) but I'm
just not getting past first base with this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20111101/42472c02/attachment-0001.html
More information about the dev
mailing list