+
+string ArtifactMap::getRelyingParty(const SAMLArtifact* artifact)
+{
+ if (!m_storage)
+ return m_mappings->getRelyingParty(artifact);
+
+ string xmlbuf;
+ if (!m_storage->readText(m_context.c_str(), SAMLArtifact::toHex(artifact->getMessageHandle()).c_str(), &xmlbuf))
+ throw BindingException("Artifact not found in mapping database.");
+
+ // Parse the data back into XML.
+ istringstream is(xmlbuf);
+ DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(is);
+ XercesJanitor<DOMDocument> janitor(doc);
+
+ // Check the root element.
+ DOMElement* messageRoot = doc->getDocumentElement();
+ if (XMLHelper::isNodeNamed(messageRoot, NULL, Mapping)) {
+ auto_ptr_char temp(messageRoot->getAttributeNS(NULL,_relyingParty));
+ return temp.get();
+ }
+ return string();
+}