Update copyright.
[shibboleth/cpp-opensaml.git] / saml / binding / impl / SOAPClient.cpp
index 45693dc..0653036 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2007 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include "internal.h"
 #include "exceptions.h"
+#include "version.h"
 #include "binding/SOAPClient.h"
 #include "saml2/metadata/Metadata.h"
 #include "saml2/metadata/MetadataProvider.h"
 
 #include <xmltooling/security/X509TrustEngine.h>
 #include <xmltooling/soap/SOAP.h>
+#include <xmltooling/soap/HTTPSOAPTransport.h>
 
 using namespace opensaml::saml2;
 using namespace opensaml::saml2md;
@@ -48,6 +50,14 @@ void SOAPClient::send(const soap11::Envelope* env, const KeyInfoSource& peer, co
 
 void SOAPClient::prepareTransport(const xmltooling::SOAPTransport& transport)
 {
+    const HTTPSOAPTransport* http = dynamic_cast<const HTTPSOAPTransport*>(&transport);
+    if (http) {
+        http->setRequestHeader("SOAPAction", "http://www.oasis-open.org/committees/security");
+        http->setRequestHeader("Xerces-C", XERCES_FULLVERSIONDOT);
+        http->setRequestHeader("XML-Security-C", XSEC_VERSION);
+        http->setRequestHeader("OpenSAML-C", OPENSAML_FULLVERSIONDOT);
+    }
+    
     const X509TrustEngine* engine = dynamic_cast<const X509TrustEngine*>(m_policy.getTrustEngine());
     if (engine) {
         const MetadataProvider* metadata = m_policy.getMetadataProvider();
@@ -68,6 +78,7 @@ soap11::Envelope* SOAPClient::receive()
                 issuer->setName(parent->getEntityID());
                 m_policy.setIssuer(issuer);
                 m_policy.setIssuerMetadata(m_peer);
+                m_policy.setSecure(true);
             }
         }
         m_policy.evaluate(*(env.get()));