#include <rw/rwsf/soapworx/transport/TransportManager.h>
The class rwsf::TransportManager manages the use of transports and listeners for a message. It is used by the generated proxy to initialize the appropriate transport or listener for that proxy.
If you customize or write your own client proxy, always use this class to locate and instantiate a transport or listener. For example, in the following code...
myProxy myp = myProxy::make("http://someurl");
...the proxy make() function gets an HTTP transport through the Transport Manager.
If you are specifying the type of transport directly instead of relying on the scheme indicated by a location url, use the method findTransport().
NOTE -- The default "transports configuration" and "client transports configuration" files are "transports.xml" and "client-transports.xml" respectively, although you may create your own or modify the name. For more information, see Chapter 11, "Dynamic Transports," in the HydraExpress Web Service Development Guide
typedef rwsf::NamedObjectImp* (*NamedObjectCreateMethod) ();
struct TransportInfo { rwsf::CString name_; rwsf::CString uri_; rwsf::CString scheme_; rwsf::CString default_; rwsf::Config initParams; rwsf::NamedObjectCreateMethod createMethod_; };
Struct representing a transport, as follows:
name_ |
The string name given to the transport. May be anything. |
uri_ |
The URI identifying the location of the transport |
scheme_ |
The transport's scheme, such as HTTP or HTTPS. |
default_ |
A bool to identify which transport should be the default for a particular scheme. For instance, if scheme_ is HTTP and default_ is true, the program will use this transport as the default for all HTTP urls. |
initParams_ |
Initialization parameters for this transport from the related transports configuration file or client transports configuration file. |
createMethod_ |
The rwsf method to use when creating the transport, such as soapworx.createHttpTransport. |
static void clearListeners();
Removes all listeners.
static void clearTransports();
Removes all transports.
static rwsf::MessageListener * findListener(const rwsf::CString& id);
Returns a new listener instance of the same type as the listener identified by the parameter id.
static rwsf::MessageListener findListenerByUrl(const rwsf::CString& url);
Returns a new listener instance based on the scheme field of the parameter url. Uses the scheme and default attributes in the transports configuration file or client transports configuration file to locate the appropriate transport.
For example, in the listener definition below from the default transports configuration file, transports.xml,
<rwsf:listener name="MyListener" uri="http://schemas.xmlsoap.org/soap/listener/http" scheme="http" default="true" class="soapworx.createHttpMessageListener"> <!-- <rwsf:property name="host" value="localhost"/> --> <!-- <rwsf:property name="port" value="9000"/> --> <rwsf:property name="request-backlog" value="5"/> <rwsf:property name="request-timeout" value="60000"/> <rwsf:property name="request-buffersize" value="4096"/> <rwsf:property name="keep-alive" value="true"/> </rwsf:listener>
this method will return a MyListener instance by default for all urls with an "http" scheme (http://somehost:someport/somepath). If the attribute default is set to false instead of true, then this listener will never be returned by this method. If more than one listener with the same scheme and default set to true exists, then the method will use the one that occurs first in the file.
static rwsf::Transport findTransport(const rwsf::CString& id);
Used by the client proxy to locate a transport. Returns a new transport instance of the same type as the transport identified by the parameter id.
Use this method if you are specifying the type of transport directly instead of relying on the scheme indicated by a location url.
static rwsf::Transport findTransportByUrl(const rwsf::CString& url);
Returns a new transport instance based on the scheme field of the parameter url. Uses the scheme and default attributes in the transports configuration file or client transports configuration file to locate the appropriate transport.
For example, in the transport definition below from the default configuration file, transports.xml,
<rwsf:transport name="MyTransport" uri="http://schemas.xmlsoap.org/soap/http" scheme="http" default="true" class="soapworx.createHttpTransport"> <!-- <rwsf:property name="host" value="localhost"/> --> <!-- <rwsf:property name="port" value="9000"/> --> <rwsf:property name="connect-timeout" value="60000"/>
<rwsf:property name="submit-timeout" value="60000"/> <rwsf:property name="reply-timeout" value="60000"/> </rwsf:transport>
this method will return a MyTransport instance by default for all urls with an "http" scheme (http://somehost:someport/somepath). If the attribute default is set to false instead of true, then this transport will never be returned by this method. If more than one transport with the same scheme and default set to true exists, then the method will use the one that occurs first in the file.
static rwsf::Enumeration<rwsf::CString> getTransportNames();
Returns an enumeration of all available transports. The enumeration will contain all transports specified in the transports configuration file and any that added with the registerTransport() method.
static rwsf::Enumeration<rwsf::CString> getListenerNames();
Returns an enumeration of all available listeners. The enumeration will contain all listeners specified in the transports configuration file and any that added with the registerListener() method.
static void initialize(const rwsf::CString& transportXmlFile, const rwsf::CString& libSuffix = rwsf::CString(rwsf_DEFAULT_LIBSUFFIX));
Parses the transports configuration file and transportXmlFile and initializes the transport.
static void registerTransport(const TransportInfo& transport);
Registers a transport with the Transport Manager so a later call to findTransport() will return it.
static void registerListener (const TransportInfo& transport);
Registers a listener with the Transport Manager so a later call to findListener() will return it.
static rwsf::CString getSchemeFromUrl(const rwsf::CString& url);
For a given URL, returns the type of scheme, such as HTTP or HTTPS.
©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.