https://issues.shibboleth.net/jira/browse/SSPCPP-187
[shibboleth/cpp-opensaml.git] / saml / saml2 / binding / impl / SAML2SOAPEncoder.cpp
index 64acb64..a4aa894 100644 (file)
@@ -97,6 +97,7 @@ long SAML2SOAPEncoder::encode(
     genericResponse.setContentType("text/xml");
     HTTPResponse* httpResponse = dynamic_cast<HTTPResponse*>(&genericResponse);
     if (httpResponse) {
+        httpResponse->setResponseHeader("Expires", "01-Jan-1997 12:00:00 GMT");
         httpResponse->setResponseHeader("Cache-Control", "no-cache, no-store, must-revalidate, private");
         httpResponse->setResponseHeader("Pragma", "no-cache");
     }
@@ -152,9 +153,12 @@ long SAML2SOAPEncoder::encode(
                 rootElement = env->marshall();
             }
 
-            string xmlbuf;
-            XMLHelper::serialize(rootElement, xmlbuf);
-            istringstream s(xmlbuf);
+            stringstream s;
+            s << *rootElement;
+            
+            if (log.isDebugEnabled())
+                log.debug("marshalled envelope:\n%s", s.str().c_str());
+
             log.debug("sending serialized envelope");
             bool error = (!msg && env->getBody() && env->getBody()->hasChildren() &&
                 dynamic_cast<Fault*>(env->getBody()->getUnknownXMLObjects().front()));
@@ -187,10 +191,13 @@ long SAML2SOAPEncoder::encode(
             body->getUnknownXMLObjects().push_back(fault);
             rootElement = env->marshall();
     
-            string xmlbuf;
-            XMLHelper::serialize(rootElement, xmlbuf);
-            istringstream s(xmlbuf);
-            log.debug("sending serialized fault");
+            stringstream s;
+            s << *rootElement;
+            
+            if (log.isDebugEnabled())
+                log.debug("marshalled envelope:\n%s", s.str().c_str());
+
+            log.debug("sending serialized envelope");
             long ret = genericResponse.sendError(s);
         
             // Cleanup by destroying XML.