summaryrefslogtreecommitdiffstats
path: root/cpp/sca/samples/CppBigBank/bigbank.phpwsclient
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/sca/samples/CppBigBank/bigbank.phpwsclient')
-rw-r--r--cpp/sca/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl126
-rw-r--r--cpp/sca/samples/CppBigBank/bigbank.phpwsclient/README137
-rw-r--r--cpp/sca/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php113
-rw-r--r--cpp/sca/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php44
4 files changed, 420 insertions, 0 deletions
diff --git a/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl b/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl
new file mode 100644
index 0000000000..b83c453462
--- /dev/null
+++ b/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/AccountService.wsdl
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/AccountService"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.bigbank.com/AccountService"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.bigbank.com/AccountService"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="result"
+ type="tns:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="checking"
+ type="tns:CheckingAccount" maxOccurs="unbounded" />
+ <xsd:element name="savings"
+ type="tns:SavingsAccount" maxOccurs="unbounded" />
+ <xsd:element name="stocks" type="tns:StockAccount"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="StockAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string" />
+ <xsd:element name="symbol" type="xsd:string" />
+ <xsd:element name="quantity" type="xsd:integer" />
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="CheckingAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string" />
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="SavingsAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string" />
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest" />
+ <wsdl:output message="tns:getAccountReportResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/AccountService/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:9090/axis2/services/bigbank.AccountManagementComponent/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/README b/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/README
new file mode 100644
index 0000000000..d02873e860
--- /dev/null
+++ b/cpp/sca/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/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php b/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php
new file mode 100644
index 0000000000..b9f77d3297
--- /dev/null
+++ b/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/bigaccount.php
@@ -0,0 +1,113 @@
+<!--
+ 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: 2005/12/22 11:33:21 $
+-->
+<head>
+ <title>BigBank Sample</title>
+</head>
+
+<body BGCOLOR="#EFEFEF">
+
+<script type="text/javascript"></script>
+
+<?php
+ try
+ {
+ // In case we want to see what's in the request
+ //print_r ($_POST);
+
+ // get the entered account name
+ $accountname = $_POST['accountname'];
+
+ try
+ {
+ // configure the SOAP client
+ $client = new SoapClient("AccountService.wsdl");
+
+ // make the call but its a wrapped call so we
+ // can't just do...
+ // $result = $client->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 "<h2>Account $accountname</h2>";
+ echo "<h2>Checking Account</h2><table>";
+ echo "<tr><td>Account Number</td><td> $checking->accountNumber </td></tr>";
+ echo "<tr><td>Balance</td><td> $checking->balance </td></tr>";
+ echo "</table><h2>Saving Account</h2><table>";
+ echo "<tr><td>Account Number</td><td>" . $result->result->savings->accountNumber . "</td></tr>";
+ echo "<tr><td>Balance</td><td>" . $result->result->savings->balance . "</td></tr>";
+ echo "</table><h2>Stock Account</h2><table>";
+ echo "<tr><td>Account Number</td><td>" . $result->result->stocks->accountNumber . "</td></tr>";
+ echo "<tr><td>Symbol</td><td>" . $result->result->stocks->symbol . "</td></tr>";
+ echo "<tr><td>Quantity</td><td>" . $result->result->stocks->quantity . "</td></tr>";
+ echo "<tr><td>Banalce</td><td>" . $result->result->stocks->balance . "</td></tr>";
+ echo "</table>";
+ }
+ catch (SoapFault $f)
+ {
+ echo "Caught soap exception: \n";
+ print_r ( $f );
+ }
+ }
+ catch ( Exception $e )
+ {
+ echo "Caught exception: \n";
+ print_r ( $e );
+
+ }
+?>
diff --git a/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php b/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php
new file mode 100644
index 0000000000..32159ddc16
--- /dev/null
+++ b/cpp/sca/samples/CppBigBank/bigbank.phpwsclient/bigwelcome.php
@@ -0,0 +1,44 @@
+<html>
+<!--
+ 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: 2005/12/22 11:33:21 $
+-->
+<head>
+ <title>BigBank Sample</title>
+</head>
+
+<body BGCOLOR="#EFEFEF">
+
+<script type="text/javascript"></script>
+
+<?php
+define('APP_ROOT', $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].'/bigbank.phpwsclient');
+?>
+
+<h1>Welcome To The BigBank Sample</h1>
+
+ <form action="http://<?php echo APP_ROOT . '/bigaccount.php' ?>" method="POST">
+ Please enter your account ID
+ <input type="text" name="accountname" size="30" value="ED" />
+ <button type="submit">GetAccount</button>
+ </form>
+
+ <div id="statusString"/>
+</body>
+</html>