diff options
Diffstat (limited to 'sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client')
6 files changed, 218 insertions, 0 deletions
diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/CalculatorClient.cpp b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/CalculatorClient.cpp new file mode 100644 index 0000000000..e72b52f87e --- /dev/null +++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/CalculatorClient.cpp @@ -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$ */ + +// some strangeness in the build that causes +// WinSock.h and WinSock2.h to be included leading to redefinitions +//#define _WINSOCKAPI_ + + +#include <iostream> + +#include <php_embed.h> + +#include <string> + +#include "commonj/sdo/SDO.h" + +#include "osoa/sca/sca.h" + +#include "Calculator.h" + + +using namespace std; +using namespace commonj::sdo; +using namespace osoa::sca; + + +int main (int argc, char** argv) +{ + + try + { + CompositeContext myContext = CompositeContext::getCurrent(); + Calculator *calcService = (Calculator*) myContext.locateService("CalculatorCPPComponent/CalculatorService"); + float result = calcService->div(10, 2); + cout << "calculator_client: div(10,2) = " << result << endl; + } + catch (...) + { + printf("Got and exception"); + } + + return 0; +} diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/CalculatorClient.php b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/CalculatorClient.php new file mode 100644 index 0000000000..7a512260ae --- /dev/null +++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/CalculatorClient.php @@ -0,0 +1,32 @@ +<?php +# 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. +# +# + +include 'SCA/SCA.php'; + +// Get a proxy to the local Calculator.php +$service = SCA::getService('../sample.calculator/Calculator.php'); + +// Call the local service and write out the response +echo "add(1.23, 4.56) = " . $service->add(1.23, 4.56) . "\n"; +echo "sub(1.23, 4.56) = " . $service->sub(1.23, 4.56) . "\n"; +echo "mul(1.23, 4.56) = " . $service->mul(1.23, 4.56) . "\n"; +echo "div(1.23, 4.56) = " . $service->div(1.23, 4.56) . "\n"; + +?> diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/env.sh b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/env.sh new file mode 100755 index 0000000000..de34f1b42a --- /dev/null +++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/env.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# 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. + +export AXIS2C_HOME=/home/slaws/apps/axis2c-bin-0.96-linux + +export LIBXML2_LIB=/usr/lib +export LIBXML2_INCLUDE=/usr/include/libxml2 + +export PHP_LIB=/usr/local/lib +export PHP_INCLUDE=/usr/local/include/php + +export PHP_SCA_SDO_INCLUDE=/home/slaws/phpbuild-5-2/pecl/SDO +export PHP_SCA_SDO_LIB=$PHP_LIB/php/extensions/no-debug-zts-20060613/ + +export TUSCANY_SDOCPP=/sdo/deploy +export TUSCANY_SCACPP=/usr/local/tuscany/cpp/sca/deploy + +export LD_LIBRARY_PATH=$LIBXML2_LIB:\ +$AXIS2C_HOME/lib:\ +$PHP_LIB:\ +$TUSCANY_SDOCPP/lib:\ +$TUSCANY_SCACPP/lib:\ +$TUSCANY_SCACPP/extensions/cpp/lib:\ +$TUSCANY_SCACPP/extensions/php/lib:\ +$TUSCANY_SCACPP/extensions/ws/lib:\ +$TUSCANY_SCACPP/samples/PHPCalculator/deploy/sample.calculator:\ +$PHP_SCA_SDO_LIB + +export TUSCANY_SCACPP_LOGGING=9 +export TUSCANY_SCACPP_ROOT=/usr/local/tuscany/cpp/sca/deploy/samples/PHPCalculator + +export PATH=.:$PATH diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_cpp.bat b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_cpp.bat new file mode 100644 index 0000000000..0493d7410d --- /dev/null +++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_cpp.bat @@ -0,0 +1,26 @@ +@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.
+
+set TUSCANY_SCACPP_ROOT=%TUSCANY_SCACPP%\samples\PHPCalculator\deploy
+set TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent
+set TUSCANY_SCACPP_LOGGING=9
+set PHRC=C:\simon\Projects\Tuscany\php\php-5.2.0\Debug_TS
+
+calculator_client.exe
+
diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_cpp.sh b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_cpp.sh new file mode 100755 index 0000000000..85a472b7fb --- /dev/null +++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_cpp.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# 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. + +export TUSCANY_SCACPP_ROOT=/usr/local/tuscany/cpp/sca/deploy/samples/PHPCalculator +export TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent + +a.out +# gdb a.out +# strace a.out &> strace.txt +# valgrind a.out diff --git a/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_php.bat b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_php.bat new file mode 100644 index 0000000000..815c4fb58e --- /dev/null +++ b/sca-cpp/branches/cpp-contrib/contrib/samples/PHPCalculator/sample.calculator.client/runclient_php.bat @@ -0,0 +1,25 @@ +@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 + +php TuscanyTest.php + +:end +endlocal |