Fixes to SOAP clients
authorScott Cantor <cantor.2@osu.edu>
Mon, 12 Feb 2007 05:32:18 +0000 (05:32 +0000)
committerScott Cantor <cantor.2@osu.edu>
Mon, 12 Feb 2007 05:32:18 +0000 (05:32 +0000)
saml/binding/SOAPClient.h
saml/binding/impl/SOAPClient.cpp
saml/saml.vcproj
saml/saml1/binding/SAML1SOAPClient.h
saml/saml2/binding/SAML2SOAPClient.h
samltest/samltest.vcproj

index 1c40cdc..2c94bd3 100644 (file)
@@ -31,17 +31,21 @@ namespace opensaml {
     /**
      * Specialized SOAPClient for SAML SOAP bindings.
      */
-    class SAML_API SOAPClient : soap11::SOAPClient
+    class SAML_API SOAPClient : public soap11::SOAPClient
     {
     public:
         /**
          * Creates a SOAP client instance with a particular SecurityPolicy.
          * 
-         * @param policy    reference to SecurityPolicy to apply
+         * @param policy        reference to SecurityPolicy to apply
+         * @param validating    controls schema validation
          */
-        SOAPClient(SecurityPolicy& policy) : m_policy(policy), m_force(true) {}
+        SOAPClient(SecurityPolicy& policy, bool validating=false)
+            : soap11::SOAPClient(validating), m_policy(policy), m_force(true), m_correlate(NULL) {}
         
-        virtual ~SOAPClient() {}
+        virtual ~SOAPClient() {
+            XMLString::release(&m_correlate);
+        }
 
         /**
          * Controls whether to force transport/peer authentication via an X509TrustEngine.
@@ -70,6 +74,8 @@ namespace opensaml {
          * @return response envelope after SecurityPolicy has been applied
          */
         soap11::Envelope* receive();
+        
+        void reset();
 
     protected:
         /**
@@ -86,6 +92,9 @@ namespace opensaml {
         /** Flag controlling whether transport/peer authn is mandatory. */
         bool m_force;
     
+        /** Message correlation ID. */
+        XMLCh* m_correlate;
+        
     private:
         const saml2md::RoleDescriptor* m_peer;
     };
index 0653036..2a6261e 100644 (file)
@@ -40,8 +40,7 @@ using namespace std;
 void SOAPClient::send(const soap11::Envelope* env, const KeyInfoSource& peer, const char* endpoint)
 {
     // Clear policy.
-    m_policy.setIssuer(NULL);
-    m_policy.setIssuerMetadata(NULL);
+    m_policy.reset();
     
     m_peer = dynamic_cast<const RoleDescriptor*>(&peer);
     
@@ -85,3 +84,11 @@ soap11::Envelope* SOAPClient::receive()
     }
     return env.release();
 }
+
+void SOAPClient::reset()
+{
+    soap11::SOAPClient::reset();
+    m_policy.reset();
+    XMLString::release(&m_correlate);
+    m_correlate=NULL;
+}
index 5e8a06f..b1c0647 100644 (file)
@@ -45,7 +45,6 @@
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="3"\r
-                               UsePrecompiledHeader="0"\r
                                BrowseInformation="1"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="true"\r
                                AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(ProjectDir)&quot;;&quot;..\..\cpp-xmltooling&quot;"\r
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"\r
                                RuntimeLibrary="2"\r
-                               UsePrecompiledHeader="0"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="true"\r
                                DebugInformationFormat="3"\r
index 9476220..783c7c2 100644 (file)
@@ -35,19 +35,18 @@ namespace opensaml {
         /**
          * Specialized SOAPClient for SAML 1.x SOAP binding.
          */
-        class SAML_API SAML1SOAPClient : opensaml::SOAPClient
+        class SAML_API SAML1SOAPClient : public opensaml::SOAPClient
         {
         public:
             /**
              * Creates a SOAP client instance with a particular SecurityPolicy.
              * 
-             * @param policy    reference to SecurityPolicy to apply
+             * @param policy        reference to SecurityPolicy to apply
+             * @param validating    controls schema validation
              */
-            SAML1SOAPClient(SecurityPolicy& policy) : opensaml::SOAPClient(policy), m_correlate(NULL) {}
+            SAML1SOAPClient(SecurityPolicy& policy, bool validating=false) : opensaml::SOAPClient(policy, validating) {}
             
-            virtual ~SAML1SOAPClient() {
-                XMLString::release(&m_correlate);
-            }
+            virtual ~SAML1SOAPClient() {}
     
             /**
              * Specialized method for sending SAML 1.x requests. The SOAP layer will be
@@ -79,9 +78,6 @@ namespace opensaml {
              * @return true iff the error should be treated as a fatal error
              */
             virtual bool handleError(const Status& status);
-        
-        private:
-            XMLCh* m_correlate;
         };
         
     };
index ff5e5a1..23b65a8 100644 (file)
@@ -41,13 +41,12 @@ namespace opensaml {
             /**
              * Creates a SOAP client instance with a particular SecurityPolicy.
              * 
-             * @param policy    reference to SecurityPolicy to apply
+             * @param policy        reference to SecurityPolicy to apply
+             * @param validating    controls schema validation
              */
-            SAML2SOAPClient(SecurityPolicy& policy) : opensaml::SOAPClient(policy), m_correlate(NULL) {}
+            SAML2SOAPClient(SecurityPolicy& policy, bool validating=false) : opensaml::SOAPClient(policy, validating) {}
             
-            virtual ~SAML2SOAPClient() {
-                XMLString::release(&m_correlate);
-            }
+            virtual ~SAML2SOAPClient() {}
     
             /**
              * Specialized method for sending SAML 2.0 requests. The SOAP layer will be
@@ -79,9 +78,6 @@ namespace opensaml {
              * @return true iff the error should be treated as a fatal error
              */
             virtual bool handleError(const Status& status);
-        
-        private:
-            XMLCh* m_correlate;
         };
         
     };
index f044fd7..4f580e7 100644 (file)
@@ -45,7 +45,6 @@
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                                RuntimeLibrary="3"\r
-                               UsePrecompiledHeader="0"\r
                                BrowseInformation="1"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="true"\r
                                AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(ProjectDir)&quot;;&quot;..\..\cpp-xmltooling&quot;"\r
                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE=1"\r
                                RuntimeLibrary="2"\r
-                               UsePrecompiledHeader="0"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="true"\r
                                DebugInformationFormat="3"\r