- // Read message to use from file.
- string path = data_path + "saml1/binding/SAML1Response.xml";
- ifstream in(path.c_str());
- DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
- XercesJanitor<DOMDocument> janitor(doc);
- auto_ptr<Response> toSend(
- dynamic_cast<Response*>(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(),true))
- );
- janitor.release();
-
- // Freshen timestamp.
- toSend->setIssueInstant(time(NULL));
-
- // Encode message.
- auto_ptr_XMLCh lit1("MessageEncoder");
- auto_ptr_XMLCh lit2("template");
- path = data_path + "binding/template.html";
- auto_ptr_XMLCh lit3(path.c_str());
- DOMDocument* encoder_config = XMLToolingConfig::getConfig().getParser().newDocument();
- XercesJanitor<DOMDocument> janitor2(encoder_config);
- encoder_config->appendChild(encoder_config->createElementNS(NULL,lit1.get()));
- encoder_config->getDocumentElement()->setAttributeNS(NULL,lit2.get(),lit3.get());
- auto_ptr<MessageEncoder> encoder(
- SAMLConfig::getConfig().MessageEncoderManager.newPlugin(
- samlconstants::SAML1_PROFILE_BROWSER_POST, encoder_config->getDocumentElement()
- )
- );
- encoder->encode(*this,toSend.get(),"https://sp.example.org/SAML/POST","https://sp.example.org/","state",m_creds);
- toSend.release();
-
- // Decode message.
- string relayState;
- const RoleDescriptor* issuer=NULL;
- const XMLCh* securityMech=NULL;