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.
- 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/BigBank
Running the BigBank sample on Linux
BigBank 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/BigBank/deploy/bigbank.client
- ./runclient.sh
BigBank 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/BigBank/deploy/bigbank.account
- ./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/BigBank/deploy/bigbank.wsclient
- ./runwsclient.sh
BigBank with PHP web 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/BigBank/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 I 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/BigBank/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 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>
- 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\BigBank\build.cmd
which will build and deploy the samples.
Running the BigBank sample on Windows
BigBank 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/BigBank/deploy/bigbank.client
- ./runclient.bat
BigBank 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/BigBank/deploy/bigbank.account
- ./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/BigBank/deploy/bigbank.wsclient
- ./runwsclient.bat
BigBank with PHP web 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/BigBank/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:
I copied these to my php5.1.6/ext dir ( php_soap.dll is already there) and added the
following to my 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"
When I ask PHP to list what modules are active in my version of PHP I get 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 I 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/BigBank/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.