rwsf::TransportImprwsf::MessageHandlerImp
clone() doConnect() doDisconnect() doInit() |
doInvoke() doSetProperty() getProperty() invoke() |
isConnected() log() setInitParams() setProperty() |
TransportImp() ~TransportImp() |
#include rwsf/webservice/transport/TransportImp.h
rwsf::TransportImp is an abstract base class and the body of the handle represented by rwsf::Transport.
All rwsf transports derive from this class. This class may be used to create a customized transport. To create your own transport, you must derive from this class and implement at least the following four pure virtual functions.
virtual bool isConnected() const = 0; virtual void invoke(rwsf::CallInfo& callInfo) = 0; virtual void doConnect() = 0; virtual void doDisconnect() = 0;
For an example on creating a custom transport, see Section 11.6, "Creating a Transport," in the HydraExpress Web Service Development Guide.
Multithread Safety
To support multithread safety, rwsf::TransportImp provides the invoke implementation for all transports. The method invoke() creates a multithread guard and then calls doInvoke(), which is implemented in the derived classes. This design provides thread safety for all derived classes during asynchronous processing, and allows your application to share transports safely.
If you are not using asynchronous processing and want to avoid using the mutex guard, you may want to reimplement invoke() in your derived classes.
TransportImp();
Default constructor. Constructs an empty transport.
virtual ~TransportImp();
Destructor.
TransportImp * clone() const = 0;
Pure virtual function. Derived classes should return a new instance of self. (for example, newrwsf::HttpTransport(*this);).
void doConnect() = 0;
Pure virtual function. In derived classes, verifies that there is a connection and connects if not.
void doDisconnect() = 0;
Pure virtual function. In derived classes, disconnects from the server.
void doInit(const rwsf::Config & initParams);
Virtual function. In derived classes, initializes the transport. The initParams object contains initialization and startup parameters. If the transport cannot be initialized, throws a rwsf::Exception. On the client side, these are propagated out to the user's code; on the server side, they are logged.
void doInvoke(rwsf::CallInfo & callInfo) = 0;
Pure virtual function. In derived classes, implements the transport handler.
void doSetProperty(const std::string & key, const std::string & value);
Virtual function. Used in derived transports to customize handling of property values. It is called by the transport's setProperty() method.
std::string getProperty(const std::string & key) const;
Given a key, returns the value of an initialization parameter on this transport.
void invoke(rwsf::CallInfo & callInfo);
Reimplements method in rwsf::MessageHandlerImp
Base class documentation:
Virtual. Calling services that will use this handle access it through this method, which implements the main functionality of a service. To create a handler, extend this class and implement this method in the derived class.
Implementation documentation:
Creates a guard from the mutex for multithread safety; then calls the virtual doInvoke() method.
bool isConnected() const = 0;
Pure virtual function. In derived classes, returns true if connected; otherwise, false.
void log(const std::string & message, rwsf::CallInfo::LogLevel l = rwsf::CallInfo::Info);
Invokes the logger with the error message in message and log level in l. See rwsf::LoggerBase for a description of log levels.
void log(rwsf::CallInfo & callInfo, rwsf::CallInfo::LogLevel l = rwsf::CallInfo::Info);
Invokes the logger with the error message in callInfo and log level in l. See rwsf::LoggerBase for a description of log levels.
void setInitParams(const rwsf::Config & initParams);
Creates a guard from the mutex; then sets initialization parameters in this transport.
void setProperty(const std::string & key, const std::string & value);
Creates a guard from the mutex; then sets an initialization parameter on this transport.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.