Tuscany SCA for C++ Samples - PythonCalculator Sample
This is a very simple sample to show how an SCA composite can wire
together two Python components to implement a Calculator service and expose
that service as a Web Service.
See the Python extension
documentation for information about building the Tuscany Python extension
and using Python in SCA composites.
There are three sub projects in this workspace:
- sample.calculator
This contains the Python scripts 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 client which does a local call to a composite that contains a Web Service reference
that 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 Python 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>
- As the PythonCalculator sample is based on Python scripts, a specific compilation step is not necessary -
only deployment is required. Deploy the Python samples only with the following command sequence:
- cd <tuscany_sca_install_dir>/samples
- ./configure --enable-python --enable-cpp=no --prefix=$TUSCANY_SCACPP
- make install
NOTE: If you don't provide the --prefix configure option, it will by default install into
/usr/local/tuscany/sca/samples/PythonCalculator
Running the PythonCalculator sample on Linux
PythonCalculator 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/PythonCalculator/deploy/sample.calculator.client
- ./runclient.sh
PythonCalculator 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/PythonCalculator/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/PythonCalculator/deploy/sample.calculator.wsclient
- ./runwsclient.sh
Building the PythonCalculator 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>
- As this sample is based on Python scripts, a specific compilation step is not necessary -
only deployment is required. Deploy the sample with the following commands:
- cd <tuscany_sca_install_dir>/samples/PythonCalculator
- ./deploy.cmd
Running the PythonCalculator sample on Windows
PythonCalculator 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/PythonCalculator/deploy/sample.calculator.client
- ./runclient.bat
PythonCalculator 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/PythonCalculator/deploy/sample.calculator
- ./runwsserver.bat
- Run the 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>
- cd <tuscany_sca_install_dir>/samples/PythonCalculator/deploy/sample.calculator.wsclient
- ./runwsclient.bat