Tuscany SCA for C++ Samples - RubyCalculator Sample

This is a very simple sample to show how an SCA composite can wire together two Ruby 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 Ruby 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 Ruby 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.

  1. 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>
  2. As the RubyCalculator sample is based on Ruby scripts, a specific compilation step is not necessary - only deployment is required. Deploy the Ruby samples only with the following command sequence:
    • cd <tuscany_sca_install_dir>/samples
    • ./configure --enable-ruby --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/RubyCalculator

Running the RubyCalculator sample on Linux

RubyCalculator with basic client

  1. 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>
  2. Run the sample with the following commands:
    • cd <tuscany_sca_install_dir>/samples/RubyCalculator/deploy/sample.calculator.client
    • ./runclient.sh

RubyCalculator with Web Service client

  1. Ensure you have enabled Axis2C to run Tuscany SCA services. Follow the instructions found here.
  2. Start the Axis2C simple http server:
    1. 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>
    2. cd <tuscany_sca_install_dir>/samples/RubyCalculator/deploy/sample.calculator
    3. ./runwsserver.sh
  3. Run the client:
    1. The following environment variable is required:
      • AXIS2C_HOME=<path to axis2c version 0.94>
    2. cd <tuscany_sca_install_dir>/samples/RubyCalculator/deploy/sample.calculator.wsclient
    3. ./runwsclient.sh

Building the RubyCalculator 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.

  1. 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>
  2. As this sample is based on Ruby 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\RubyCalculator
    • deploy.cmd

Running the RubyCalculator sample on Windows

RubyCalculator with basic client

  1. 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>
  2. Run the sample with the following commands:
    • cd <tuscany_sca_install_dir>\samples\RubyCalculator\deploy\sample.calculator.client
    • runclient.bat

RubyCalculator with Web Service client

  1. Ensure you have enabled Axis2C to run Tuscany SCA services. Follow the instructions found here.
  2. Start the Axis2C simple http server:
    1. 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>
    2. cd <tuscany_sca_install_dir>\samples\RubyCalculator\deploy\sample.calculator
    3. runwsserver.bat
  3. Run the client:
    1. 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>
    2. cd <tuscany_sca_install_dir>\samples\RubyCalculator\deploy\sample.calculator.wsclient
    3. runwsclient.bat

Getting Help

First place to look is at the Tuscany FAQ at http://incubator.apache.org/tuscany/faq.html

Any problem with this release can be reported to the Tuscany mailing lists or create a JIRA issue at http://issues.apache.org/jira/browse/Tuscany.