Tuscany SCA for C++ Samples - BigBank Sample

This sample implements the "Simplified BigBank" scenario. A whitepaper describing the scenario based on the SCA 0.9 Assembly specification can be found here. This sample uses multiple C++ components, calls out to an external Web Service via a reference, exposes the service as a Web Service and also provides a PHP based client.

There are four sub projects in this workspace:

  • bigbank.account
    This contains the source code and SCDL artifacts for the SCA BigBank composite implementing the account services.
  • bigbank.client
    A sample client which does a local call to the BigBank service.
  • bigbank.wsclient
    A sample Axis2 Web Service client which calls the BigBank Web service.
  • bigbank.phpclient
    A sample PHP client which calls the BigBank Web service and then deconstructs and displays the result by using the SDO for PHP extension.

    This is a pair of very simple PHP scripts to demonstrate how the Accounts service that the C++ Big Bank sample exposes can be used from within the PHP scripting language.

    bigwelcome.php
    A bootstrap script that shows a form and allows the user to press a button in order to invoke the bigaccount.php script

    bigaccount.php
    Makes a call to a locally installed BigBank Accounts service. The script shows how to use PHP SDO and SOAP extensions to construct the call and interpret the result.

Additionally, there is the bigbank.accountmanagement.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.

  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. Build the C++ samples with the following command sequence:
    • cd <tuscany_sca_install_dir>/samples
    • ./configure --prefix=$TUSCANY_SCACPP --enable-static=no
    • make
    • make install
    NOTE: If you don't provide the --prefix configure option, it will by default install into /usr/local/tuscany/sca/samples/BigBank

Running the BigBank sample on Linux

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

BigBank 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/BigBank/deploy/bigbank.account
    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/BigBank/deploy/bigbank.wsclient
    3. ./runwsclient.sh

BigBank with PHP web 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/BigBank/deploy/bin
    3. ./runwsserver.sh
  3. To run the php scripts requires some configuration and setup of a php runtime with the SDO and SimpleXML extensions enabled. The bits you will need are:

    Follow these instructions to install SDO and DAS.

  4. You need to configure Apache to run PHP of course. This is well documented but this is what to put at the end of httpd.conf:
    # PHP5 Support
    LoadModule php5_module "/home/php/php5.1.6/php5apache2.so"
    AddType application/x-httpd-php .php
    
    # configure the path to php.ini
    PHPIniDir "/home/php/php5.1.6"
  5. Copy the <tuscany_sca_install_dir>/samples/BigBank/bigbank.phpwsclient directory to your Apache document root directory (by default this is named 'htdocs').
  6. Finally, start your Apache web server.
  7. Run the PHP web client by pointing your browser at http://localhost/bigbank.phpwsclient/welcome.php. You should now be able to press the "GetAccount" button and see the values returned from the BigBank SCA application.

Building the BigBank 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. 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.
  3. 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\BigBank\build.cmd which will build and deploy the samples.

Running the BigBank sample on Windows

BigBank 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\BigBank\deploy\bigbank.client
    • runclient.bat

BigBank 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\BigBank\deploy\bigbank.account
    3. runwsserver.bat
  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\BigBank\deploy\bigbank.wsclient
    3. runwsclient.bat

BigBank with PHP web 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\BigBank\deploy\bigbank.account
    3. runwsserver.bat
  3. To run the php scripts requires some configuration and setup of a php runtime with the SDO and SimpleXML extensions enabled. The bits you will need are:

    You can get Windows binary builds from http://www.php.net/downloads.php. For SDO you need two dlls as follows:

    Copy these to the php5.1.6\ext dir ( php_soap.dll is already there) and add the following to php.ini file (having already renamed php.ini-recommended to php.ini of course)

    extension=php_soap.dll
    extension=php_sdo.dll
    extension=php_sdo_das_xml.dll
    I also changed the extension_dir directive to point to my extensions directory:
    extension_dir="C:\php5.1.6\ext"

    Asking PHP to list what modules are active gives the following:

    C:\php5.1.6>php -m
    [PHP Modules]
    bcmath
    calendar
    com_dotnet
    ctype
    date
    dom
    ftp
    hash
    iconv
    libxml
    odbc
    pcre
    Reflection
    sdo
    sdo_das_xml
    session
    SimpleXML
    soap
    SPL
    standard
    tokenizer
    wddx
    xml
    xmlreader
    xmlwriter
    zlib
    
    [Zend Modules]
    Of particular relevance to these scripts note that soap, sdo and sdo_das_xml are active.

  4. You need to configure Apache to run PHP of course. This is well documented but this is what to put at the end of httpd.conf:
    # PHP5 Support
    LoadModule php5_module "C:\php5.1.6\php5apache2.dll"
    AddType application/x-httpd-php .php
    
    # configure the path to php.ini
    PHPIniDir "C:\php5.1.6"
  5. Copy the <tuscany_sca_install_dir>\samples\BigBank\bigbank.phpwsclient directory to your Apache document root directory (by default this is named 'htdocs').
  6. Finally, start your Apache web server.
  7. Run the PHP web client by pointing your browser at http://localhost/bigbank.phpwsclient/welcome.php. You should now be able to press the "GetAccount" button and see the values returned from the BigBank SCA application.

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.