Running the Async Example
NOTE: Make sure that you have set up your environment as described in Chapter 2, Setup in the HydraExpress User Guide. On Windows, be sure you have set up your command window with the MSVC environment.
To run this example:
1. Generate code by opening a command prompt and navigating to the directory <installdir>\examples\webservices\Async. Enter
 
<prompt> rwsfgen example-project.xml
to direct HydraExpress to generate code into the directory AsyncExample based on the Async.wsdl. You could also enter the options and WSDL file manually, as follows:
 
<prompt> rwsfgen -projectname AsyncExample Async.wsdl
NOTE: The HydraExpress project file example-project.xml includes all options and files to be used as an argument to the code generator, so using this file results in exactly the same generated code as providing the options and files directly on the command line. For more information on the use of HydraExpress project files in the shipped examples, see Chapter 2, Setup in the HydraExpress User Guide.
2. Before building this example, copy the provided sample files from the <installdir>\examples\webservices\Async to the new AsyncExample directory, allowing the provided files to overwrite the generated files, as follows:
AsyncClient.cpp Copy to AsyncExample\app\client
AsyncImp.cpp Copy to AsyncExample\app\server
3. Navigate to the directory AsyncExample, and build the example by entering nmake (Windows) or make (UNIX/Linux).
4. To deploy the service, shut down the Agent if it is running, run nmake (Windows) or make (UNIX/Linux) for the deploy target, and restart the server. The command sequence to deploy the service is shown below:
Windows
rwsfserver stop
nmake deploy
rwsfserver start
UNIX/Linux
rwsfserver stop
make deploy
rwsfserver start
5. Change to the directory, AsyncExample\bin, and run the client by entering
 
prompt>AsyncClient
The service returns the following:
 
Invoking longRunningMethod
Still waiting //service simulates a 5 second delay
Return value = Hello World
Invoking oneWayMethod
Finished executing the one way method