Tuscany SCA Native Samples - C++ 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 three 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.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.app.composite file. This describes the
configuration of the SCA BigBank composite deployed to the SCA runtime.
Building the C++ samples on Linux and Mac OS X
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 and Mac OS X.
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- Build the C++ samples with the following command sequence:
- cd <tuscany_sca_install_dir>/samples
- ./configure --prefix=$TUSCANY_SCACPP/samples --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/CppBigBank
Running the C++ BigBank sample on Linux and Mac OS X
BigBank with basic client
- The C++ BigBank sample requires the following extensions:
Please follow the documentation to ensure you have these extensions built and installed
on your system
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- AXIS2C_HOME=<path to Axis2/C version 0.96>
- Run the sample with the following commands:
- cd <tuscany_sca_install_dir>/samples/CppBigBank/deploy/bigbank.client
- ./runclient.sh
BigBank with PHP web client
- The C++ BigBank sample requires the following extensions:
Please follow the documentation to ensure you have these extensions built and installed
on your system
- Ensure you have enabled Axis2/C to run Tuscany SCA services. Follow the instructions
found here.
- Start the Axis2/C 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 Axis2/C version 0.96>
- cd <tuscany_sca_install_dir>/samples/CppBigBank/deploy/bin
- ./runwsserver.sh
- 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.
- 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"
- Copy the <tuscany_sca_install_dir>/samples/CppBigBank/bigbank.phpwsclient
directory to your Apache document root directory (by default this is named 'htdocs').
- Finally, start your Apache web server.
- 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 C++ 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.
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- 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 Express projects under
<tuscany_sca_install_dir>\samples\CppBigBank\VSExpress\CppBigBank.sln or via the command-line build file
found at <tuscany_sca_install_dir>\samples\CppBigBank\VSExpress\CppBigBank\build.bat
which will build and deploy the samples.
Running the C++ BigBank sample on Windows
BigBank with basic client
- The C++ BigBank sample requires the following extensions:
Please follow the documentation to ensure you have these extensions built and installed
on your system
- The following environment variables are required:
- TUSCANY_SCACPP=<path to installed Tuscany SCA>
- TUSCANY_SDOCPP=<path to installed Tuscany SDO>
- Run the sample with the following commands:
- cd <tuscany_sca_install_dir>\samples\CppBigBank\deploy\bigbank.client
- runclient.bat
BigBank with PHP web client
- The C++ BigBank sample requires the following extensions:
Please follow the documentation to ensure you have these extensions built and installed
on your system
- Ensure you have enabled Axis2/C to run Tuscany SCA services. Follow the instructions
found here.
- Start the Axis2/C 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 Axis2/C version 0.96>
- cd <tuscany_sca_install_dir>\samples\CppBigBank\deploy\bigbank.account
- runwsserver.bat
- 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.
- 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"
- Copy the <tuscany_sca_install_dir>\samples\CppBigBank\bigbank.phpwsclient
directory to your Apache document root directory (by default this is named 'htdocs').
- Finally, start your Apache web server.
- 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.