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 --- .../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 +++++++ 5 files changed, 442 insertions(+) create mode 100644 tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl create mode 100644 tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/Makefile.am create mode 100644 tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/README create mode 100644 tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php create mode 100644 tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php (limited to 'tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient') diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl b/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl new file mode 100644 index 0000000000..b83c453462 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/Makefile.am b/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/Makefile.am new file mode 100644 index 0000000000..bdc846e58c --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/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)/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/samples/CppBigBank/bigbank.phpwsclient/README b/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/README new file mode 100644 index 0000000000..d02873e860 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/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/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php b/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php new file mode 100644 index 0000000000..b9f77d3297 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/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/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php b/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php new file mode 100644 index 0000000000..32159ddc16 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php @@ -0,0 +1,44 @@ + + + + BigBank Sample + + + + + + + + +

Welcome To The BigBank Sample

+ +
+ Please enter your account ID + + +
+ +
+ + -- cgit v1.2.3