简体   繁体   中英

Register an unmarshaller

I'm trying to unmarshall a response to org.opensaml.saml.saml2.core.Response to an org.opensaml.xml.XMLObject . To do so, I set the response to string, then using a document builder, I parsed it to org.w3c.dom.Document .

Now, I'd like to unmarshall the document's element to an XMLObject. My code looks something like this:

Element element = document.getDocumentElement();
UnmarshallerFactory unFactory = Configuration.getUnmarshallerFactory();
XMLObject xmlObject = unFactory.getUnmarshaller(element).unmarshall(element);

I'm getting a null pointer exception in the unmarshaller factory because the unmarshaller for the element doesn't exist. When I debug, for unFactory.unmarshaller, i see as {}.

How can I register an unmarshaller for element?

Thanks!

Nevermind.

I was going down a different approach and thought to build a document and element...etc. The idea behind this approach was to add the element to a message context and send via a soap client.

I ended up creating an ArtifactResponse object and added it to a MessageContext<SAMLObject>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM