rwsf::TransportImprwsf::MessageHandlerImp rwsf::BodyBase
clone() doConnect() doDisconnect() doInit() |
doInvoke() doSetProperty() getProperty() initParams_ |
invoke() isConnected() log() SetInitParams() |
setProperty() TransportImp() ~TransportImp() |
#include <rw/rwsf/soapworx/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.
#define rwsf_DEFINE_MESSAGE_HANDLER(NAME)
See Part II, "Global Reference." (For backward compatibility, rwsf_DEFINE_rwsf_TRANSPORT(NAME) is also defined.)
Note: This handler macro must be defined if you are creating a customized transport.
TransportImp();
Default constructor. Constructs an empty transport.
virtual ~TransportImp();
Destructor.
virtual 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.
rwsf::CString getProperty(const rwsf::CString& key) const;
Given a key, returns the value of an initialization parameter on this transport.
void invoke(rwsf::CallInfo& callInfo);
Creates a guard from the mutex for multithread safety; then calls the virtual doInvoke() method.
void log(const rwsf::CString& 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 rwsf::CString& key, const rwsf::CString& value);
Creates a guard from the mutex; then sets an initialization parameter on this transport.
virtual TransportImp* clone() const = 0;
Pure virtual function. Derived classes should return a new instance of self. (for example, new rwsf::HttpTransport(*this);).
virtual void doConnect() = 0;
Pure virtual function. In derived classes, verifies that there is a connection and connects if not.
virtual void doDisconnect() = 0;
Pure virtual function. In derived classes, disconnects from the server.
virtual void doInvoke(rwsf::CallInfo& callInfo) = 0;
Pure virtual function. In derived classes, implements the transport handler.
virtual void doSetProperty(const rwsf::CString& key, const rwsf::CString& value);
Virtual function. Used in derived transports to customize handling of property values. It is called by the transport's setProperty() method.
virtual bool isConnected() const = 0;
Pure virtual function. In derived classes, returns true if connected; otherwise, false.
rwsf::Config initParams_;
©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.