Switch to reference for SOAP request envelope, delete SAML requests regardless of...
authorScott Cantor <cantor.2@osu.edu>
Tue, 13 Feb 2007 19:30:22 +0000 (19:30 +0000)
committerScott Cantor <cantor.2@osu.edu>
Tue, 13 Feb 2007 19:30:22 +0000 (19:30 +0000)
saml/binding/SOAPClient.h
saml/binding/impl/SOAPClient.cpp
saml/saml1/binding/SAML1SOAPClient.h
saml/saml1/binding/impl/SAML1SOAPClient.cpp
saml/saml2/binding/SAML2SOAPClient.h
saml/saml2/binding/impl/SAML2SOAPClient.cpp

index 2c94bd3..2c745cc 100644 (file)
@@ -66,7 +66,7 @@ namespace opensaml {
          * @param peer      peer to send message to, expressed in TrustEngine terms
          * @param endpoint  URL of endpoint to recieve message
          */
-        void send(const soap11::Envelope* env, const xmltooling::KeyInfoSource& peer, const char* endpoint);
+        void send(const soap11::Envelope& env, const xmltooling::KeyInfoSource& peer, const char* endpoint);
         
         /**
          * Override applies SecurityPolicy to envelope before returning it.
index 2a6261e..be471ee 100644 (file)
@@ -37,7 +37,7 @@ using namespace opensaml;
 using namespace xmltooling;
 using namespace std;
 
-void SOAPClient::send(const soap11::Envelope* env, const KeyInfoSource& peer, const char* endpoint)
+void SOAPClient::send(const soap11::Envelope& env, const KeyInfoSource& peer, const char* endpoint)
 {
     // Clear policy.
     m_policy.reset();
index 783c7c2..d3e6ab9 100644 (file)
@@ -52,7 +52,7 @@ namespace opensaml {
              * Specialized method for sending SAML 1.x requests. The SOAP layer will be
              * constructed automatically.
              * 
-             * <p>The request will be freed by the client object if the method succeeds.
+             * <p>The request will be freed by the client object regardless of the outcome.
              * 
              * @param request   SAML request to send
              * @param peer      peer to send message to, expressed in metadata terms
index 69bbf00..3760a17 100644 (file)
@@ -39,22 +39,12 @@ using namespace std;
 
 void SAML1SOAPClient::sendSAML(Request* request, const RoleDescriptor& peer, const char* endpoint)
 {
-    Envelope* env = EnvelopeBuilder::buildEnvelope();
+    auto_ptr<Envelope> env(EnvelopeBuilder::buildEnvelope());
     Body* body = BodyBuilder::buildBody();
     env->setBody(body);
     body->getUnknownXMLObjects().push_back(request);
-    try {
-        send(env, peer, endpoint);
-        m_correlate = XMLString::replicate(request->getRequestID());
-        delete env;
-    }
-    catch (XMLToolingException&) {
-        // A bit weird...we have to "revert" things so that the request is isolated
-        // so the caller can free it.
-        request->getParent()->detach();
-        request->detach();
-        throw;
-    }
+    send(*env.get(), peer, endpoint);
+    m_correlate = XMLString::replicate(request->getRequestID());
 }
 
 Response* SAML1SOAPClient::receiveSAML()
index 842150a..a890f94 100644 (file)
@@ -52,7 +52,7 @@ namespace opensaml {
              * Specialized method for sending SAML 2.0 requests. The SOAP layer will be
              * constructed automatically.
              * 
-             * <p>The request will be freed by the client object if the method succeeds.
+             * <p>The request will be freed by the client object regardless of the outcome.
              * 
              * @param request   SAML request to send
              * @param peer      peer to send message to, expressed in metadata terms
index 673f5fc..084edbb 100644 (file)
@@ -39,22 +39,12 @@ using namespace std;
 
 void SAML2SOAPClient::sendSAML(RequestAbstractType* request, const RoleDescriptor& peer, const char* endpoint)
 {
-    Envelope* env = EnvelopeBuilder::buildEnvelope();
+    auto_ptr<Envelope> env(EnvelopeBuilder::buildEnvelope());
     Body* body = BodyBuilder::buildBody();
     env->setBody(body);
     body->getUnknownXMLObjects().push_back(request);
-    try {
-        send(env, peer, endpoint);
-        m_correlate = XMLString::replicate(request->getID());
-        delete env;
-    }
-    catch (XMLToolingException&) {
-        // A bit weird...we have to "revert" things so that the request is isolated
-        // so the caller can free it.
-        request->getParent()->detach();
-        request->detach();
-        throw;
-    }
+    send(*env.get(), peer, endpoint);
+    m_correlate = XMLString::replicate(request->getID());
 }
 
 StatusResponseType* SAML2SOAPClient::receiveSAML()