Tuscany SCA for C++ Samples - Calculator Sample
This is a very simple sample to show how an SCA composite can wire
together two C++ components to implement a Calculator service and expose
that service as a Web Service.
There are three sub projects in this workspace:
- sample.calculator
This contains the source code and SCDL artifacts for the SCA Calculator
composite implementing the sample Calculator.
- sample.calculator.client
A sample client which does a local call to the Calculator service.
- sample.calculator.wsclient
A sample Axis2 Web Service client which calls the Calculator Web service.
Additionally, there is the sample.calculator.solution.composite file. This
describes the configuration of the SCA Calculator composite deployed to the SCA
runtime.
Building the C++ samples on Linux
If using the binary distribution the samples are built and installed in
<tuscany_sca_install_dir>/samples - go directly to Running the samples on Linux.
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- AXIS2C_HOME=<path to axis2c version 0.94>
- Build the C++ samples with the following command sequence:
- cd <tuscany_sca_install_dir>/samples
- ./configure --prefix=$TUSCANY_SCACPP
- make
- make install
NOTE: If you don't provide the --prefix configure option, it will by default install into
/usr/local/tuscany/sca/samples/Calculator
Running the Calculator sample on Linux
Calculator with basic client
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- AXIS2C_HOME=<path to axis2c version 0.92>
- Run the sample with the following commands:
- cd <tuscany_sca_install_dir>/samples/Calculator/deploy/sample.calculator.client
- ./runclient.sh
Calculator with Web Service client
- Ensure you have enabled Axis2C to run Tuscany SCA services. Follow the instructions
found here.
- Start the Axis2C simple http server:
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- AXIS2C_HOME=<path to axis2c version 0.94>
- cd <tuscany_sca_install_dir>/samples/Calculator/deploy/sample.calculator
- ./runwsserver.sh
- Run the client:
- The following environment variable is required:
- AXIS2C_HOME=<path to axis2c version 0.94>
- cd <tuscany_sca_install_dir>/samples/Calculator/deploy/sample.calculator.wsclient
- ./runwsclient.sh
Building the Calculator sample on Windows
If using the binary distribution the samples are built and installed in
<tuscany_sca_install_dir>/samples - go directly to Running the samples on Windows.
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- AXIS2C_HOME=<path to axis2c version 0.94>
- You must have set up the environment for Microsoft Visual C++ tools.
The build command will call vcvars32 to set the environment. Ensure the
directory containing this is on your path. This will be where you
installed the compiler.
- Build the source, either via the Visual Studio 6 or 7 projects under
<tuscany_sca_install_dir>\samples\ides or via the command-line build file
found at <tuscany_sca_install_dir>\samples\ides\devstudio6\projects\Calculator\build.cmd
which will build and deploy the samples.
Running the Calculator sample on Windows
Calculator with basic client
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- AXIS2C_HOME=<path to axis2c version 0.94>
- Run the sample with the following commands:
- cd <tuscany_sca_install_dir>/samples/Calculator/deploy/sample.calculator.client
- ./runclient.bat
Calculator with Web Service client
- Ensure you have enabled Axis2C to run Tuscany SCA services. Follow the instructions
found here.
- Start the Axis2C simple http server:
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- AXIS2C_HOME=<path to axis2c version 0.94>
- cd <tuscany_sca_install_dir>/samples/Calculator/deploy/sample.calculator
- ./runwsserver.bat
- Run the client:
- The following environment variable is required:
- AXIS2C_HOME=<path to axis2c version 0.94>
- cd <tuscany_sca_install_dir>/samples/Calculator/deploy/sample.calculator.wsclient
- ./runwsclient.bat