summaryrefslogtreecommitdiffstats
path: root/sca-cpp/branches/cpp-M1/sca/samples/Calculator
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/branches/cpp-M1/sca/samples/Calculator')
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Calculator.h31
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Calculator.wsdl161
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.componentType30
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.cpp85
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.h37
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorDivideService_Proxy.cpp64
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorDivideService_Proxy.h38
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Proxy.cpp97
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Proxy.h41
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Wrapper.cpp94
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Wrapper.h40
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideService.h29
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.componentType10
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.cpp44
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.h34
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Proxy.cpp64
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Proxy.h38
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Wrapper.cpp73
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Wrapper.h40
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Makefile.am35
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Tuscany-model.config23
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/sca.module47
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/sca.module.lin42
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/services.xml42
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorSubsystem/sca.subsystem23
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Calc.cpp172
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Calculator.h32
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Makefile.am27
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/readme.txt64
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/runclient.cmd51
-rwxr-xr-xsca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/runclient.sh47
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/Makefile.am4
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/Calculator_Client.cpp181
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/Makefile.am24
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/axis2_Calculator_stub.cpp173
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/axis2_Calculator_stub.h80
-rw-r--r--sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/runwsclient.cmd28
-rwxr-xr-xsca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/runwsclient.sh30
38 files changed, 2175 insertions, 0 deletions
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Calculator.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Calculator.h
new file mode 100644
index 0000000000..6f30e31550
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Calculator.h
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.
+ */
+
+#ifndef CALCULATOR_H
+#define CALCULATOR_H
+class Calculator
+{
+public:
+ virtual float add(float arg1, float arg2) = 0;
+ virtual float sub(float arg1, float arg2) = 0;
+ virtual float mul(float arg1, float arg2) = 0;
+ virtual float div(float arg1, float arg2) = 0;
+};
+
+#endif
+
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Calculator.wsdl b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Calculator.wsdl
new file mode 100644
index 0000000000..6ec2df52bd
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Calculator.wsdl
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="tuscany/c/Calculator"
+ targetNamespace="tuscany/c/Calculator">
+ <types>
+ <xs:schema targetNamespace="tuscany/c/Calculator"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="tuscany/c/Calculator"
+ elementFormDefault="qualified">
+
+ <xs:element name="add">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param1" type="xs:float" minOccurs="1"/>
+ <xs:element name="param2" type="xs:float" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="sub">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param1" type="xs:float" minOccurs="1"/>
+ <xs:element name="param2" type="xs:float" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="mul">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param1" type="xs:float" minOccurs="1"/>
+ <xs:element name="param2" type="xs:float" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="div">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param1" type="xs:float" minOccurs="1"/>
+ <xs:element name="param2" type="xs:float" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+<!-- The data that axis2c math client expects to be returned. -->
+<!-- SDOCPP currently doesn't support this XML. Jira TUSCANY-xxx -->
+<!-- <xs:element name="result"> -->
+<!-- <xs:simpleType> -->
+<!-- <xs:restriction base="xs:float"/> -->
+<!-- </xs:simpleType> -->
+<!-- </xs:element> -->
+ <xs:element name="result">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="data" type="xs:float" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </xs:schema>
+ </types>
+
+ <message name="addRequestMsg">
+ <part name="body" element="tns:add"/>
+ </message>
+ <message name="subRequestMsg">
+ <part name="body" element="tns:sub"/>
+ </message>
+ <message name="mulRequestMsg">
+ <part name="body" element="tns:mul"/>
+ </message>
+ <message name="divRequestMsg">
+ <part name="body" element="tns:div"/>
+ </message>
+
+ <message name="calculatorResponseMsg">
+ <part name="body" element="tns:result"/>
+ </message>
+
+ <portType name="CalculatorServicePortType">
+ <operation name="add">
+ <input message="tns:addRequestMsg"/>
+ <output message="tns:calculatorResponseMsg"/>
+ </operation>
+ <operation name="sub">
+ <input message="tns:subRequestMsg"/>
+ <output message="tns:calculatorResponseMsg"/>
+ </operation>
+ <operation name="mul">
+ <input message="tns:mulRequestMsg"/>
+ <output message="tns:calculatorResponseMsg"/>
+ </operation>
+ <operation name="div">
+ <input message="tns:divRequestMsg"/>
+ <output message="tns:calculatorResponseMsg"/>
+ </operation>
+ </portType>
+
+ <binding name="CalculatorServiceBinding" type="tns:CalculatorServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="add">
+ <soap:operation soapAction="CalculatorService#add"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ <operation name="sub">
+ <soap:operation soapAction="CalculatorService#sub"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ <operation name="mul">
+ <soap:operation soapAction="CalculatorService#nul"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ <operation name="div">
+ <soap:operation soapAction="CalculatorService#div"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="CalculatorService">
+ <port name="CalculatorServicePort" binding="tns:CalculatorServiceBinding">
+ <soap:address location="http://localhost:9090/axis2/services/Calculator"/>
+ </port>
+ </service>
+</definitions>
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.componentType b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.componentType
new file mode 100644
index 0000000000..39d6698e02
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.componentType
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ 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.
+ -->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <service name="CalculatorService">
+ <interface.cpp header="Calculator.h"/>
+ </service>
+
+ <reference name="CalculatorDivideService">
+ <interface.cpp header="DivideService.h"/>
+ </reference>
+
+
+</componentType> \ No newline at end of file
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.cpp
new file mode 100644
index 0000000000..746a1db689
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.cpp
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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 "CalculatorImpl.h"
+#include <stdio.h>
+
+#include "DivideService.h"
+#include "osoa/sca/ComponentContext.h"
+#include "osoa/sca/ServiceRuntimeException.h"
+
+CalculatorImpl::CalculatorImpl()
+{
+}
+
+CalculatorImpl::~CalculatorImpl()
+{
+}
+
+// Calculator interface
+float CalculatorImpl::add(float arg1, float arg2)
+{
+ float result = arg1 + arg2;
+
+ printf("CalculatorImpl::add %f + %f = %f\n", arg1, arg2, result);
+ return result;
+}
+
+float CalculatorImpl::sub(float arg1, float arg2)
+{
+ float result = arg1 - arg2;
+ printf("CalculatorImpl::sub %f - %f = %f\n", arg1, arg2, result);
+ return result;
+}
+
+float CalculatorImpl::mul(float arg1, float arg2)
+{
+ float result = arg1 * arg2;
+ printf("CalculatorImpl::mul %f * %f = %f\n", arg1, arg2, result);
+ return result;
+}
+
+float CalculatorImpl::div(float arg1, float arg2)
+{
+ float result = 0;
+
+ // This method shows how to invoke a service on a different component from within a component
+
+ // First, get the current ComponentContext
+ osoa::sca::ComponentContext myContext = osoa::sca::ComponentContext::getCurrent();
+
+ try
+ {
+ // Find the required service, as referenced in CalculatorImpl.componentType
+ DivideService* divideService = (DivideService*)myContext.getService("CalculatorDivideService");
+
+ // Finally, invoke the service
+ result = divideService->divide(arg1, arg2);
+
+ printf("CalculatorImpl::div DivideService returned result: %f\n", result);
+
+ }
+ catch (osoa::sca::ServiceRuntimeException& e)
+ {
+ // Print out error message and carry on
+ printf("CalculatorImpl::div Error whilst invoking DivideService: %s", e.getMessageText());
+ }
+
+ return result;
+}
+
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.h
new file mode 100644
index 0000000000..2e4b6aa4dc
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl.h
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.
+ */
+
+#ifndef CALCULATORIMPL_H
+#define CALCULATORIMPL_H
+
+#include "Calculator.h"
+
+class CalculatorImpl : public Calculator
+{
+public:
+ CalculatorImpl();
+ virtual ~CalculatorImpl();
+
+ // Calculator interface
+ virtual float add(float arg1, float arg2);
+ virtual float sub(float arg1, float arg2);
+ virtual float mul(float arg1, float arg2);
+ virtual float div(float arg1, float arg2);
+};
+
+#endif
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorDivideService_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorDivideService_Proxy.cpp
new file mode 100644
index 0000000000..0ff0891406
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorDivideService_Proxy.cpp
@@ -0,0 +1,64 @@
+/*
+ * 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 "CalculatorImpl_CalculatorDivideService_Proxy.h"
+
+#include "osoa/sca/sca.h"
+using namespace osoa::sca;
+using namespace tuscany::sca;
+
+extern "C"
+{
+
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ CalculatorImpl_CalculatorDivideService_Proxy* CalculatorImpl_CalculatorDivideService_Proxy_Factory(ServiceWrapper* target)
+ {
+ return new CalculatorImpl_CalculatorDivideService_Proxy(target);
+ }
+
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ void CalculatorImpl_CalculatorDivideService_Proxy_Destructor(void* proxy)
+ {
+ delete (CalculatorImpl_CalculatorDivideService_Proxy*)proxy;
+ }
+}
+
+CalculatorImpl_CalculatorDivideService_Proxy::CalculatorImpl_CalculatorDivideService_Proxy(ServiceWrapper* targ) : target(targ)
+{
+}
+
+CalculatorImpl_CalculatorDivideService_Proxy::~CalculatorImpl_CalculatorDivideService_Proxy()
+{
+ if (target)
+ delete target;
+}
+
+float CalculatorImpl_CalculatorDivideService_Proxy::divide( float arg0, float arg1)
+{
+ Operation operation("divide");
+ operation.addParameter(&arg0);
+ operation.addParameter(&arg1);
+ float ret;
+ operation.setReturnValue(&ret);
+ target->invoke(operation);
+ return ret;
+}
+
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorDivideService_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorDivideService_Proxy.h
new file mode 100644
index 0000000000..3312005d32
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorDivideService_Proxy.h
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+#ifndef CalculatorImpl_CalculatorDivideService_Proxy_h
+#define CalculatorImpl_CalculatorDivideService_Proxy_h
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif
+
+#include "DivideService.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+
+class CalculatorImpl_CalculatorDivideService_Proxy : public DivideService
+{
+public:
+ CalculatorImpl_CalculatorDivideService_Proxy(tuscany::sca::ServiceWrapper*);
+ virtual ~CalculatorImpl_CalculatorDivideService_Proxy();
+ virtual float divide( float arg1, float arg2);
+private:
+ tuscany::sca::ServiceWrapper* target;
+};
+
+#endif // CalculatorImpl_CalculatorDivideService_Proxy_h
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Proxy.cpp
new file mode 100644
index 0000000000..c601ebcdc2
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Proxy.cpp
@@ -0,0 +1,97 @@
+/*
+ * 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 "CalculatorImpl_CalculatorService_Proxy.h"
+
+#include "osoa/sca/sca.h"
+using namespace osoa::sca;
+using namespace tuscany::sca;
+
+extern "C"
+{
+
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ CalculatorImpl_CalculatorService_Proxy* CalculatorImpl_CalculatorService_Proxy_Factory(ServiceWrapper* target)
+ {
+ return new CalculatorImpl_CalculatorService_Proxy(target);
+ }
+
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ void CalculatorImpl_CalculatorService_Proxy_Destructor(void* proxy)
+ {
+ delete (CalculatorImpl_CalculatorService_Proxy*)proxy;
+ }
+}
+
+CalculatorImpl_CalculatorService_Proxy::CalculatorImpl_CalculatorService_Proxy(ServiceWrapper* targ) : target(targ)
+{
+}
+
+CalculatorImpl_CalculatorService_Proxy::~CalculatorImpl_CalculatorService_Proxy()
+{
+ if (target)
+ delete target;
+}
+
+float CalculatorImpl_CalculatorService_Proxy::add( float arg0, float arg1)
+{
+ Operation operation("add");
+ operation.addParameter(&arg0);
+ operation.addParameter(&arg1);
+ float ret;
+ operation.setReturnValue(&ret);
+ target->invoke(operation);
+ return ret;
+}
+
+float CalculatorImpl_CalculatorService_Proxy::sub( float arg0, float arg1)
+{
+ Operation operation("sub");
+ operation.addParameter(&arg0);
+ operation.addParameter(&arg1);
+ float ret;
+ operation.setReturnValue(&ret);
+ target->invoke(operation);
+ return ret;
+}
+
+float CalculatorImpl_CalculatorService_Proxy::mul( float arg0, float arg1)
+{
+ Operation operation("mul");
+ operation.addParameter(&arg0);
+ operation.addParameter(&arg1);
+ float ret;
+ operation.setReturnValue(&ret);
+ target->invoke(operation);
+ return ret;
+}
+
+float CalculatorImpl_CalculatorService_Proxy::div( float arg0, float arg1)
+{
+ Operation operation("div");
+ operation.addParameter(&arg0);
+ operation.addParameter(&arg1);
+ float ret;
+ operation.setReturnValue(&ret);
+ target->invoke(operation);
+ return ret;
+}
+
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Proxy.h
new file mode 100644
index 0000000000..d3de5a79c6
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Proxy.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#ifndef CalculatorImpl_CalculatorService_Proxy_h
+#define CalculatorImpl_CalculatorService_Proxy_h
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif
+
+#include "Calculator.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+
+class CalculatorImpl_CalculatorService_Proxy : public Calculator
+{
+public:
+ CalculatorImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper*);
+ virtual ~CalculatorImpl_CalculatorService_Proxy();
+ virtual float add( float arg1, float arg2);
+ virtual float sub( float arg1, float arg2);
+ virtual float mul( float arg1, float arg2);
+ virtual float div( float arg1, float arg2);
+private:
+ tuscany::sca::ServiceWrapper* target;
+};
+
+#endif // CalculatorImpl_CalculatorService_Proxy_h
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Wrapper.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Wrapper.cpp
new file mode 100644
index 0000000000..97805d0e4b
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Wrapper.cpp
@@ -0,0 +1,94 @@
+/*
+ * 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 "CalculatorImpl_CalculatorService_Wrapper.h"
+
+#include "osoa/sca/sca.h"
+using namespace osoa::sca;
+using namespace tuscany::sca;
+
+
+
+extern "C"
+{
+
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ CalculatorImpl_CalculatorService_Wrapper* CalculatorImpl_CalculatorService_Wrapper_Factory(tuscany::sca::model::Service* target)
+ {
+ return new CalculatorImpl_CalculatorService_Wrapper(target);
+ }
+}
+
+CalculatorImpl_CalculatorService_Wrapper::CalculatorImpl_CalculatorService_Wrapper(Service* target) : ComponentServiceWrapper(target)
+{
+ impl = (CalculatorImpl*)getImplementation();
+}
+
+CalculatorImpl_CalculatorService_Wrapper::~CalculatorImpl_CalculatorService_Wrapper()
+{
+ releaseImplementation();
+}
+
+void* CalculatorImpl_CalculatorService_Wrapper::newImplementation()
+{
+ return new CalculatorImpl;
+}
+
+void CalculatorImpl_CalculatorService_Wrapper::deleteImplementation()
+{
+ delete impl;
+}
+
+void CalculatorImpl_CalculatorService_Wrapper::invokeService(Operation& operation)
+{
+ const string& operationName = operation.getName();
+
+ if (operationName == "add")
+ {
+ float& p0 = *( float*)operation.getParameterValue(0);
+ float& p1 = *( float*)operation.getParameterValue(1);
+ *(float*)operation.getReturnValue() = impl->add(p0, p1);
+ return;
+ }
+ if (operationName == "sub")
+ {
+ float& p0 = *( float*)operation.getParameterValue(0);
+ float& p1 = *( float*)operation.getParameterValue(1);
+ *(float*)operation.getReturnValue() = impl->sub(p0, p1);
+ return;
+ }
+ if (operationName == "mul")
+ {
+ float& p0 = *( float*)operation.getParameterValue(0);
+ float& p1 = *( float*)operation.getParameterValue(1);
+ *(float*)operation.getReturnValue() = impl->mul(p0, p1);
+ return;
+ }
+ if (operationName == "div")
+ {
+ float& p0 = *( float*)operation.getParameterValue(0);
+ float& p1 = *( float*)operation.getParameterValue(1);
+ *(float*)operation.getReturnValue() = impl->div(p0, p1);
+ return;
+ }
+
+
+ throw ServiceRuntimeException("Invalid operation");
+
+}
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Wrapper.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Wrapper.h
new file mode 100644
index 0000000000..c881576ca2
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/CalculatorImpl_CalculatorService_Wrapper.h
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+#ifndef CalculatorImpl_CalculatorService_Wrapper_h
+#define CalculatorImpl_CalculatorService_Wrapper_h
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif
+
+#include "CalculatorImpl.h"
+#include "tuscany/sca/core/ComponentServiceWrapper.h"
+
+class CalculatorImpl_CalculatorService_Wrapper : public tuscany::sca::ComponentServiceWrapper
+{
+public:
+ CalculatorImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target);
+ virtual ~CalculatorImpl_CalculatorService_Wrapper();
+ virtual void invokeService(tuscany::sca::Operation& operation);
+ virtual void* newImplementation();
+ virtual void deleteImplementation();
+private:
+ CalculatorImpl* impl;
+};
+
+#endif // CalculatorImpl_CalculatorService_Wrapper_h
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideService.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideService.h
new file mode 100644
index 0000000000..f6033c9020
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideService.h
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.
+ */
+
+
+#ifndef DIVIDESERVICE_H
+#define DIVIDESERVICE_H
+class DivideService
+{
+public:
+ virtual float divide(float arg1, float arg2) = 0;
+};
+
+#endif
+
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.componentType b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.componentType
new file mode 100644
index 0000000000..bda8aed044
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.componentType
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ASCII"?>
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <service name="DivideService">
+ <interface.cpp header="DivideService.h">
+ </interface.cpp>
+ </service>
+
+</componentType>
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.cpp
new file mode 100644
index 0000000000..4797498103
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.cpp
@@ -0,0 +1,44 @@
+/*
+ *
+ * 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 "DivideServiceImpl.h"
+#include <stdio.h>
+
+DivideServiceImpl::DivideServiceImpl()
+{
+}
+
+DivideServiceImpl::~DivideServiceImpl()
+{
+}
+
+// DivideService interface
+float DivideServiceImpl::divide(float arg1, float arg2)
+{
+ if(arg2 == 0.0)
+ {
+ printf("DivideServiceImpl::div %f / %f !! Cannot divide by zero, so returning 0\n", arg1, arg2);
+ return 0;
+ }
+
+ float result = arg1 / arg2;
+ printf("DivideServiceImpl::div %f / %f = %f\n", arg1, arg2, result);
+ return result;
+}
+
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.h
new file mode 100644
index 0000000000..00216b53b3
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl.h
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.
+ */
+
+#ifndef DIVIDESERVICEIMPL_H
+#define DIVIDESERVICEIMPL_H
+
+#include "DivideService.h"
+
+class DivideServiceImpl : public DivideService
+{
+public:
+ DivideServiceImpl();
+ virtual ~DivideServiceImpl();
+
+ // DivideService interface
+ virtual float divide(float arg1, float arg2);
+};
+
+#endif
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Proxy.cpp
new file mode 100644
index 0000000000..945f407327
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Proxy.cpp
@@ -0,0 +1,64 @@
+/*
+ * 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 "DivideServiceImpl_DivideService_Proxy.h"
+
+#include "osoa/sca/sca.h"
+using namespace osoa::sca;
+using namespace tuscany::sca;
+
+extern "C"
+{
+
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ DivideServiceImpl_DivideService_Proxy* DivideServiceImpl_DivideService_Proxy_Factory(ServiceWrapper* target)
+ {
+ return new DivideServiceImpl_DivideService_Proxy(target);
+ }
+
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ void DivideServiceImpl_DivideService_Proxy_Destructor(void* proxy)
+ {
+ delete (DivideServiceImpl_DivideService_Proxy*)proxy;
+ }
+}
+
+DivideServiceImpl_DivideService_Proxy::DivideServiceImpl_DivideService_Proxy(ServiceWrapper* targ) : target(targ)
+{
+}
+
+DivideServiceImpl_DivideService_Proxy::~DivideServiceImpl_DivideService_Proxy()
+{
+ if (target)
+ delete target;
+}
+
+float DivideServiceImpl_DivideService_Proxy::divide( float arg0, float arg1)
+{
+ Operation operation("divide");
+ operation.addParameter(&arg0);
+ operation.addParameter(&arg1);
+ float ret;
+ operation.setReturnValue(&ret);
+ target->invoke(operation);
+ return ret;
+}
+
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Proxy.h
new file mode 100644
index 0000000000..957ad43168
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Proxy.h
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+#ifndef DivideServiceImpl_DivideService_Proxy_h
+#define DivideServiceImpl_DivideService_Proxy_h
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif
+
+#include "DivideService.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+
+class DivideServiceImpl_DivideService_Proxy : public DivideService
+{
+public:
+ DivideServiceImpl_DivideService_Proxy(tuscany::sca::ServiceWrapper*);
+ virtual ~DivideServiceImpl_DivideService_Proxy();
+ virtual float divide( float arg1, float arg2);
+private:
+ tuscany::sca::ServiceWrapper* target;
+};
+
+#endif // DivideServiceImpl_DivideService_Proxy_h
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Wrapper.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Wrapper.cpp
new file mode 100644
index 0000000000..4257caa46c
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Wrapper.cpp
@@ -0,0 +1,73 @@
+/*
+ * 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 "DivideServiceImpl_DivideService_Wrapper.h"
+
+#include "osoa/sca/sca.h"
+using namespace osoa::sca;
+using namespace tuscany::sca;
+
+
+
+extern "C"
+{
+
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ DivideServiceImpl_DivideService_Wrapper* DivideServiceImpl_DivideService_Wrapper_Factory(tuscany::sca::model::Service* target)
+ {
+ return new DivideServiceImpl_DivideService_Wrapper(target);
+ }
+}
+
+DivideServiceImpl_DivideService_Wrapper::DivideServiceImpl_DivideService_Wrapper(Service* target) : ComponentServiceWrapper(target)
+{
+ impl = (DivideServiceImpl*)getImplementation();
+}
+
+DivideServiceImpl_DivideService_Wrapper::~DivideServiceImpl_DivideService_Wrapper()
+{
+ releaseImplementation();
+}
+
+void* DivideServiceImpl_DivideService_Wrapper::newImplementation()
+{
+ return new DivideServiceImpl;
+}
+
+void DivideServiceImpl_DivideService_Wrapper::deleteImplementation()
+{
+ delete impl;
+}
+
+void DivideServiceImpl_DivideService_Wrapper::invokeService(Operation& operation)
+{
+ const string& operationName = operation.getName();
+
+ if (operationName == "divide")
+ {
+ float& p0 = *( float*)operation.getParameterValue(0);
+ float& p1 = *( float*)operation.getParameterValue(1);
+ *(float*)operation.getReturnValue() = impl->divide(p0, p1);
+ return;
+ }
+
+
+ throw ServiceRuntimeException("Invalid operation");
+
+}
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Wrapper.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Wrapper.h
new file mode 100644
index 0000000000..9be9796ee2
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/DivideServiceImpl_DivideService_Wrapper.h
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+#ifndef DivideServiceImpl_DivideService_Wrapper_h
+#define DivideServiceImpl_DivideService_Wrapper_h
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif
+
+#include "DivideServiceImpl.h"
+#include "tuscany/sca/core/ComponentServiceWrapper.h"
+
+class DivideServiceImpl_DivideService_Wrapper : public tuscany::sca::ComponentServiceWrapper
+{
+public:
+ DivideServiceImpl_DivideService_Wrapper(tuscany::sca::model::Service* target);
+ virtual ~DivideServiceImpl_DivideService_Wrapper();
+ virtual void invokeService(tuscany::sca::Operation& operation);
+ virtual void* newImplementation();
+ virtual void deleteImplementation();
+private:
+ DivideServiceImpl* impl;
+};
+
+#endif // DivideServiceImpl_DivideService_Wrapper_h
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Makefile.am b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Makefile.am
new file mode 100644
index 0000000000..aff769b36a
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Makefile.am
@@ -0,0 +1,35 @@
+deploydir=$(prefix)/samples/Calculator/deploy
+moduledir=$(deploydir)/modules/CalculatorModule
+
+BUILT_SOURCES = CalculatorImpl_CalculatorService_Proxy.cpp \
+CalculatorImpl_CalculatorService_Wrapper.cpp \
+CalculatorImpl_CalculatorDivideService_Proxy.cpp \
+DivideServiceImpl_DivideService_Proxy.cpp \
+DivideServiceImpl_DivideService_Wrapper.cpp
+
+noinst_HEADERS = *.h
+
+CalculatorImpl_CalculatorService_Proxy.cpp:
+ java -jar $(TUSCANY_SCACPP)/bin/scagen.jar -dir . -output .
+
+module_LTLIBRARIES = libCalculatorModule.la
+module_DATA = sca.module.lin Tuscany-model.config *.componentType *.wsdl services.xml
+EXTRA_DIST = sca.module.lin Tuscany-model.config *.componentType *.wsdl services.xml
+
+libCalculatorModule_la_SOURCES = \
+CalculatorImpl.cpp \
+CalculatorImpl_CalculatorService_Proxy.cpp \
+CalculatorImpl_CalculatorService_Wrapper.cpp \
+CalculatorImpl_CalculatorDivideService_Proxy.cpp \
+DivideServiceImpl.cpp \
+DivideServiceImpl_DivideService_Proxy.cpp \
+DivideServiceImpl_DivideService_Wrapper.cpp
+
+libCalculatorModule_la_LIBADD = -L${TUSCANY_SCACPP}/lib -ltuscany_sca
+
+INCLUDES = \
+ -I$(TUSCANY_SCACPP)/include \
+ -I${TUSCANY_SDOCPP}/include
+
+install-data-hook:
+ mv $(moduledir)/sca.module.lin $(moduledir)/sca.module \ No newline at end of file
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Tuscany-model.config b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Tuscany-model.config
new file mode 100644
index 0000000000..b8f96a01a1
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/Tuscany-model.config
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ 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.
+ -->
+
+<tuscany-model xmlns="http://org.apache.tuscany/xmlns/cpp/1.0">
+ <wsdl>
+ <file name="Calculator.wsdl"/>
+ </wsdl>
+ <xsd/>
+</tuscany-model>
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/sca.module b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/sca.module
new file mode 100644
index 0000000000..e07fbeb9e2
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/sca.module
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ 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.
+ -->
+
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ xmlns:cs="tuscany/c/Calculator/"
+ name="CalculatorModule">
+
+ <!-- Expose as a web service -->
+ <entryPoint name="WSCalculatorEntrypoint" multiplicity="1..1">
+ <interface.wsdl interface="Calculator.wsdl" callbackInterface=""></interface.wsdl>
+ <binding.ws port="tuscany/c/Calculator#wsdl.endpoint(CalculatorService/CalculatorServicePort)"></binding.ws>
+ <reference>CalculatorServiceComponent</reference>
+ </entryPoint>
+
+
+ <component name="CalculatorServiceComponent">
+ <implementation.cpp dll="Calculator.dll" header="CalculatorImpl.h"></implementation.cpp>
+ <properties> </properties>
+ <references>
+ <v:CalculatorDivideService>DivideServiceComponent/DivideService</v:CalculatorDivideService>
+ </references>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.cpp dll="Calculator.dll" header="DivideServiceImpl.h"></implementation.cpp>
+ <properties> </properties>
+ <references> </references>
+ </component>
+
+
+
+</module> \ No newline at end of file
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/sca.module.lin b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/sca.module.lin
new file mode 100644
index 0000000000..4bd96ac774
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/sca.module.lin
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ 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.
+ -->
+
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="CalculatorModule">
+
+ <!-- Expose as a web service -->
+ <entryPoint name="WSCalculatorEntrypoint" multiplicity="1..1">
+ <interface.wsdl interface="Calculator.wsdl" callbackInterface=""></interface.wsdl>
+ <binding.ws port="tuscany/c/Calculator#wsdl.endpoint(CalculatorService/CalculatorServicePort)"></binding.ws>
+ <reference>CalculatorServiceComponent</reference>
+ </entryPoint>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.cpp dll="libCalculatorModule.so" header="CalculatorImpl.h"></implementation.cpp>
+ <properties> </properties>
+ <references>
+ <v:CalculatorDivideService>DivideServiceComponent/DivideService</v:CalculatorDivideService>
+ </references>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.cpp dll="libCalculatorModule.so" header="DivideServiceImpl.h"></implementation.cpp>
+ <properties> </properties>
+ <references> </references>
+ </component>
+</module> \ No newline at end of file
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/services.xml b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/services.xml
new file mode 100644
index 0000000000..b5f234e988
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorModule/services.xml
@@ -0,0 +1,42 @@
+
+<!--
+ 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.
+ -->
+<service name="Calculator">
+ <parameter name="ServiceClass" locked="xsd:false">tuscany_sca_ws_service</parameter>
+ <parameter name="TuscanySystemRoot" locked="xsd:false">PATH-TO-THE-SYSTEM-ROOT</parameter>
+ <parameter name="TuscanyEntryPoint" locked="xsd:false">CalculatorSubsystem/CalculatorService/WSCalculatorEntrypoint</parameter>
+
+ <description>
+ This is a testing service, named 'Calculator' to test multiple operations in the same service
+ </description>
+
+ <operation name="add">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+
+ <operation name="sub">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+
+ <operation name="mul">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+
+ <operation name="div">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+
+</service>
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorSubsystem/sca.subsystem b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorSubsystem/sca.subsystem
new file mode 100644
index 0000000000..4b9fdd1511
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/CalculatorSubsystem/sca.subsystem
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ 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.
+ -->
+
+<subsystem xmlns="http://www.osoa.org/xmlns/sca/0.9" name="CalculatorSubsystem">
+
+ <moduleComponent name="CalculatorService" module="CalculatorModule" />
+
+</subsystem>
+ \ No newline at end of file
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Calc.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Calc.cpp
new file mode 100644
index 0000000000..124cf96c63
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Calc.cpp
@@ -0,0 +1,172 @@
+/*
+ *
+ * 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 "Calculator.h"
+#include "osoa/sca/sca.h"
+using namespace osoa::sca;
+using namespace std;
+#include "tuscany/sca/core/TuscanyRuntime.h"
+using namespace tuscany::sca;
+
+#include <iostream>
+#include <stdlib.h>
+using namespace std;
+
+
+void usage();
+bool IsNumber(const char *p);
+
+int main(int argc, char* argv[])
+{
+ const char *operation;
+ float arg1 = 0;
+ float arg2 = 0;
+
+ if (argc == 4)
+ {
+ operation = argv[1];
+
+ if (!IsNumber(argv[2]))
+ {
+ cout << "Calc.exe: Argument 1 is not a number" << endl;
+ usage();
+ }
+ else
+ {
+ arg1 = atof(argv[2]);
+ }
+
+ if (!IsNumber(argv[3]))
+ {
+ cout << "Calc.exe: Argument 2 is not a number" << endl;
+ usage();
+ }
+ else
+ {
+ arg2 = atof(argv[3]);
+ }
+ }
+ else
+ {
+ usage();
+ }
+
+ try
+ {
+ // Set the default module environment variable: <subsystem>/<moduleName>
+ string systemRoot = getenv("TUSCANY_SCACPP");
+ if (systemRoot == "")
+ {
+ cout << "TUSCANY_SCACPP environment variable not set" <<endl;
+ return -1;
+ }
+ systemRoot += "/../samples/Calculator/deploy";
+
+ char *defaultModule = "CalculatorSubsystem/CalculatorService";
+
+// TuscanyRuntime rt;
+// rt.setSystemRoot(systemRoot);
+// rt.setDefaultModuleComponent(defaultModule);
+// rt.start();
+
+ // Locate a service
+ ModuleContext myContext = ModuleContext::getCurrent();
+ Calculator *calcService = (Calculator*) myContext.locateService("CalculatorServiceComponent");
+ if (calcService == 0)
+ {
+ cout << "Calc.exe: Unable to find Calculator service" << endl;
+ }
+ else
+ {
+ try
+ {
+ float result = 0;
+ if (strcmp(operation, "add") == 0)
+ {
+ result = calcService->add(arg1, arg2);
+ cout << "Calculator: add(" << arg1 << "," << arg2 << ") = " << result << endl;
+ }
+ else
+ if (strcmp(operation, "sub") == 0)
+ {
+ result = calcService->sub(arg1, arg2);
+ cout << "Calculator: sub(" << arg1 << "," << arg2 << ") = " << result << endl;
+ }
+ else
+ if (strcmp(operation, "mul") == 0)
+ {
+ result = calcService->mul(arg1, arg2);
+ cout << "Calculator: mul(" << arg1 << "," << arg2 << ") = " << result << endl;
+ }
+ else
+ if (strcmp(operation, "div") == 0)
+ {
+ result = calcService->div(arg1, arg2);
+ cout << "Calculator: div(" << arg1 << "," << arg2 << ") = " << result << endl;
+ }
+ else
+ {
+ cout << "Calculator: Unrecognized operation: " << operation << endl;
+ }
+ }
+ catch (char* x)
+ {
+ cout << "Calc.exe: exception caught: " << x << endl;
+ }
+ }
+
+ }
+ catch (ServiceRuntimeException& ex)
+ {
+ cout << ex << endl;
+ }
+ return 0;
+}
+
+void usage()
+{
+ cout << "Usage: calc add|sub|mul|div arg1 arg2" << endl;
+ exit(1);
+}
+
+bool IsNumber (const char *p)
+{
+ int len = strlen(p);
+ int pointcount = 0;
+
+ if (!isdigit (p[0]) && p[0] != '-' && p[0] != '+')
+ {
+ return false;
+ }
+ for (int i = 1; i < len; i++)
+ {
+ if (!isdigit (p[i]))
+ {
+ if (p[i] == '.')
+ {
+ if (pointcount > 0) return false;
+ pointcount++;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Calculator.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Calculator.h
new file mode 100644
index 0000000000..57975548c1
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Calculator.h
@@ -0,0 +1,32 @@
+/*
+ *
+ * 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.
+ */
+
+
+#ifndef CALCULATOR_H
+#define CALCULATOR_H
+class Calculator
+{
+public:
+ virtual float add(float arg1, float arg2) = 0;
+ virtual float sub(float arg1, float arg2) = 0;
+ virtual float mul(float arg1, float arg2) = 0;
+ virtual float div(float arg1, float arg2) = 0;
+};
+
+#endif
+
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Makefile.am b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Makefile.am
new file mode 100644
index 0000000000..75052b5bc0
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/Makefile.am
@@ -0,0 +1,27 @@
+deploydir=$(prefix)/samples/Calculator/deploy
+prgbindir=$(deploydir)/bin
+
+prgbin_PROGRAMS = calculator_client
+prgbin_SCRIPTS = runclient.sh
+EXTRA_DIST = runclient.sh
+
+AM_CPPFLAGS = $(CPPFLAGS)
+calculator_client_SOURCES = Calc.cpp
+
+calculator_client_LDADD = -L${TUSCANY_SCACPP}/lib -ltuscany_sca -ltuscany_sca_ws_reference \
+ -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -ltuscany_sdo_axiom \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom \
+ -laxis2_wsdl \
+ -laxis2_engine \
+ -laxis2_parser \
+ -laxis2_minizip \
+ -lpthread \
+ -laxis2_http_sender \
+ -laxis2_http_receiver
+
+
+INCLUDES = -I$(top_builddir)/Calculator/CalculatorModule \
+ -I${TUSCANY_SCACPP}/include \
+ -I${TUSCANY_SDOCPP}/include
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/readme.txt b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/readme.txt
new file mode 100644
index 0000000000..62672483af
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/readme.txt
@@ -0,0 +1,64 @@
+Tuscany SCA for C++ Samples - Calculator Sample
+===============================================
+
+This is a very simple sample to show how an SCA module with a single component
+can be built and called from an executable.
+
+There are three sub projects in this workspace:
+ - CalculatorModule
+ This contains the source code and SCA artifacts for the SCA module. This
+ is the module that will be deployed into the SCA runtime.
+ - CalculatorSubsystem
+ This contains the sca.subsystem file which describes a subsystem to the
+ SCA runtime.
+ - Client
+ An example client which will call the service exposed by the single component
+ in the CalculatorModule.
+
+
+Build instructions
+------------------
+
+Notes:
+
+The projects are set up to locate SCA and SDO libraries using the environment variables
+TUSCANY_SCACPP and TUSCANY_SDOCPP. These must be set before building.
+
+scagan is a code generation tool written in java. This will need to be built before you
+can run it. To build scagen, you must go to the tools/scagen directory, and type "ant".
+(You must have apache ant installed, and have a valid java virtual machine installed -
+upwards of version 1.4.2). Once scagen has successfully built, it can be run from the
+sca/bin directory.
+
+1) Build the SCA module.
+ - Set CalculatorModule project as the active project.
+ Right click->Set as active project
+
+ - Run the SCA generation tool to create the proxy and wrapper classes.
+ Either Tools->SCA Gen if you have added SCA Gen as an external tool
+ Or run from the command line:
+ scagen -dir <projectDirectory> -output <projectDirectory>
+ where the projectDirectory is the directory with the sca.module file.
+
+ - Rebuild All
+ Build->Rebuild All
+
+2) Package and deploy the SCA module
+ - There is a script file in the sca/samples/Calculator directory which will
+ copy across all the files needed for deployment to the Tuscany runtime.
+ On a command line run pack_deploy.cmd
+ As a default, the sample will be copied to sca/samples/runtime directory
+ Both the SCA module and the subsystem will be copied.
+
+3) Build the client
+ - Set the Client project as the active project.
+ Right click->Set as active project
+
+ - Rebuild All
+ Build->Rebuild All
+
+4) Run the client
+ - Use the command file in the sca/samples/Calculator/Client directory to run the
+ client. This command file will set the SCA environment variables before running
+ the client. For example,
+ runclient add 4 9
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/runclient.cmd b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/runclient.cmd
new file mode 100644
index 0000000000..1758d12ef5
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/runclient.cmd
@@ -0,0 +1,51 @@
+@echo off
+
+
+@REM Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM 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, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+
+rem Runs the client after setting the SCA environment variables to use the
+rem CalculatorSubsystem
+setlocal
+
+if "%AXIS2C_HOME%" == "" (
+echo "AXIS2C_HOME not set"
+goto end
+)
+echo using Axis2C: %AXIS2C_HOME%
+
+if "%TUSCANY_SDOCPP%" == "" (
+echo "TUSCANY_SDOCPP not set"
+goto end
+)
+echo using TUSCANY_SDOCPP: %TUSCANY_SDOCPP%
+
+if "%TUSCANY_SCACPP%" == "" (
+echo "TUSCANY_SCACPP not set"
+goto end
+)
+echo using TUSCANY_SCACPP: %TUSCANY_SCACPP%
+
+set TUSCANY_SCACPP_SYSTEM_ROOT=%~d0%~p0\..\
+
+rem Only need to specify the subsystem (and not the moduleComponent as well) because
+rem there is only one moduleComponent in the subsystem - it is a very simple sample.
+set TUSCANY_SCACPP_DEFAULT_MODULE=CalculatorSubsystem
+
+rem Run the client
+
+set PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SDOCPP%\bin;%AXIS2C_HOME%\lib;%PATH%
+Client.exe %*
+:end
+endlocal
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/runclient.sh b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/runclient.sh
new file mode 100755
index 0000000000..4dfea2f4a8
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Client/runclient.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# 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.
+
+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"
+
+TEST_SYSTEM=$APFULLDIR/../
+
+export LD_LIBRARY_PATH=$TUSCANY_SCACPP/lib:$TUSCANY_SDOCPP/lib:$AXIS2C_HOME/lib:$LD_LIBRARY_PATH
+
+export TUSCANY_SCACPP_SYSTEM_ROOT=$TEST_SYSTEM
+export TUSCANY_SCACPP_DEFAULT_MODULE=CalculatorSubsystem
+
+./calculator_client add 4.7 9
+./calculator_client div 7.2 3.6
+./calculator_client mul 7 6
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Makefile.am b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Makefile.am
new file mode 100644
index 0000000000..cbeaeb0f96
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/Makefile.am
@@ -0,0 +1,4 @@
+deploydir=$(prefix)/samples/Calculator/deploy/subsystems/CalculatorSubsystem
+SUBDIRS = CalculatorModule Client WSClient
+EXTRA_DIST = CalculatorSubsystem
+deploy_DATA = CalculatorSubsystem/sca.subsystem \ No newline at end of file
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/Calculator_Client.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/Calculator_Client.cpp
new file mode 100644
index 0000000000..5d6cd9e1bb
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/Calculator_Client.cpp
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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 "axis2_Calculator_stub.h"
+#include <stdio.h>
+#include <axiom.h>
+#include <axis2_util.h>
+#include <axiom_soap.h>
+#include <axis2_client.h>
+
+axiom_node_t *
+build_om_programatically(const axis2_env_t *env,
+ const axis2_char_t *operation,
+ const axis2_char_t *param1,
+ const axis2_char_t *param2);
+
+int main(int argc, char** argv)
+{
+ axis2_stub_t *stub = NULL;
+ axiom_node_t *node = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ const axis2_env_t *env = NULL;
+ const axis2_char_t *address = NULL;
+ const axis2_char_t *client_home = NULL;
+ axiom_node_t *ret_node = NULL;
+
+ const axis2_char_t *operation = "add";
+ const axis2_char_t *param1 = "40";
+ const axis2_char_t *param2 = "8";
+
+ env = axis2_env_create_all( "Calculator_blocking.log", AXIS2_LOG_LEVEL_TRACE);
+
+ client_home = AXIS2_GETENV("AXIS2C_HOME");
+ if (!client_home)
+ client_home = "../../deploy";
+
+ address = "http://localhost:9090/axis2/services/Calculator";
+ if (argc > 1 )
+ operation = argv[1];
+ if (AXIS2_STRCMP(operation, "-h") == 0)
+ {
+ printf("Usage : %s [operation] [param1] [param2] [endpoint_url]\n", argv[0]);
+ printf("use -h for help\n");
+ printf("default operation add\n");
+ printf("default param1 %s\n", param1);
+ printf("default param2 %s\n", param2);
+ printf("default endpoint_url %s\n", address);
+ printf("NOTE: command line arguments must appear in given order, with trailing ones being optional\n");
+ return 0;
+ }
+ if (argc > 2 )
+ param1 = argv[2];
+ if (argc > 3 )
+ param2 = argv[3];
+ if (argc > 4 )
+ address = argv[4];
+
+ printf ("Using endpoint : %s\n", address);
+ printf ("\nInvoking operation %s with params %s and %s\n", operation, param1, param2);
+
+ node = build_om_programatically(env, operation, param1, param2);
+ stub =
+ axis2_Calculator_stub_create_with_endpoint_uri_and_client_home(env, address, client_home);
+ /* create node and invoke Calculator */
+ ret_node = axis2_Calculator_stub_add(stub, env, node);
+ if(ret_node)
+ {
+ axis2_char_t *om_str = NULL;
+ om_str = AXIOM_NODE_TO_STRING(ret_node, env);
+ if(om_str)
+ {
+ printf("\nOM returned = %s\n", om_str);
+ }
+
+ if (AXIOM_NODE_GET_NODE_TYPE(ret_node, env) == AXIOM_ELEMENT)
+ {
+ axis2_char_t *result = NULL;
+ axiom_node_t *result_node = (axiom_node_t*)AXIOM_NODE_GET_FIRST_CHILD(ret_node, env);
+ axiom_element_t *data_ele = (axiom_element_t*)AXIOM_NODE_GET_DATA_ELEMENT(result_node, env);
+
+ result = AXIOM_ELEMENT_GET_TEXT(data_ele, env, result_node);
+ printf( "\nResult = %s\n", result);
+ }
+ else
+ {
+ axiom_xml_writer_t *writer = NULL;
+ axiom_output_t *om_output = NULL;
+ axis2_char_t *buffer = NULL;
+ writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ om_output = axiom_output_create (env, writer);
+
+ AXIOM_NODE_SERIALIZE (ret_node, env, om_output);
+ buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(writer, env);
+ printf ("\nReceived invalid OM as result : %s\n", buffer);
+ if(NULL != buffer)
+ {
+ AXIS2_FREE(env->allocator, buffer);
+ buffer = NULL;
+ }
+ if(NULL != om_output)
+ {
+ AXIOM_OUTPUT_FREE(om_output, env);
+ om_output = NULL;
+ }
+ }
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+ " %d :: %s", env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(env->error));
+ printf("Calculator stub invoke FAILED!\n");
+ }
+ if (stub)
+ {
+ AXIS2_STUB_FREE(stub, env);
+ }
+ return status;
+}
+
+axiom_node_t *
+build_om_programatically(const axis2_env_t *env,
+ const axis2_char_t *operation,
+ const axis2_char_t *param1,
+ const axis2_char_t *param2)
+{
+ axiom_node_t *Calculator_om_node = NULL;
+ axiom_element_t* Calculator_om_ele = NULL;
+ axiom_node_t* text_om_node = NULL;
+ axiom_element_t * text_om_ele = NULL;
+ axiom_namespace_t *ns1 = NULL;
+
+
+ axiom_xml_writer_t *xml_writer = NULL;
+ axiom_output_t *om_output = NULL;
+ axis2_char_t *buffer = NULL;
+
+ ns1 = axiom_namespace_create (env, "tuscany/c/Calculator", "ns1");
+
+ Calculator_om_ele = axiom_element_create(env, NULL, operation, ns1, &Calculator_om_node);
+
+ text_om_ele = axiom_element_create(env, Calculator_om_node, "param1", NULL, &text_om_node);
+ AXIOM_ELEMENT_SET_TEXT(text_om_ele, env, param1, text_om_node);
+
+ text_om_ele = axiom_element_create(env, Calculator_om_node, "param2", NULL, &text_om_node);
+ AXIOM_ELEMENT_SET_TEXT(text_om_ele, env, param2, text_om_node);
+
+ xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_FALSE, AXIS2_FALSE,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ om_output = axiom_output_create( env, xml_writer);
+
+ AXIOM_NODE_SERIALIZE(Calculator_om_node, env, om_output);
+ buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(xml_writer, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "\nSending OM node in XML : %s \n", buffer);
+ if(NULL != buffer)
+ {
+ AXIS2_FREE(env->allocator, buffer);
+ buffer = NULL;
+ }
+ if(NULL != om_output)
+ {
+ AXIOM_OUTPUT_FREE(om_output, env);
+ om_output = NULL;
+ }
+
+ return Calculator_om_node;
+}
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/Makefile.am b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/Makefile.am
new file mode 100644
index 0000000000..706c0927b5
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/Makefile.am
@@ -0,0 +1,24 @@
+deploydir=$(prefix)/samples/Calculator/deploy
+prgbindir=$(deploydir)/bin
+
+prgbin_PROGRAMS = calculator_wsclient
+prgbin_SCRIPTS = runwsclient.sh
+EXTRA_DIST = runwsclient.sh
+
+AM_CPPFLAGS = $(CPPFLAGS)
+calculator_wsclient_SOURCES = axis2_Calculator_stub.cpp Calculator_Client.cpp
+noinst_HEADERS = *.h
+
+calculator_wsclient_LDADD = -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom \
+ -laxis2_wsdl \
+ -laxis2_engine \
+ -laxis2_parser \
+ -laxis2_minizip \
+ -lpthread \
+ -laxis2_http_sender \
+ -laxis2_http_receiver
+
+
+INCLUDES = -I${AXIS2C_HOME}/include
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/axis2_Calculator_stub.cpp b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/axis2_Calculator_stub.cpp
new file mode 100644
index 0000000000..8455c0d209
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/axis2_Calculator_stub.cpp
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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 "axis2_Calculator_stub.h"
+
+
+axis2_stub_t *
+axis2_Calculator_stub_create_with_endpoint_ref_and_client_home(const axis2_env_t *env,
+ axis2_endpoint_ref_t *endpoint_ref,
+ axis2_char_t *client_home)
+{
+ axis2_stub_t *stub = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ stub = (axis2_stub_t *)
+ axis2_stub_create_with_endpoint_ref_and_client_home(env, endpoint_ref,
+ client_home);
+ if(NULL == stub)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NO_MEMORY, (axis2_status_codes)AXIS2_FAILURE);
+ return NULL;
+ }
+ axis2_populate_axis_service( stub, env);
+ return stub;
+}
+
+void axis2_populate_axis_service( axis2_stub_t* stub, const axis2_env_t *env)
+{
+ axis2_svc_client_t* svc_client = NULL;
+ axis2_qname_t *op_qname = NULL;
+ axis2_svc_t* svc = NULL;
+ axis2_op_t* op = NULL;
+
+ /*Modifying the Service*/
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT (stub, env );
+ svc = (axis2_svc_t*)AXIS2_SVC_CLIENT_GET_AXIS_SERVICE ( svc_client, env );
+
+ /*creating the operations*/
+
+ op_qname = axis2_qname_create(env,"add" , "", NULL);
+ op = axis2_op_create_with_qname(env, op_qname);
+ AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+ AXIS2_SVC_ADD_OP(svc, env, op);
+
+ op_qname = axis2_qname_create(env,"sub" , "", NULL);
+ op = axis2_op_create_with_qname(env, op_qname);
+ AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+ AXIS2_SVC_ADD_OP(svc, env, op);
+
+ op_qname = axis2_qname_create(env,"mul" , "", NULL);
+ op = axis2_op_create_with_qname(env, op_qname);
+ AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+ AXIS2_SVC_ADD_OP(svc, env, op);
+
+ op_qname = axis2_qname_create(env,"div" , "", NULL);
+ op = axis2_op_create_with_qname(env, op_qname);
+ AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, env, AXIS2_MEP_URI_OUT_IN);
+ AXIS2_SVC_ADD_OP(svc, env, op);
+}
+
+axis2_stub_t *
+axis2_Calculator_stub_create_with_endpoint_uri_and_client_home(const axis2_env_t *env,
+ const axis2_char_t *endpoint_uri,
+ const axis2_char_t *client_home)
+{
+ axis2_stub_t *stub = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ stub = (axis2_stub_t *)
+ axis2_stub_create_with_endpoint_uri_and_client_home(env, endpoint_uri,
+ client_home);
+ if(NULL == stub)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NO_MEMORY, (axis2_status_codes)AXIS2_FAILURE);
+ return NULL;
+ }
+
+ axis2_populate_axis_service( stub, env);
+
+ return stub;
+}
+
+/***************************Function implementation****************************/
+
+axiom_node_t *
+axis2_Calculator_stub_add(axis2_stub_t *stub,
+ const axis2_env_t *env,
+ axiom_node_t *node)
+{
+ axis2_svc_client_t *svc_client = NULL;
+ axiom_node_t *ret_node = NULL;
+ axis2_qname_t *op_qname = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT(stub, env);
+ op_qname = axis2_qname_create(env, "add" , "", NULL);
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, node);
+
+ return ret_node;
+}
+
+axiom_node_t *
+axis2_Calculator_stub_sub(axis2_stub_t *stub,
+ const axis2_env_t *env,
+ axiom_node_t *node)
+{
+ axis2_svc_client_t *svc_client = NULL;
+ axiom_node_t *ret_node = NULL;
+ axis2_qname_t *op_qname = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT(stub, env);
+ op_qname = axis2_qname_create(env, "sub" , "", NULL);
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, node);
+
+ return ret_node;
+}
+
+axiom_node_t *
+axis2_Calculator_stub_mul(axis2_stub_t *stub,
+ const axis2_env_t *env,
+ axiom_node_t *node)
+{
+ axis2_svc_client_t *svc_client = NULL;
+ axiom_node_t *ret_node = NULL;
+ axis2_qname_t *op_qname = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT(stub, env);
+ op_qname = axis2_qname_create(env, "mul" , "", NULL);
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, node);
+
+ return ret_node;
+}
+
+axiom_node_t *
+axis2_Calculator_stub_div(axis2_stub_t *stub,
+ const axis2_env_t *env,
+ axiom_node_t *node)
+{
+ axis2_svc_client_t *svc_client = NULL;
+ axiom_node_t *ret_node = NULL;
+ axis2_qname_t *op_qname = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ svc_client = AXIS2_STUB_GET_SVC_CLIENT(stub, env);
+ op_qname = axis2_qname_create(env, "div" , "", NULL);
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OP_QNAME( svc_client, env, op_qname, node);
+
+ return ret_node;
+}
+
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/axis2_Calculator_stub.h b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/axis2_Calculator_stub.h
new file mode 100644
index 0000000000..54cce17562
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/axis2_Calculator_stub.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+#ifndef AXIS2_ECHO_STUB_H
+#define AXIS2_ECHO_STUB_H
+
+/**
+ * @file axis2_Calculator_stub.h
+ * @brief axis2 Calculator stub interface
+ */
+
+#include <axis2_stub.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+axiom_node_t *
+axis2_Calculator_stub_add(axis2_stub_t *stub,
+ const axis2_env_t *env,
+ axiom_node_t *node);
+
+axiom_node_t *
+axis2_Calculator_stub_sub(axis2_stub_t *stub,
+ const axis2_env_t *env,
+ axiom_node_t *node);
+
+axiom_node_t *
+axis2_Calculator_stub_mul(axis2_stub_t *stub,
+ const axis2_env_t *env,
+ axiom_node_t *node);
+
+axiom_node_t *
+axis2_Calculator_stub_div(axis2_stub_t *stub,
+ const axis2_env_t *env,
+ axiom_node_t *node);
+/**
+ * populate services
+ */
+void axis2_populate_axis_service( axis2_stub_t* stub, const axis2_env_t *env);
+
+/**
+ * Creates axis2_stub struct
+ * @param endpoint reference
+ * @return pointer to newly created axis2_stub struct
+ */
+axis2_stub_t *
+axis2_Calculator_stub_create_with_endpoint_ref_and_client_home(const axis2_env_t *env,
+ axis2_endpoint_ref_t *endpoint_ref,
+ axis2_char_t *client_home);
+
+/**
+ * Creates axis2_stub struct
+ * @param endpoint uri
+ * @return pointer to newly created axis2_stub struct
+ */
+axis2_stub_t *
+axis2_Calculator_stub_create_with_endpoint_uri_and_client_home(const axis2_env_t *env,
+ const axis2_char_t *endpoint_uri,
+ const axis2_char_t *client_home);
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* AXIS2_ECHO_STUB_H */
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/runwsclient.cmd b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/runwsclient.cmd
new file mode 100644
index 0000000000..ba387a4bab
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/runwsclient.cmd
@@ -0,0 +1,28 @@
+@echo off
+
+@REM Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM 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, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+
+setlocal
+
+if "%AXIS2C_HOME%" == "" (
+echo "AXIS2C_HOME not set"
+goto end
+)
+echo using Axis2C: %AXIS2C_HOME%"
+
+rem Run the client
+WSClient.exe %*
+:end
+endlocal
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/runwsclient.sh b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/runwsclient.sh
new file mode 100755
index 0000000000..2e8e79fc9c
--- /dev/null
+++ b/sca-cpp/branches/cpp-M1/sca/samples/Calculator/WSClient/runwsclient.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# 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.
+
+APFULLDIR=`pwd`
+
+if [ x$AXIS2C_HOME = x ]; then
+echo "AXIS2C_HOME not set"
+exit;
+fi
+echo "Using Axis2C installed at $AXIS2C_HOME"
+
+export LD_LIBRARY_PATH=$AXIS2C_HOME/lib:$LD_LIBRARY_PATH
+
+./calculator_wsclient add 4.7 9
+./calculator_wsclient div 7.2 3.6
+./calculator_wsclient mul 7 6
+