Web Service Development Guide : PART I Getting Started : Chapter 3 Creating a Web Service : Compiling and Running the Application
Compiling and Running the Application
Before building this example, copy the provided sample implementation files from the <installdir>\examples\webservices\HelloWorld to the new HelloWorldExample directory, allowing the provided files to overwrite the generated files, as follows:
GreetingPortClient.cpp Copy to HelloWorldExample\app\client
GreetingPortTypeImp.cpp Copy to HelloWorldExample\app\server
Compiling the Application
From a command prompt, navigate to the HelloWorldExample directory, and build and run the example as described below.
The code generator creates makefiles for building the server and client code. To build the server from the command line using the makefiles, go to “Compiling Using the Makefile” .
If you are on Windows, you can also build the server using the generated solution (.sln) file, as described in “Compiling Using MSVC” .
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.
Compiling Using the Makefile
From a command prompt, change to the directory HelloWorldExample, and simply run nmake (Windows) or make (UNIX or Linux) at the command prompt.
NOTE >> If you wish to build just the client or server, the top-level makefile accepts a server or client target.
The makefile builds any components created when the generator created the makefile, placing them into top-level bin and lib directories.
Compiling Using MSVC
On Windows, you can compile code through MSVC projects. Double-click on the solution to open it in MSVC. Build by selecting the appropriate item from the Build menu, or by right-clicking on the item you wish to build and selecting the appropriate item from the pop-up menu.
Deploying the Service
The generated makefile includes a deploy target to deploy the sample service. If you have compiled the service using MSVC on Windows, a deployment batch file is generated for your convenience. The deploy step is not run automatically, so be sure to run the deploy target when you are ready to deploy your service to the Agent.
Deploying with the makefile
To deploy the service, follow the steps in this section.
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.
1. If the Agent is currently running, stop it by running the rwsfserver stop command, as shown below:
Windows rwsfserver stop
UNIX/Linux rwsfserver stop
2. Run nmake (Windows) or make (UNIX or Linux) at the command prompt with the deploy target. The makefile deploys the service into the HydraExpress installation. The DLLs or shared libraries for the service and client are placed in <installdir>\apps-bin on Windows and <installdir>/apps-lib on UNIX/Linux. The service descriptor for the Hello World service is copied to the Agent deployment directory at <installdir>\apps\servlets\helloworld\WEB-INF.
Windows nmake deploy
UNIX/Linux make deploy
3. Restart the Agent to load the new service by running the rwsfserver start, as shown below:
Windows rwsfserver start
UNIX/Linux rwsfserver start
Deploying Services Compiled with MSVC Project Files
If you compiled the Web service with an MSVC project file on Windows platforms, deploy the servlet as follows:
1. Stop the Agent, if necessary, as described in the previous section.
2. Run the deployment batch file generated in the top level code generation directory as a convenience: deployDebug.bat or deployRelease.bat.
3. Start the Agent as described in the previous section.
Testing the Service
To test the service, just invoke the client from the ...\HelloWorldExample\bin directory:
 
prompt> GreetingPortClient
The above implementation returns the following response:
 
Server Response: Hello World!
NOTE >> HydraExpress’s generated client sample implementations all point to the project\conf directory to locate the client configuration files. If you move the client executable without maintaining the same code generation directory structure, or you invoke the client from another location, be aware that you must edit the client implementation to maintain the correct path to the conf directory.