简体   繁体   English

注册解组员

[英]Register an unmarshaller

I'm trying to unmarshall a response to org.opensaml.saml.saml2.core.Response to an org.opensaml.xml.XMLObject . 我正在尝试org.opensaml.saml.saml2.core.Response的响应编组为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 . 为此,我将响应设置为字符串,然后使用文档构建器将其解析为org.w3c.dom.Document

Now, I'd like to unmarshall the document's element to an XMLObject. 现在,我想将文档的元素解组到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 {}. 调试时,对于unFactory.unmarshaller,我看到的是{}。

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. 这种方法背后的想法是将元素添加到消息上下文并通过Soap客户端发送。

I ended up creating an ArtifactResponse object and added it to a MessageContext<SAMLObject> 我最终创建了ArtifactResponse对象并将其添加到MessageContext<SAMLObject>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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