Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Web Service Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

11.4 Autoconfiguring Listeners

You may choose to autoconfigure your HTTP and HTTPS listener. Autoconfiguration may be useful for several reasons -- for instance, to avoid binding a listener to a port already in use, or to allow your service to be moved to a different machine without having to revise the configuration files.

Once the listener has been bound to a local address (in the rwsf::MessageListener::start() method), the "bound-host", "bound-ip", and "bound-port" properties are set to the host name, ip address, and port of the address. For example, let's look at the client configuration file client-transports.xml for HTTP.

Note that the "port" property is commented out, allowing the listener location to be dynamically assigned. If you do not want a dynamic assignment, uncomment this property and enter a value.

Another way to implement auto-assignment is to comment out the host property. In other words, your applications could have a fixed host with an automatically-assigned port, or a fixed port, with an automatically-assigned host.

(The bound-host, bound-port, and bound-ip properties will also reflect these values.)

It is easy to use an auto-configured listener in your applications. Following is an excerpt from ForecastClient.cpp, the provided sample implementation in the Forecast example implementing listener auto-configuration. (This example is located in your <installdir>\examples\webservices\Forecast directory.)

Note the call listener.getProperty("bound-ip") and listener.getProperty("bound-port"). These calls return the auto-configured values for the IP address and the port.



Previous fileTop of DocumentContentsIndex pageNext file

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