rwlogo
HydraExpress 4.7

HydraExpress C++ API Reference Guide

Product Documentation:
   Documentation Home

List of all members | Static Public Member Functions
rwsf::TransportManager Class Reference

Manages transports and listeners for a message. More...

#include <rwsf/webservice/transport/TransportManager.h>

Static Public Member Functions

static void clearListeners ()
 
static void clearTransports ()
 
static rwsf::MessageListener findListener (const std::string &id)
 
static rwsf::MessageListener findListenerByUrl (const std::string &url)
 
static rwsf::Transport findTransport (const std::string &id)
 
static rwsf::Transport findTransportByUrl (const std::string &url)
 
static rwsf::Enumeration
< std::string > 
getListenerNames ()
 
static rwsf::Enumeration
< std::string > 
getTransportNames ()
 
static void initialize (const std::string &transportXmlFile, const std::string &libSuffix=std::string())
 

Detailed Description

The class rwsf::TransportManager manages the use of transports and listeners for a message. It is used by generated client proxies 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, the proxy make() function gets an HTTP transport through the Transport Manager.

myProxy myp = myProxy::make("http://someurl");

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 transport files are transports.xml for a service and client-transports.xml for a client, although you may create your own or modify the name. For more information, see the transports chapter in the Web Service Development Guide.

Member Function Documentation

static void rwsf::TransportManager::clearListeners ( )
static

Removes all listeners.

static void rwsf::TransportManager::clearTransports ( )
static

Removes all transports.

static rwsf::MessageListener rwsf::TransportManager::findListener ( const std::string &  id)
static

Returns a new listener instance of the same type as the listener identified by the parameter id. If a matching listener is not found, then an empty, un-initialized rwsf::MessageListener handle is returned.

static rwsf::MessageListener rwsf::TransportManager::findListenerByUrl ( const std::string &  url)
static

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 listener.

For example, consider 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="example_listener.createMyListener">
<rwsf:property name="auto-start" value="false"/>
<!-- When host and port listener properties are absent, they will be auto-configured
to the machine's host name and first available port. The machine will need to be
configured for lookup on the network under its host name. -->
<rwsf:property name="host" value="localhost"/>
<rwsf:property name="port" value="9090"/> -->
<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>

Given the above listener configuration, this method will return a MyListener instance by default for all urls with an "http" scheme, i.e. 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 rwsf::TransportManager::findTransport ( const std::string &  id)
static

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. If a matching transport is not found, then an empty un-initialized rwsf::Transport handle is returned.

Note
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 rwsf::TransportManager::findTransportByUrl ( const std::string &  url)
static

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, consider the 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="example_transport.createMyTransport">
<rwsf:property name="connect-timeout" value="60000"/>
<rwsf:property name="submit-timeout" value="60000"/>
<rwsf:property name="reply-timeout" value="60000"/>
</rwsf:transport>

For the configuration above, this method returns a MyTransport instance by default for all urls with an "http" scheme, i.e. 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<std::string> rwsf::TransportManager::getListenerNames ( )
static

Returns an enumeration of all available listeners. The enumeration will contain all listeners specified in the transports configuration file.

static rwsf::Enumeration<std::string> rwsf::TransportManager::getTransportNames ( )
static

Returns an enumeration of all available transports. The enumeration will contain all transports specified in the transports configuration file.

static void rwsf::TransportManager::initialize ( const std::string &  transportXmlFile,
const std::string &  libSuffix = std::string() 
)
static

Parses the transports configuration file defined by transportXmlFile, and initializes the transport from its contents. The libSuffix is a string used to add a suffix to the library names specified in the config file. For example libSuffix could be set to version 46, causing the library rwsf_webservice to be loaded as rwsf_webservice46.


Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.