From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../samples/CppBigBank/Makefile.am | 21 ++ .../samples/CppBigBank/README | 26 ++ .../samples/CppBigBank/README.html | 388 +++++++++++++++++++++ .../CppBigBank/VSExpress/Build/Build.vcproj | 72 ++++ .../CppBigBank/VSExpress/Build/Build.vcproj.user | 65 ++++ .../samples/CppBigBank/VSExpress/CppBigBank.sln | 39 +++ .../bigbank.account/bigbank.account.vcproj | 342 ++++++++++++++++++ .../VSExpress/bigbank.client/bigbank.client.vcproj | 224 ++++++++++++ .../bigbank.account/AccountDataService.h | 63 ++++ .../AccountDataServiceImpl.componentType | 28 ++ .../bigbank.account/AccountDataServiceImpl.cpp | 137 ++++++++ .../bigbank.account/AccountDataServiceImpl.h | 61 ++++ .../CppBigBank/bigbank.account/AccountService.h | 51 +++ .../CppBigBank/bigbank.account/AccountService.wsdl | 126 +++++++ .../AccountServiceImpl.componentType | 40 +++ .../bigbank.account/AccountServiceImpl.cpp | 132 +++++++ .../bigbank.account/AccountServiceImpl.h | 44 +++ .../samples/CppBigBank/bigbank.account/Makefile.am | 59 ++++ .../CppBigBank/bigbank.account/StockQuoteService.h | 36 ++ .../StockQuoteServiceImpl.componentType | 29 ++ .../bigbank.account/StockQuoteServiceImpl.cpp | 73 ++++ .../bigbank.account/StockQuoteServiceImpl.h | 36 ++ .../CppBigBank/bigbank.account/StockQuoteTypes.xsd | 37 ++ .../bigbank.account/StockQuoteWebService.h | 40 +++ .../bigbank.account/StockQuoteWebService.wsdl | 165 +++++++++ .../bigbank.account/bigbank.account.composite | 49 +++ .../CppBigBank/bigbank.account/runwsserver.bat | 50 +++ .../CppBigBank/bigbank.account/runwsserver.sh | 45 +++ .../samples/CppBigBank/bigbank.app.composite | 29 ++ .../CppBigBank/bigbank.client/AccountClient.cpp | 127 +++++++ .../samples/CppBigBank/bigbank.client/Makefile.am | 36 ++ .../CppBigBank/bigbank.client/runclient.bat | 50 +++ .../samples/CppBigBank/bigbank.client/runclient.sh | 46 +++ .../bigbank.phpwsclient/AccountService.wsdl | 126 +++++++ .../CppBigBank/bigbank.phpwsclient/Makefile.am | 22 ++ .../samples/CppBigBank/bigbank.phpwsclient/README | 137 ++++++++ .../CppBigBank/bigbank.phpwsclient/bigaccount.php | 113 ++++++ .../CppBigBank/bigbank.phpwsclient/bigwelcome.php | 44 +++ .../samples/CppBigBank/build.bat | 50 +++ .../samples/CppBigBank/deploy.bat | 67 ++++ .../samples/CppBigBank/deployclient.bat | 63 ++++ 41 files changed, 3388 insertions(+) create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/Makefile.am create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/README create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/README.html create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/Build/Build.vcproj create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/Build/Build.vcproj.user create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/CppBigBank.sln create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/bigbank.account/bigbank.account.vcproj create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/bigbank.client/bigbank.client.vcproj create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataService.h create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.componentType create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.cpp create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.h create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountService.h create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountService.wsdl create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.componentType create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.cpp create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.h create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/Makefile.am create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteService.h create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.componentType create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.cpp create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.h create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteTypes.xsd create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteWebService.h create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteWebService.wsdl create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/bigbank.account.composite create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/runwsserver.bat create mode 100755 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/runwsserver.sh create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.app.composite create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/AccountClient.cpp create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/Makefile.am create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/runclient.bat create mode 100755 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/runclient.sh create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/Makefile.am create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/README create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/build.bat create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/deploy.bat create mode 100644 tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/deployclient.bat (limited to 'tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank') diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/Makefile.am new file mode 100644 index 0000000000..f87524e13e --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/Makefile.am @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +deploydir=$(prefix)/samples/CppBigBank/deploy +SUBDIRS = bigbank.account bigbank.client bigbank.phpwsclient +EXTRA_DIST = *.composite README.html +deploy_DATA = *.composite diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/README b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/README new file mode 100644 index 0000000000..341db17b63 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/README @@ -0,0 +1,26 @@ +Tuscany SCA for C++ 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. + +Additionally, there is the bigbank.app.composite file. This describes the +configuration of the SCA BigBank composite deployed to the SCA runtime. + +See the README.html file for instructions to build and run this sample + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/README.html b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/README.html new file mode 100644 index 0000000000..5094765ee6 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/README.html @@ -0,0 +1,388 @@ + + + + + + + + + + + + Tuscany SCA Native Samples - C++ BigBank Sample + + + +
+
+
+

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.

+
    +
  1. The following environment variables are required: +
      +
    • TUSCANY_SCACPP=<path to installed Tuscany SCA> +
    • TUSCANY_SDOCPP=<path to installed Tuscany SDO> +
  2. + +
  3. 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/CppBigBank
  4. +
+
+ +
+

Running the C++ BigBank sample on Linux and Mac OS X

+

BigBank with basic client

+
    +
  1. The C++ BigBank sample requires the following extensions: + + Please follow the documentation to ensure you have these extensions built and installed + on your system +
  2. +
  3. 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>
    • +
    +
  4. +
  5. Run the sample with the following commands: +
      +
    • cd <tuscany_sca_install_dir>/samples/CppBigBank/deploy/bigbank.client
    • +
    • ./runclient.sh
    • +
    +
  6. +
+

BigBank with PHP web client

+
    +
  1. The C++ BigBank sample requires the following extensions: + + Please follow the documentation to ensure you have these extensions built and installed + on your system +
  2. +
  3. Ensure you have enabled Axis2/C to run Tuscany SCA services. Follow the instructions + found here. +
  4. +
  5. Start the Axis2/C 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 Axis2/C version 0.96>
      • +
      +
    2. +
    3. cd <tuscany_sca_install_dir>/samples/CppBigBank/deploy/bin +
    4. +
    5. ./runwsserver.sh
    6. +
    +
  6. +
  7. 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. +

    +
  8. +
  9. 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"
    +
  10. +
  11. Copy the <tuscany_sca_install_dir>/samples/CppBigBank/bigbank.phpwsclient + directory to your Apache document root directory (by default this is named 'htdocs'). +
  12. +
  13. Finally, start your Apache web server. +
  14. +
  15. 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. +
  16. + +
+
+ +
+

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.

+
    +
  1. The following environment variables are required: +
      +
    • TUSCANY_SCACPP=<path to installed Tuscany SCA> +
    • TUSCANY_SDOCPP=<path to installed Tuscany SDO> +
  2. + +
  3. 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. +
  4. +
  5. 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. +
  6. +
+
+ +
+

Running the C++ BigBank sample on Windows

+

BigBank with basic client

+
    +
  1. The C++ BigBank sample requires the following extensions: + + Please follow the documentation to ensure you have these extensions built and installed + on your system +
  2. +
  3. The following environment variables are required: +
      +
    • TUSCANY_SCACPP=<path to installed Tuscany SCA>
    • +
    • TUSCANY_SDOCPP=<path to installed Tuscany SDO>
    • +
    +
  4. +
  5. Run the sample with the following commands: +
      +
    • cd <tuscany_sca_install_dir>\samples\CppBigBank\deploy\bigbank.client
    • +
    • runclient.bat
    • +
    +
  6. +
+

BigBank with PHP web client

+
    +
  1. The C++ BigBank sample requires the following extensions: + + Please follow the documentation to ensure you have these extensions built and installed + on your system +
  2. +
  3. Ensure you have enabled Axis2/C to run Tuscany SCA services. Follow the instructions + found here. +
  4. +
  5. Start the Axis2/C 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 Axis2/C version 0.96>
      • +
      +
    2. +
    3. cd <tuscany_sca_install_dir>\samples\CppBigBank\deploy\bigbank.account +
    4. +
    5. runwsserver.bat
    6. +
    +
  6. +
  7. 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. +

    +
  8. +
  9. 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"
    +
  10. +
  11. Copy the <tuscany_sca_install_dir>\samples\CppBigBank\bigbank.phpwsclient + directory to your Apache document root directory (by default this is named 'htdocs'). +
  12. +
  13. Finally, start your Apache web server. +
  14. +
  15. 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. +
  16. +
+
+ + + +
+

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.

+
+
+
+ + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/Build/Build.vcproj b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/Build/Build.vcproj new file mode 100644 index 0000000000..78527d02b5 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/Build/Build.vcproj @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/Build/Build.vcproj.user b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/Build/Build.vcproj.user new file mode 100644 index 0000000000..4eae0888d7 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/Build/Build.vcproj.user @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/CppBigBank.sln b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/CppBigBank.sln new file mode 100644 index 0000000000..068eaed614 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/CppBigBank.sln @@ -0,0 +1,39 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual C++ Express 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bigbank.client", "bigbank.client\bigbank.client.vcproj", "{992AACB6-A3BD-489B-9C5B-5363E5A01CBE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bigbank.account", "bigbank.account\bigbank.account.vcproj", "{808B20C7-F853-4F92-89A6-ADA10C52C28C}" + ProjectSection(ProjectDependencies) = postProject + {992AACB6-A3BD-489B-9C5B-5363E5A01CBE} = {992AACB6-A3BD-489B-9C5B-5363E5A01CBE} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Build", "Build\Build.vcproj", "{ECD99F95-6AE5-42B8-8285-6341AD1B4D22}" + ProjectSection(ProjectDependencies) = postProject + {992AACB6-A3BD-489B-9C5B-5363E5A01CBE} = {992AACB6-A3BD-489B-9C5B-5363E5A01CBE} + {808B20C7-F853-4F92-89A6-ADA10C52C28C} = {808B20C7-F853-4F92-89A6-ADA10C52C28C} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {992AACB6-A3BD-489B-9C5B-5363E5A01CBE}.Debug|Win32.ActiveCfg = Debug|Win32 + {992AACB6-A3BD-489B-9C5B-5363E5A01CBE}.Debug|Win32.Build.0 = Debug|Win32 + {992AACB6-A3BD-489B-9C5B-5363E5A01CBE}.Release|Win32.ActiveCfg = Release|Win32 + {992AACB6-A3BD-489B-9C5B-5363E5A01CBE}.Release|Win32.Build.0 = Release|Win32 + {808B20C7-F853-4F92-89A6-ADA10C52C28C}.Debug|Win32.ActiveCfg = Debug|Win32 + {808B20C7-F853-4F92-89A6-ADA10C52C28C}.Debug|Win32.Build.0 = Debug|Win32 + {808B20C7-F853-4F92-89A6-ADA10C52C28C}.Release|Win32.ActiveCfg = Release|Win32 + {808B20C7-F853-4F92-89A6-ADA10C52C28C}.Release|Win32.Build.0 = Release|Win32 + {ECD99F95-6AE5-42B8-8285-6341AD1B4D22}.Debug|Win32.ActiveCfg = Debug|Win32 + {ECD99F95-6AE5-42B8-8285-6341AD1B4D22}.Debug|Win32.Build.0 = Debug|Win32 + {ECD99F95-6AE5-42B8-8285-6341AD1B4D22}.Release|Win32.ActiveCfg = Release|Win32 + {ECD99F95-6AE5-42B8-8285-6341AD1B4D22}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/bigbank.account/bigbank.account.vcproj b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/bigbank.account/bigbank.account.vcproj new file mode 100644 index 0000000000..fce5d7091b --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/bigbank.account/bigbank.account.vcproj @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/bigbank.client/bigbank.client.vcproj b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/bigbank.client/bigbank.client.vcproj new file mode 100644 index 0000000000..0460446ba2 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/VSExpress/bigbank.client/bigbank.client.vcproj @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataService.h b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataService.h new file mode 100644 index 0000000000..64d093ac6f --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataService.h @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + +#include + +#include "commonj/sdo/SDO.h" + +namespace services +{ + namespace accountdata + { + + /** + * AccountDataService business interface + */ + class AccountDataService + { + public: + + // CheckingAccount is a data object containing + // string accountNumber + // float balance + + virtual commonj::sdo::DataObjectPtr /* CheckingAccount*/ getCheckingAccount( + const std::string id) = 0; + + // SavingsAccount is a data object containing + // string accountNumber + // float balance + + virtual commonj::sdo::DataObjectPtr /* SavingsAccount */ getSavingsAccount( + const std::string id) = 0; + + // StockAccount is a data object containing + // string accountNumber + // string symbol + // int quantity + + virtual commonj::sdo::DataObjectPtr /* StockAccount */ getStockAccount ( + const std::string id) = 0; + + }; + + } // End accountdata +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.componentType b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.componentType new file mode 100644 index 0000000000..b1cab9e1f9 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.cpp b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.cpp new file mode 100644 index 0000000000..2517236613 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.cpp @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "commonj/sdo/SDO.h" +#include "osoa/sca/sca.h" + +#include "AccountDataServiceImpl.h" + +using namespace std; +using namespace commonj::sdo; +using namespace osoa::sca; + +/** + * AccountDataServiceImpl component implementation + */ + +namespace services +{ + namespace accountdata + { + + DataObjectPtr /* CheckingAccount*/ + AccountDataServiceImpl::getCheckingAccount(const string id) + { + try { + + DataFactoryPtr factory = ComponentContext::getCurrent().getDataFactory(); + + DataObjectPtr newaccount = + factory->create("http://www.bigbank.com/AccountService","CheckingAccount"); + + char* name = new char[id.size() + 10]; + strcpy(name,id.c_str()); + strcat(name,"_CHA12345"); + + newaccount->setCString("accountNumber",name); + + delete name; + + newaccount->setFloat("balance",1500.0f); + + return newaccount; + + } + catch (SDORuntimeException&) + { + return 0; + } + } + + + + DataObjectPtr /* SavingsAccount */ + AccountDataServiceImpl::getSavingsAccount(const string id) + { + try { + + DataFactoryPtr factory = ComponentContext::getCurrent().getDataFactory(); + + DataObjectPtr newaccount = + factory->create("http://www.bigbank.com/AccountService","SavingsAccount"); + + char* name = new char[id.size() + 10]; + strcpy(name,id.c_str()); + strcat(name,"_SAA12345"); + + newaccount->setCString("accountNumber",name); + + delete name; + + newaccount->setFloat("balance",1500.0f); + + return newaccount; + + } + catch (SDORuntimeException&) + { + return 0; + } + } + + + DataObjectPtr /* StockAccount */ + AccountDataServiceImpl::getStockAccount (const string id) + { + try { + + DataFactoryPtr factory = ComponentContext::getCurrent().getDataFactory(); + + DataObjectPtr newaccount = + factory->create("http://www.bigbank.com/AccountService","StockAccount"); + + char* name = new char[id.size() + 10]; + strcpy(name,id.c_str()); + strcat(name,"_STA12345"); + + newaccount->setCString("accountNumber",name); + + delete name; + + newaccount->setCString("symbol","IBM"); + + newaccount->setInteger("quantity",100); + + return newaccount; + + } + catch (SDORuntimeException&) + { + return 0; + } + } + + } // End accountdata +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.h b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.h new file mode 100644 index 0000000000..9312175540 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountDataServiceImpl.h @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + +#include "AccountDataService.h" + +namespace services +{ + namespace accountdata + { + + /** + * AccountDataServiceImpl component implementation class + */ + class AccountDataServiceImpl : public AccountDataService + { + public: + + // CheckingAccount is a data object containing + // string accountNumber + // float balance + + virtual commonj::sdo::DataObjectPtr /* CheckingAccount*/ getCheckingAccount( + const std::string id); + + // SavingsAccount is a data object containing + // string accountNumber + // float balance + + virtual commonj::sdo::DataObjectPtr /* SavingsAccount */ getSavingsAccount( + const std::string id); + + // StockAccount is a data object containing + // string accountNumber + // string symbol + // int quantity + + virtual commonj::sdo::DataObjectPtr /* StockAccount */ getStockAccount ( + const std::string id); + + }; + + } // End accountdata +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountService.h b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountService.h new file mode 100644 index 0000000000..85337d37a9 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountService.h @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + +#include + +#include "commonj/sdo/SDO.h" + +namespace services +{ + namespace account + { + + /** + * AccountService business interface + */ + class AccountService + { + public: + + // The account report data object has one many-valued + // property "accountSummaries", containing the following + // properties: + // string accountNumber + // string accountType + // float balance. + + virtual commonj::sdo::DataObjectPtr /*AccountReport*/ + getAccountReport(const std::string customerID) = 0; + + }; + + } // End account +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountService.wsdl b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountService.wsdl new file mode 100644 index 0000000000..b83c453462 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountService.wsdl @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.componentType b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.componentType new file mode 100644 index 0000000000..b65fa1dc18 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.componentType @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + USD + + + \ No newline at end of file diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.cpp b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.cpp new file mode 100644 index 0000000000..8544b36e7e --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.cpp @@ -0,0 +1,132 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "osoa/sca/sca.h" + +#include "AccountServiceImpl.h" +#include "StockQuoteService.h" +#include "AccountDataService.h" + +using namespace std; +using namespace commonj::sdo; +using namespace osoa::sca; +using namespace services::accountdata; +using namespace services::stockquote; + +/** + * AccountServiceImpl component implementation + */ +namespace services +{ + namespace account + { + + DataObjectPtr /*AccountReport**/ + AccountServiceImpl::getAccountReport(const string customerID) + { + ComponentContext theContext = ComponentContext::getCurrent(); + + commonj::sdo::DataFactoryPtr factory = theContext.getDataFactory(); + + commonj::sdo::DataObjectPtr newReport = + factory->create("http://www.bigbank.com/AccountService","AccountReport"); + + // Get the accountDataService service + AccountDataService *dataService = + (AccountDataService*)theContext.getService("accountDataService"); + + // would be better to return a list of accounts - this only + // gets the first of each. + + commonj::sdo::DataObjectPtr checking = + dataService->getCheckingAccount(customerID); + + if (checking != 0) + { + commonj::sdo::DataObjectList& dl = newReport->getList("checking"); + checking->setFloat("balance", + fromUSDollarToCurrency(checking->getFloat("balance"))); + dl.append(checking); + } + + commonj::sdo::DataObjectPtr savings = dataService->getSavingsAccount(customerID); + + if (savings != 0) + { + commonj::sdo::DataObjectList& dl = newReport->getList("savings"); + savings->setFloat("balance", + fromUSDollarToCurrency(savings->getFloat("balance"))); + dl.append(savings); + } + + // Get the stockQuoteService service + StockQuoteService* stockService = + (StockQuoteService*)theContext.getService("stockQuoteService"); + + commonj::sdo::DataObjectPtr stocks = dataService->getStockAccount(customerID); + + if (stocks != 0) + { + commonj::sdo::DataObjectList& dl = newReport->getList("stocks"); + + float value = 10.0f; + try { + value = stockService->getQuote( + stocks->getCString("symbol")); + } + catch (ServiceRuntimeException& e) + { + std::cout << "Fault from stock quote service" << e << std::endl; + } + stocks->setFloat("balance", + fromUSDollarToCurrency(stocks->getInteger("quantity") * + value)); + dl.append(stocks); + } + + return newReport; + } + + float AccountServiceImpl::fromUSDollarToCurrency(float value) + { + // Get the "currency" property + ComponentContext myContext = ComponentContext::getCurrent(); + + commonj::sdo::DataObjectInstance properties = myContext.getProperties(); + if (properties) + { + const char* currency = properties->getCString("currency"); + if (currency != 0) + { + std::cout << "Currency is : " << currency << std::endl; + if (!strcmp(currency,"USD")) return value; + if (!strcmp(currency,"EURO")) return 0.8f * value; + } + } + return 0.0f; + } + + } // End account +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.h b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.h new file mode 100644 index 0000000000..0c172823fb --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/AccountServiceImpl.h @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AccountService.h" + + +namespace services +{ + namespace account + { + + /** + * AccountServiceImpl component implementation class + */ + class AccountServiceImpl: public AccountService + { + public: + + virtual commonj::sdo::DataObjectPtr /*AccountReport*/ + getAccountReport(const std::string customerID); + + private: + + float fromUSDollarToCurrency(float value); + + }; + + } // End account +} // End services + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/Makefile.am new file mode 100644 index 0000000000..4c13600628 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/Makefile.am @@ -0,0 +1,59 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +deploydir=$(prefix)/samples/CppBigBank/deploy +compositedir=$(deploydir)/bigbank.account + +BUILT_SOURCES = scagen + +noinst_HEADERS = *.h + +composite_SCRIPTS = runwsserver.sh + +scagen: + java -jar $(TUSCANY_SCACPP)/bin/scagen.jar -dir . -output . + +composite_LTLIBRARIES = libAccount.la +composite_DATA = *.composite *.componentType *.wsdl *.xsd +EXTRA_DIST = *.composite *.componentType *.wsdl *.xsd runwsserver.sh + +dist_libAccount_la_SOURCES = \ +AccountDataServiceImpl.cpp \ +AccountServiceImpl.cpp \ +StockQuoteServiceImpl.cpp + +nodist_libAccount_la_SOURCES = \ +AccountDataServiceImpl_AccountDataService_Proxy.cpp \ +AccountDataServiceImpl_AccountDataService_Wrapper.cpp \ +AccountServiceImpl_accountDataService_Proxy.cpp \ +AccountServiceImpl_AccountService_Proxy.cpp \ +AccountServiceImpl_AccountService_Wrapper.cpp \ +AccountServiceImpl_stockQuoteService_Proxy.cpp \ +StockQuoteServiceImpl_StockQuoteService_Proxy.cpp \ +StockQuoteServiceImpl_StockQuoteService_Wrapper.cpp \ +StockQuoteServiceImpl_webService_Proxy.cpp + +libAccount_la_LIBADD = \ +-L${TUSCANY_SCACPP}/lib \ + -ltuscany_sca \ +-L${TUSCANY_SCACPP}/extensions/cpp/lib \ + -ltuscany_sca_cpp + +INCLUDES = \ + -I$(TUSCANY_SCACPP)/extensions/cpp/include \ + -I$(TUSCANY_SCACPP)/include \ + -I${TUSCANY_SDOCPP}/include diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteService.h b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteService.h new file mode 100644 index 0000000000..379af5b425 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteService.h @@ -0,0 +1,36 @@ +/* + * + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +namespace services +{ + namespace stockquote + { + /** + * StockQuoteService business interface + */ + class StockQuoteService + { + public: + + virtual float getQuote(const std::string symbol) = 0; + + }; + + } // End stockquote +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.componentType b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.componentType new file mode 100644 index 0000000000..6ac2b77255 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.componentType @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.cpp b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.cpp new file mode 100644 index 0000000000..8332730d73 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.cpp @@ -0,0 +1,73 @@ +/* + * + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "osoa/sca/sca.h" +#include "commonj/sdo/SDO.h" + +#include "StockQuoteServiceImpl.h" +#include "StockQuoteWebService.h" + +using namespace std; +using namespace osoa::sca; +using namespace commonj::sdo; + +/** + * StockQuoteServiceImpl component implementation + */ +namespace services { + namespace stockquote { + + // Map the format returned by the StockQuote Web service to + // the format expected in the BigBank application + float StockQuoteServiceImpl::getQuote(const string symbol) + { + ComponentContext myContext = ComponentContext::getCurrent(); + + // Get the StockQuote Web service + StockQuoteWebService* webService = + (StockQuoteWebService*)myContext.getService("webService"); + + // Invoke the service + const string result = webService->GetQuote(symbol); + + float stockPrice = 0.0f; + + // Get the stock price out of the document returned by the StockQuote + // Web service + try + { + XMLHelperPtr xmlHelper = HelperProvider::getXMLHelper(myContext.getDataFactory()); + XMLDocumentPtr stockDoc = xmlHelper->load(result); + if (stockDoc->getRootDataObject()) + { + stockPrice=stockDoc->getRootDataObject()->getFloat("Stock.0/Last"); + } + } + catch (SDORuntimeException& e) + { + std::cout << e << std::endl; + return 0.0f; + } + return stockPrice; + } + + } // End stockquote +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.h b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.h new file mode 100644 index 0000000000..9b0ac69b0c --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteServiceImpl.h @@ -0,0 +1,36 @@ +/* + * + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "StockQuoteService.h" + +namespace services +{ + namespace stockquote + { + + /** + * StockQuoteServiceImpl component implementation class + */ + class StockQuoteServiceImpl : public StockQuoteService + { + public: + + virtual float getQuote(const std::string symbol); + }; + + } // End stockquote +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteTypes.xsd b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteTypes.xsd new file mode 100644 index 0000000000..5bce3a63dc --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteTypes.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteWebService.h b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteWebService.h new file mode 100644 index 0000000000..5c32ff8eaa --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteWebService.h @@ -0,0 +1,40 @@ +/* + * + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +namespace services +{ + namespace stockquote + { + + /** + * StockQuoteWebService business interface + * + * This is the interface of the Web service used to get + * live stock quotes. + */ + class StockQuoteWebService + { + public: + + virtual const std::string GetQuote(const std::string symbol) = 0; + + }; + + } // End stockquote +} // End services diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteWebService.wsdl b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteWebService.wsdl new file mode 100644 index 0000000000..c14f97c87b --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/StockQuoteWebService.wsdl @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get Stock quote for a company Symbol + + + + + + + + + + Get Stock quote for a company Symbol + + + + + + + + + + Get Stock quote for a company Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/bigbank.account.composite b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/bigbank.account.composite new file mode 100644 index 0000000000..7173d584d2 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/bigbank.account.composite @@ -0,0 +1,49 @@ + + + + + + + + + + AccountServiceComponent + + + + + AccountDataServiceComponent + StockQuoteServiceComponent + EURO + + + + + + + + + StockQuoteWebService + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/runwsserver.bat b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/runwsserver.bat new file mode 100644 index 0000000000..c08a8fc5d9 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/runwsserver.bat @@ -0,0 +1,50 @@ +@echo off + +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. + +setlocal + +if "%TUSCANY_SCACPP%" == "" ( +echo "TUSCANY_SCACPP not set" +goto end +) +echo Using SCA installed at %TUSCANY_SCACPP% + +if "%TUSCANY_SDOCPP%" == "" ( +echo "TUSCANY_SDOCPP not set" +goto end +) +echo Using SDO installed at %TUSCANY_SDOCPP% + +if "%AXIS2C_HOME%" == "" ( +echo "AXIS2C_HOME not set" +goto end +) +echo Using Axis2C installed at %AXIS2C_HOME% + +rem Run the server +set PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SCACPP%\extensions\cpp\bin;%TUSCANY_SDOCPP%\bin;%AXIS2C_HOME%\lib;%PATH% + +set APFULLDIR=%~d0%~p0 +set TUSCANY_SCACPP_ROOT=%~d0%~p0\..\ + +cd %AXIS2C_HOME%\bin +.\axis2_http_server.exe + +:end +endlocal diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/runwsserver.sh b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/runwsserver.sh new file mode 100755 index 0000000000..047e541360 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.account/runwsserver.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +APFULLDIR=`pwd` + +if [ x$TUSCANY_SCACPP = x ]; then +echo "TUSCANY_SCACPP not set" +exit; +fi +echo "Using SCA installed at $TUSCANY_SCACPP" + +if [ x$TUSCANY_SDOCPP = x ]; then +echo "TUSCANY_SDOCPP not set" +exit; +fi +echo "Using SDO installed at $TUSCANY_SDOCPP" + +if [ x$AXIS2C_HOME = x ]; then +echo "AXIS2C_HOME not set" +exit; +fi +echo "Using Axis2C installed at $AXIS2C_HOME" + +export LD_LIBRARY_PATH=$TUSCANY_SCACPP/extensions/cpp/lib:$TUSCANY_SCACPP/lib:$TUSCANY_SDOCPP/lib:$AXIS2C_HOME/lib:$LD_LIBRARY_PATH + +export TUSCANY_SCACPP_ROOT=$APFULLDIR/../ + +cd $AXIS2C_HOME/bin +./axis2_http_server diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.app.composite b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.app.composite new file mode 100644 index 0000000000..5d68e0ae1a --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.app.composite @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/AccountClient.cpp b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/AccountClient.cpp new file mode 100644 index 0000000000..009c2d0c4d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/AccountClient.cpp @@ -0,0 +1,127 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include +#include + +#include "osoa/sca/sca.h" + +#include "AccountService.h" + +using namespace std; +using namespace commonj::sdo; +using namespace osoa::sca; +using namespace services::account; + +int main(int argc, char* argv[]) +{ + + if (argc != 2) + { + cout << "account_client: Argument must be the name of the account" << endl; + return 0; + } + try + { + + // Locate a service + CompositeContext myContext = CompositeContext::getCurrent(); + AccountService *accountService = + (AccountService*) myContext.locateService("AccountServiceComponent"); + if (accountService == 0) + { + cout << "account_client: Unable to find Account service" << endl; + } + else + { + try + { + // exercise the account service + + DataObjectPtr report = + accountService->getAccountReport(argv[1]); + + XMLHelperPtr xmlHelper = HelperProvider::getXMLHelper(myContext.getDataFactory()); + char* doc = xmlHelper->save(report, report->getType().getURI(), report->getType().getName()); + cout << "XML: " << doc <getList("stocks"); + + for (i=0;i< stocks.size() ;i++) + { + cout << "Stock Account " << stocks[i]->getCString("accountNumber") << endl; + cout << "Stock Symbol : " << stocks[i]->getCString("symbol") << endl; + cout << " Holding : " << stocks[i]->getCString("quantity") << endl; + balance = stocks[i]->getFloat("balance"); + sprintf(balanceStr,"%.2f",balance); + cout << " Value : " << balanceStr << endl << endl; + } + + DataObjectList& checking = report->getList("checking"); + + for (i=0;i< checking.size() ;i++) + { + cout << "Checking Account " << checking[i]->getCString("accountNumber") << endl; + balance = checking[i]->getFloat("balance"); + sprintf(balanceStr,"%.2f",balance); + cout << " Balance : " << balanceStr << endl << endl; + } + + DataObjectList& savings = report->getList("savings"); + + for (i=0;i< savings.size() ;i++) + { + cout << "Savings Account " << savings[i]->getCString("accountNumber") << endl; + balance = savings[i]->getFloat("balance"); + sprintf(balanceStr,"%.2f",balance); + cout << " Balance : " << balanceStr << endl << endl; + } + + cout << endl; + } + } + catch (SDORuntimeException& e) + { + cout << e << endl; + } + } + + } + catch (ServiceRuntimeException& ex) + { + cout << ex << endl; + } + return 0; +} + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/Makefile.am new file mode 100644 index 0000000000..134a0054e8 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/Makefile.am @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +deploydir=$(prefix)/samples/CppBigBank/deploy +clientdir=$(deploydir)/bigbank.client + +client_PROGRAMS = account_client +client_SCRIPTS = runclient.sh +EXTRA_DIST = runclient.sh + +AM_CPPFLAGS = $(CPPFLAGS) +account_client_SOURCES = AccountClient.cpp + +account_client_LDADD = -L${TUSCANY_SCACPP}/lib -ltuscany_sca \ + -L${TUSCANY_SCACPP}/extensions/cpp/lib -ltuscany_sca_cpp \ + -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo + + +INCLUDES = -I$(TUSCANY_SCACPP)/extensions/cpp/include \ + -I${TUSCANY_SCACPP}/include \ + -I${TUSCANY_SDOCPP}/include \ + -I../bigbank.account diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/runclient.bat b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/runclient.bat new file mode 100644 index 0000000000..069463ba2d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/runclient.bat @@ -0,0 +1,50 @@ +@echo off + +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. + +setlocal + +if "%TUSCANY_SCACPP%" == "" ( +echo "TUSCANY_SCACPP not set" +goto end +) +echo Using SCA installed at %TUSCANY_SCACPP% + +if "%TUSCANY_SDOCPP%" == "" ( +echo "TUSCANY_SDOCPP not set" +goto end +) +echo Using SDO installed at %TUSCANY_SDOCPP% + +if "%AXIS2C_HOME%" == "" ( +echo "AXIS2C_HOME not set" +goto end +) +echo Using Axis2C installed at %AXIS2C_HOME% + +rem Run the client +set PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SCACPP%\extensions\cpp\bin;%TUSCANY_SDOCPP%\bin;%AXIS2C_HOME%\lib;%PATH% + +set APFULLDIR=%~d0%~p0 +set TUSCANY_SCACPP_ROOT=%~d0%~p0\..\ +set TUSCANY_SCACPP_COMPONENT=bigbank.AccountManagementComponent + +.\AccountClient.exe 1234 + +:end +endlocal diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/runclient.sh b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/runclient.sh new file mode 100755 index 0000000000..d5476ee84c --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.client/runclient.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +APFULLDIR=`pwd` + +if [ x$TUSCANY_SCACPP = x ]; then +echo "TUSCANY_SCACPP not set" +exit; +fi +echo "Using SCA installed at $TUSCANY_SCACPP" + +if [ x$TUSCANY_SDOCPP = x ]; then +echo "TUSCANY_SDOCPP not set" +exit; +fi +echo "Using SDO installed at $TUSCANY_SDOCPP" + +if [ x$AXIS2C_HOME = x ]; then +echo "AXIS2C_HOME not set" +exit; +fi +echo "Using Axis2C installed at $AXIS2C_HOME" + +export LD_LIBRARY_PATH=$TUSCANY_SCACPP/extensions/cpp/lib:$TUSCANY_SCACPP/lib:$TUSCANY_SDOCPP/lib:$AXIS2C_HOME/lib:$LD_LIBRARY_PATH + +export TUSCANY_SCACPP_ROOT=$APFULLDIR/../ +export TUSCANY_SCACPP_COMPONENT=bigbank.AccountManagementComponent + +./account_client 1234 + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl new file mode 100644 index 0000000000..b83c453462 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/Makefile.am new file mode 100644 index 0000000000..4de63afd12 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/Makefile.am @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +deploydir=$(prefix)/samples/CppBigBank/deploy +phpwsclientdir=$(deploydir)/bigbank.phpwsclient + +phpwsclient_DATA = *.php *.wsdl README +EXTRA_DIST = *.php *.wsdl README diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/README b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/README new file mode 100644 index 0000000000..d02873e860 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/README @@ -0,0 +1,137 @@ +Big Bank PHP Client +=================== + +Overview +-------- + +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. + +As this is a very simple test client once you have reached bigaccount.php you are done. +So there are no further buttons other than the browser back button. + +Installation +------------ + +This assumes that you have the BigBank sample runnig as a web service in your local +Axis2C container at http://localhost:9090/axis2/services/AccountService + +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: + +Apache web server - http://httpd.apache.org/ (I'm currently at 2.0.55) +PHP 5.1.6 - http://www.php.net/downloads.php (I'm currently at 5.1.6) +PHP SDO - http://pecl.php.net/package/sdo (I'm currently at 1.0.3) + +Windows +------- +If you are on windows you can get binary builds from http://www.php.net/downloads.php. +For SDO you need two dlls as followd + +php_sdo.dll http://pecl4win.php.net/ext.php/php_sdo.dll +php_sdo_das_xml.dll http://pecl4win.php.net/ext.php/php_sdo_das_xml.dll + +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:/simon/apps/php5.1.6/ext" + +When I ask PHP to list what modules are active in my version of PHP I get the +following + +C:\simon\apps\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 sd_das_xml are active. + +Other Platforms +--------------- + +If your on on another platform, such as Linux, then you will need to compile the +SDO extension. The documentation at the SDO extension page (http://livedocs.phpdoc.info/index.php?l=en&q=ref.sdo) +is currently a bit missleading and needs updating. What you need to do is do a +phpize build of the SDO PECL extension. This is discussed in the SDO documentation +but is also discussed in many other places, for example, http://www.php.net/manual/en/install.pecl.phpize.php. +Here is not the time to go into the details of how to build PHP extensions using +phpize but if you are familar with the process I use the following configure line +on windows. + +cscript configure.js --with-extra-includes=c:\simon\projects\tuscany\php\win32build\include; + c:\simon\apps\libxml2-2.6.23.win32\include; + c:\simon\apps\iconv-1.9.1.win32\include + --with-extra-libs=c:\simon\projects\tuscany\php\win32build\lib; + c:\simon\apps\libxml2-2.6.23.win32\lib; + c:\simon\apps\iconv-1.9.1.win32\lib + --enable-sdo=shared + --enable-soap + +There are no newlines in my command line by the way. I've just included them +here so you can see the command. + +Running +------- + +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:/simon/apps/php5.1.6/php5apache2.dll" +AddType application/x-httpd-php .php + +# configure the path to php.ini +PHPIniDir "C:/simon/apps/php5.1.6" + +Having set up Apache all that remains is to + +- put the bigbank.phpwsclient directory in your web server's root documents directory +- start up the Axis2C runtime configured to run BigBank +- point your browser at http://myserver:port/bigbank.phpwsclient/bigwelcome.php + +You should now be able to press the "GetAccount" button and see the values +returned from the BigBank SCA application. diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php new file mode 100644 index 0000000000..b9f77d3297 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php @@ -0,0 +1,113 @@ + + + BigBank Sample + + + + + + +getAccountReport($accountname); + // we have to construct an object hierarchy that matches the + // WSDL request. We can use SDO to do this for us + + // configure SDO based on the WSDL + $xmldas = SDO_DAS_XML::create("AccountService.wsdl"); + + // Get a document that represents the request + // and get the root element + $requestxdoc = $xmldas->createDocument("getAccountReport"); + $requestsdo = $requestxdoc->getRootDataObject(); + + // add the parameter + $requestsdo['customerID'] = $accountname; + + // make the call + $result = $client->getAccountReport($requestsdo); + + // now we have the result as a PHP object + // we can turn this into an SDO but we have to do it manually + // as the SOAP extension won't generate types for us + // automatically just yet + $responsexdoc = $xmldas->createDocument("getAccountReportResponse"); + $responsesdo = $responsexdoc->getRootDataObject(); + + // flesh out the object hierarchy + $account = $responsesdo->createDataObject ('result'); + $checking = $account->createDataObject ('checking'); + $saving = $account->createDataObject ('savings'); + $stocks = $account->createDataObject ('stocks'); + + //copy the data + $checking['accountNumber'] = $result->result->checking->accountNumber; + $checking['balance'] = $result->result->checking->balance; + //etc.. + // This is a bit rubbish as we would want this to happen automatically + + // Now just put the data on the screen + // To do this we don't need to use SDO as you can see but + // it would be really handy if we wanted to pass the XML doc + // onto another service or if we wanted to do some other + // more complex XML manipulation or XPath searches + echo "

Account $accountname

"; + echo "

Checking Account

"; + echo ""; + echo ""; + echo "
Account Number $checking->accountNumber
Balance $checking->balance

Saving Account

"; + echo ""; + echo ""; + echo "
Account Number" . $result->result->savings->accountNumber . "
Balance" . $result->result->savings->balance . "

Stock Account

"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Account Number" . $result->result->stocks->accountNumber . "
Symbol" . $result->result->stocks->symbol . "
Quantity" . $result->result->stocks->quantity . "
Banalce" . $result->result->stocks->balance . "
"; + } + catch (SoapFault $f) + { + echo "Caught soap exception: \n"; + print_r ( $f ); + } + } + catch ( Exception $e ) + { + echo "Caught exception: \n"; + print_r ( $e ); + + } +?> diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php new file mode 100644 index 0000000000..32159ddc16 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php @@ -0,0 +1,44 @@ + + + + BigBank Sample + + + + + + + + +

Welcome To The BigBank Sample

+ +
+ Please enter your account ID + + +
+ +
+ + diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/build.bat b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/build.bat new file mode 100644 index 0000000000..2b1a4898ea --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/build.bat @@ -0,0 +1,50 @@ +@echo off +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. + +setlocal + +set config=Release +if .Debug == .%1 ( +echo Building Debug version +set config=Debug +) + +if "%TUSCANY_SDOCPP%" == "" ( +echo "TUSCANY_SDOCPP not set" +goto end +) +echo using Tuscany SCACPP: %TUSCANY_SCACPP% + +if "%TUSCANY_SCACPP%" == "" ( +echo "TUSCANY_SCACPP not set" +goto end +) +echo using Tuscany SCACPP: %TUSCANY_SCACPP% + +if "%AXIS2C_HOME%" == "" ( +echo "AXIS2C_HOME not set" +goto end +) +echo using Axis2C: %AXIS2C_HOME%" + +call vcvars32.bat +cd VSExpress +call vcbuild CppBigBank.sln "%config%|Win32" + +:end +endlocal diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/deploy.bat b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/deploy.bat new file mode 100644 index 0000000000..7a3f5d898d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/deploy.bat @@ -0,0 +1,67 @@ +@echo off +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. + +rem Will copy the correct files from the source tree for packaging and +rem deployment of the SCA BigBank sample. + +setlocal + +if . == .%1 ( +echo source path not specified +goto usage +) +set srcdir=%1 + +if . == .%2 ( +echo input directory not specified +goto usage +) +set inpath=%2 +echo %inpath% + +set package=bigbank.account + +set deploydir=%TUSCANY_SCACPP% +set samplesdir=%deploydir%\samples +set bbdir=%samplesdir%\CppBigBank +set bbdeploydir=%bbdir%\deploy +set samplebb=%bbdeploydir%\%package% + +if not exist %samplesdir% mkdir %samplesdir% +if not exist %bbdir% mkdir %bbdir% +if not exist %bbdeploydir% mkdir %bbdeploydir% +if not exist %samplebb% mkdir %samplebb% + +set samplebbsrc=%srcdir%\%package% +copy %srcdir%\bigbank.app.composite %bbdeploydir% +copy %samplebbsrc%\*.wsdl %samplebb% +copy %samplebbsrc%\*.composite %samplebb% +copy %samplebbsrc%\*.componentType %samplebb% +copy %samplebbsrc%\runwsserver.bat %samplebb% + +set library=Account +copy %inpath%\%library%.dll %samplebb% + +if exist %inpath%\%library%.pdb copy %inpath%\%library%.pdb %samplebb% + +goto end +:usage +echo Usage: deploy +:end + +endlocal diff --git a/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/deployclient.bat b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/deployclient.bat new file mode 100644 index 0000000000..5033e5bee8 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC1/samples/CppBigBank/deployclient.bat @@ -0,0 +1,63 @@ +@echo off +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. + +rem Will copy the correct files from the source tree for packaging and +rem deployment of the SCA BigBank sample. + +setlocal + +if . == .%1 ( +echo source path not specified +goto usage +) +set srcdir=%1 + +if . == .%2 ( +echo input directory not specified +goto usage +) +set inpath=%2 +echo %inpath% + +set package=bigbank.client + +set deploydir=%TUSCANY_SCACPP% +set samplesdir=%deploydir%\samples +set bbdir=%samplesdir%\CppBigBank +set bbdeploydir=%bbdir%\deploy +set clientdir=%bbdeploydir%\%package% + +if not exist %samplesdir% mkdir %samplesdir% +if not exist %bbdir% mkdir %bbdir% +if not exist %bbdeploydir% mkdir %bbdeploydir% +if not exist %clientdir% mkdir %clientdir% + +set clientdirsrc=%srcdir%\%package% +copy %clientdirsrc%\runclient.bat %clientdir% + +set library=AccountClient +copy %inpath%\%library%.exe %clientdir% + +if exist %inpath%\%library%.pdb copy %inpath%\%library%.pdb %clientdir% + +goto end +:usage +echo Usage: deploy +:end + +endlocal -- cgit v1.2.3