Add cache handling to SOAP transport layer.
[shibboleth/xmltooling.git] / xmltooling / soap / SOAPTransport.h
index ec6ed9c..cf5cb41 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 Internet2
+ *  Copyright 2001-2009 Internet2
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,6 +24,8 @@
 #define __xmltooling_soaptrans_h__
 
 #include <xmltooling/base.h>
+
+#include <string>
 #include <iostream>
 
 namespace xmltooling {
@@ -43,9 +45,9 @@ namespace xmltooling {
     {
         MAKE_NONCOPYABLE(SOAPTransport);
     protected:
-        SOAPTransport() {}
+        SOAPTransport();
     public:
-        virtual ~SOAPTransport() {}
+        virtual ~SOAPTransport();
 
         /**
          * A simple structure to capture SOAP addressing information.
@@ -156,6 +158,15 @@ namespace xmltooling {
 #endif
 
         /**
+         * Installs (or clears) a pointer to an object used for cache management of the
+         * content being accessed. The lifetime of the object must be longer than the lifetime
+         * of this object.
+         *
+         * @param cacheTag  optional pointer to string used for cache management
+         */
+        virtual bool setCacheTag(std::string* cacheTag=NULL);
+
+        /**
          * Sets an implementation-specific transport provider option.
          *
          * <p>Requires knowledge of the underlying SOAPTransport implementation.
@@ -166,9 +177,7 @@ namespace xmltooling {
          * @param value     implementation- and option-specific string to use
          * @return  true iff the transport supports the option and value supplied
          */
-        virtual bool setProviderOption(const char* provider, const char* option, const char* value) {
-            return false;
-        }
+        virtual bool setProviderOption(const char* provider, const char* option, const char* value);
 
         /**
          * Sends a stream of data over the transport. The function may return without
@@ -182,6 +191,17 @@ namespace xmltooling {
         virtual void send(std::istream& in)=0;
 
         /**
+         * Sends an optional stream of data over the transport. The function may return without
+         * having received any data, depending on the nature of the transport.
+         *
+         * <p>If the parameter is omitted, a request may be issued with no body if the transport
+         * supports that feature.
+         *
+         * @param in    input stream to send
+         */
+        virtual void send(std::istream* in=NULL);
+
+        /**
          * Returns reference to response stream.  The resulting stream must be
          * checked directly to determine whether data is available.
          *
@@ -202,6 +222,13 @@ namespace xmltooling {
          * @return  MIME type of response, or an empty string
          */
         virtual std::string getContentType() const=0;
+
+        /**
+         * Returns the status code of the response.
+         *
+         * @return  transport status code, or 0 if unknown
+         */
+        virtual long getStatusCode() const;
     };
 
 #ifndef XMLTOOLING_NO_XMLSEC