簡體   English   中英

注冊解組員

[英]Register an unmarshaller

我正在嘗試org.opensaml.saml.saml2.core.Response的響應編組為org.opensaml.xml.XMLObject 為此,我將響應設置為字符串,然后使用文檔構建器將其解析為org.w3c.dom.Document

現在,我想將文檔的元素解組到XMLObject。 我的代碼如下所示:

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

我在解組器工廠中得到一個空指針異常,因為該元素的解組器不存在。 調試時,對於unFactory.unmarshaller,我看到的是{}。

如何注冊元素的解組器?

謝謝!

沒關系。

我當時采用了不同的方法,並認為要構建文檔和元素...等等。 這種方法背后的想法是將元素添加到消息上下文並通過Soap客戶端發送。

我最終創建了ArtifactResponse對象並將其添加到MessageContext<SAMLObject>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM