Register an unmarshaller

564 Views Asked by At

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!

1

There are 1 best solutions below

1
On BEST ANSWER

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>