summaryrefslogtreecommitdiffstats
path: root/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws')
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/Makefile.am23
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/deploy.bat45
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/Makefile.am18
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/Makefile.am18
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/Makefile.am49
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp717
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.h67
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp108
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.h75
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp110
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.h67
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.cpp134
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.h137
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/deploy.bat65
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/Makefile.am18
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/Makefile.am18
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/Makefile.am86
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/axis2.xml181
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/deploy.cmd39
-rwxr-xr-xtags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/deploy.sh47
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/module.xml25
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/services.xml25
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Dispatcher.cpp176
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2DispatcherModule.cpp149
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp506
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp72
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.h46
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp108
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.h74
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp587
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h96
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.cpp139
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.h153
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/deploy.bat73
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/deploymodule.bat69
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/xsd/sca-binding-webservice.xsd55
36 files changed, 4375 insertions, 0 deletions
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/Makefile.am b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/Makefile.am
new file mode 100644
index 0000000000..806786ce04
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/Makefile.am
@@ -0,0 +1,23 @@
+# 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.
+
+SUBDIRS = reference service
+datadir=$(prefix)/extensions/ws
+
+nobase_data_DATA = xsd/*.xsd
+
+EXTRA_DIST = xsd
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/deploy.bat b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/deploy.bat
new file mode 100644
index 0000000000..567875624f
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/deploy.bat
@@ -0,0 +1,45 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sca root not specified
+goto usage
+)
+set rootdir=%1
+set deploydir=%rootdir%\deploy
+set extdir=%deploydir%\extensions
+set wsextdir=%extdir%\ws
+set srcdir=%rootdir%\runtime\extensions\ws
+
+if not exist %deploydir% mkdir %deploydir%
+if not exist %extdir% mkdir %extdir%
+if not exist %wsextdir% mkdir %wsextdir%
+if not exist %wsextdir%\xsd mkdir %wsextdir%\xsd
+
+copy %srcdir%\xsd\*.* %wsextdir%\xsd
+
+goto end
+:usage
+echo Usage: deploy <sca-root>
+:end
+
+endlocal
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/Makefile.am b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/Makefile.am
new file mode 100644
index 0000000000..18e9ba89b9
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/Makefile.am
@@ -0,0 +1,18 @@
+# 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.
+
+SUBDIRS = axis2c
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/Makefile.am b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/Makefile.am
new file mode 100644
index 0000000000..2b9491ec1c
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/Makefile.am
@@ -0,0 +1,18 @@
+# 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.
+
+SUBDIRS = src
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/Makefile.am b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/Makefile.am
new file mode 100644
index 0000000000..208af0e15a
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/Makefile.am
@@ -0,0 +1,49 @@
+# 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.
+
+libdir=$(prefix)/extensions/ws/reference/lib
+lib_LTLIBRARIES = libtuscany_sca_ws_reference.la
+
+noinst_HEADERS = tuscany/sca/ws/*.h tuscany/sca/ws/model/*.h
+
+libtuscany_sca_ws_reference_la_SOURCES = \
+tuscany/sca/ws/WSServiceBindingExtension.cpp \
+tuscany/sca/ws/model/WSServiceBinding.cpp \
+tuscany/sca/ws/WSServiceWrapper.cpp \
+tuscany/sca/ws/Axis2Client.cpp
+
+libtuscany_sca_ws_reference_la_LIBADD = \
+ -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -ltuscany_sdo_axiom \
+ -L$(top_builddir)/runtime/core/src -ltuscany_sca \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom \
+ -laxis2_wsdl \
+ -laxis2_engine \
+ -laxis2_parser \
+ -laxis2_minizip \
+ -lpthread \
+ -lwoden \
+ -laxis2_http_sender \
+ -laxis2_http_receiver
+
+INCLUDES = -I$(top_builddir)/runtime/core/src \
+ -I${TUSCANY_SDOCPP}/include \
+ -I${AXIS2C_HOME}/include
+
+AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG
+
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp
new file mode 100644
index 0000000000..4dfb3e7efd
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp
@@ -0,0 +1,717 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4091)
+#pragma warning(disable: 4786)
+#endif
+
+#include <axis2_client.h>
+
+#include <axis2_error_default.h>
+#include <axis2_log_default.h>
+#include <axis2_defines.h>
+#include <axiom_soap_const.h>
+#include <platforms/axis2_platform_auto_sense.h>
+
+#include <sdo_axiom.h>
+#include "Axis2Client.h"
+
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "model/WSServiceBinding.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/util/Exceptions.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/WSDLDefinition.h"
+#include "tuscany/sca/model/WSDLInterface.h"
+#include "tuscany/sca/model/WSDLOperation.h"
+
+#include <sstream>
+
+using namespace tuscany::sca::ws;
+
+
+using namespace commonj::sdo;
+using namespace commonj::sdo_axiom;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ Axis2Client::Axis2Client(CompositeReference* compositeReference)
+ : compositeReference(compositeReference)
+ {
+ }
+
+ Axis2Client::~Axis2Client()
+ {
+ }
+
+ void Axis2Client::invoke(tuscany::sca::Operation& operation)
+ {
+ LOGENTRY(1, "Axis2Client::invoke");
+
+ // Initialize Axis2 stuff
+ axis2_allocator_t *allocator = axis2_allocator_init (NULL);
+ axis2_log_t *log = axis2_log_create(allocator, NULL, "tuscany_client.log");
+ axis2_error_t *error = axis2_error_create(allocator);
+ axis2_env_t *env = axis2_env_create_with_error_log(allocator, error, log);
+ env->log->level = AXIS2_LOG_LEVEL_TRACE;
+ axis2_error_init();
+
+ // Get the WS service binding and WSDLOperation
+ Composite* composite=compositeReference->getComposite();
+ Service* service = compositeReference->getService();
+ WSServiceBinding* binding = (WSServiceBinding *)service->getBinding();
+ const string& operationName = operation.getName();
+ WSDLOperation wsdlOperation;
+
+ // Get the WSDL namespace
+ string wsdlNamespace = binding->getWSDLNamespaceURL();
+ if (wsdlNamespace != "")
+ {
+
+ // Lookup the wsdl model from the composite, keyed on the namespace
+ // (the wsdl will have been loaded at startup)
+ WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(wsdlNamespace);
+ if (wsdlDefinition == 0)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "WSDL description %s not found\n", wsdlNamespace.c_str());
+ string msg = "WSDL not found for " + wsdlNamespace;
+ throw SystemConfigurationException(msg.c_str());
+ }
+
+ // Match the operation in Operation to the operation in the wsdl port type.
+ try
+ {
+ wsdlOperation = wsdlDefinition->findOperation(
+ binding->getServiceName(),
+ binding->getEndpointName(),
+ operationName);
+ }
+ catch(SystemConfigurationException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
+ throw;
+ }
+
+ }
+ else
+ {
+ Interface* iface = service->getType()->getInterface();
+ if (iface != NULL &&
+ iface->getInterfaceTypeQName() == WSDLInterface::typeQName)
+ {
+ WSDLInterface* wsdlInterface = (WSDLInterface*)iface;
+ wsdlNamespace = wsdlInterface->getNamespaceURI();
+
+ if (wsdlNamespace != "")
+ {
+
+ WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace);
+ if (wsdl == 0)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "WSDL description %s not found\n", wsdlNamespace.c_str());
+ string msg = "WSDL not found for " + wsdlNamespace;
+ throw SystemConfigurationException(msg.c_str());
+ }
+
+ try
+ {
+ wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), operationName);
+ }
+ catch(SystemConfigurationException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
+ throw;
+ }
+ }
+ }
+ }
+
+ if (wsdlNamespace == "")
+ {
+
+ // Create a default document literal wrapped WSDL operation
+ wsdlNamespace = compositeReference->getName();
+ wsdlOperation = WSDLOperation();
+ wsdlOperation.setOperationName(operationName);
+ wsdlOperation.setSoapAction(wsdlNamespace+ "#" +operationName);
+ wsdlOperation.setEndpoint("");
+ wsdlOperation.setSoapVersion(WSDLOperation::SOAP11);
+ wsdlOperation.setDocumentStyle(true);
+ wsdlOperation.setWrappedStyle(true);
+ wsdlOperation.setEncoded(false);
+ wsdlOperation.setInputType(wsdlNamespace + "#" + operationName);
+ wsdlOperation.setOutputType(wsdlNamespace + "#" + operationName + "Response");
+ }
+
+ // Get the target endpoint address
+ // The URI specified in the binding overrides the address specified in
+ // the WSDL
+ axis2_char_t* address;
+ if (binding->getURI() != "")
+ {
+ address = (axis2_char_t*)binding->getURI().c_str();
+ }
+ else
+ {
+ address = (axis2_char_t*)wsdlOperation.getEndpoint().c_str();
+ }
+
+ axis2_char_t* opName = (axis2_char_t*)operationName.c_str();
+ axis2_char_t* soap_action = (axis2_char_t*)wsdlOperation.getSoapAction().c_str();
+ axis2_char_t* serviceName = (axis2_char_t*)binding->getServiceName().c_str();
+
+ // create OM from Operation and wsdlOperation
+ axiom_node_t* payload = createPayload(operation, wsdlOperation, env);
+
+ /* Create EPR with given address */
+ axis2_endpoint_ref_t* endpoint_ref = axis2_endpoint_ref_create(env, address);
+
+ /* Setup options */
+ axis2_options_t* options = axis2_options_create(env);
+ AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref);
+ int soap_version = AXIOM_SOAP11;
+ if (binding->getSOAPVersion() == "1.2")
+ {
+ soap_version = AXIOM_SOAP12;
+ }
+ else
+ {
+ if (wsdlOperation.getSoapVersion() == WSDLOperation::SOAP12)
+ {
+ soap_version = AXIOM_SOAP12;
+ }
+ }
+
+ AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, soap_version);
+ AXIS2_OPTIONS_SET_ACTION(options, env, soap_action);
+
+ /* Create service client */
+
+ axis2_char_t* client_home = AXIS2_GETENV("AXIS2C_HOME");
+ if (!client_home)
+ {
+ throw SystemConfigurationException("Environment error: AXIS2C_HOME not set");
+ }
+ axis2_svc_client_t* svc_client = axis2_svc_client_create(env, client_home);
+ if (!svc_client)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "invoke FAILED: Error code:"
+ " %d :: %s", env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(env->error));
+
+ throw SystemConfigurationException("Axis2Client: axis2_svc_client_create failed");
+ }
+
+ /* Set service client options */
+ AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options);
+
+ /* Send request */
+ axiom_node_t* ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
+ if(ret_node)
+ {
+ setReturn(ret_node, operation, wsdlOperation, env);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invoke failed: Error code:"
+ " %d :: %s", env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(env->error));
+ throw SystemConfigurationException("Axis2Client: Invoke failed");
+ }
+
+ LOGINFO(2, "Warning: Have not freed Axis2C service client memory due to Jira AXIS2C-209");
+ // Uncommenting this code causes crash when invoking a composite with both Axis2C ws.binding
+ // service and reference. See Jiras TUSCANY-536 and AXIS2C-209
+ //if (svc_client)
+ //{
+ // AXIS2_SVC_CLIENT_FREE(svc_client, env);
+ // svc_client = NULL;
+ //}
+
+ LOGEXIT(1, "Axis2Client::invoke");
+ }
+
+ axiom_node_t* Axis2Client::createPayload(Operation& operation,
+ const WSDLOperation& wsdlOperation,
+ axis2_env_t* env)
+ {
+ LOGENTRY(1, "Axis2Client::createPayload");
+ axiom_node_t* request_node = NULL;
+
+ // map the operation request to the wsdl
+ if (wsdlOperation.isDocumentStyle())
+ {
+ // Document style
+ // only support single part messages - WS-I compliant
+
+ // Build up the payload as an SDO
+
+ // Get the data factory for the composite (it will already have the typecreates loaded for the xsds)
+ DataFactoryPtr dataFactory = compositeReference->getComposite()->getDataFactory();
+
+ DataObjectPtr inputDataObject;
+ try
+ {
+
+ // Create the input wrapper
+ const Type& rootType = dataFactory->getType(wsdlOperation.getInputTypeUri().c_str(), "RootType");
+ const Property& prop = rootType.getProperty(wsdlOperation.getInputTypeName().c_str());
+ const Type& inputType = prop.getType();
+ inputDataObject = dataFactory->create(inputType);
+ }
+ catch (SDORuntimeException e)
+ {
+ try
+ {
+ // Create the input wrapper
+ const Type& inputType = dataFactory->getType(wsdlOperation.getInputTypeUri().c_str(),
+ wsdlOperation.getInputTypeName().c_str());
+ inputDataObject = dataFactory->create(inputType);
+ }
+ catch (SDORuntimeException e2)
+ {
+
+ // The input wrapper type is not known, create an open DataObject
+ inputDataObject = dataFactory->create(Type::SDOTypeNamespaceURI, "OpenDataObject");
+ }
+ }
+
+ // Go through data object to set the input parameters
+ PropertyList pl = inputDataObject->getType().getProperties();
+
+ if(pl.size() == 0)
+ {
+ if(inputDataObject->getType().isOpenType() && inputDataObject->getType().isDataObjectType())
+ {
+ /*
+ * This code deals with sending xsd:any elements
+ */
+ for (int i=0; i<operation.getNParms(); i++)
+ {
+ ostringstream pname;
+ pname << "param" << (i+1);
+ DataObjectList& l = inputDataObject->getList(pname.str());
+
+ const Operation::Parameter& parm = operation.getParameter(i);
+ switch(parm.getType())
+ {
+ case Operation::BOOL:
+ {
+ l.append(*(bool*)parm.getValue());
+ break;
+ }
+ case Operation::SHORT:
+ {
+ l.append(*(short*)parm.getValue());
+ break;
+ }
+ case Operation::INT:
+ {
+ l.append(*(long*)parm.getValue());
+ break;
+ }
+ case Operation::LONG:
+ {
+ l.append(*(long*)parm.getValue());
+ break;
+ }
+ case Operation::USHORT:
+ {
+ l.append(*(short*)parm.getValue());
+ break;
+ }
+ case Operation::UINT:
+ {
+ l.append(*(long*)parm.getValue());
+ break;
+ }
+ case Operation::ULONG:
+ {
+ l.append(*(long*)parm.getValue());
+ break;
+ }
+ case Operation::FLOAT:
+ {
+ l.append(*(float*)parm.getValue());
+ break;
+ }
+ case Operation::DOUBLE:
+ {
+ l.append(*(long double*)parm.getValue());
+ break;
+ }
+ case Operation::LONGDOUBLE:
+ {
+ l.append(*(long double*)parm.getValue());
+ break;
+ }
+ case Operation::CHARS:
+ {
+ l.append(*(char**)parm.getValue());
+ break;
+ }
+ case Operation::STRING:
+ {
+ l.append((*(string*)parm.getValue()).c_str());
+ break;
+ }
+ case Operation::DATAOBJECT:
+ {
+ l.append(*(DataObjectPtr*)parm.getValue());
+ break;
+ }
+ default: throw "unsupported parameter type";
+ }
+ }
+ }
+ }
+ else {
+
+ // Each parameter in the operation should be a property on the request dataobject
+ for (int i=0; i<operation.getNParms(); i++)
+ {
+ const Operation::Parameter& parm = operation.getParameter(i);
+ switch(parm.getType())
+ {
+ case Operation::BOOL:
+ {
+ inputDataObject->setBoolean(i, *(bool*)parm.getValue());
+ break;
+ }
+ case Operation::SHORT:
+ {
+ inputDataObject->setShort(i, *(short*)parm.getValue());
+ break;
+ }
+ case Operation::INT:
+ {
+ inputDataObject->setInteger(i, *(int*)parm.getValue());
+ break;
+ }
+ case Operation::LONG:
+ {
+ inputDataObject->setLong(i, *(long*)parm.getValue());
+ break;
+ }
+ case Operation::USHORT:
+ {
+ inputDataObject->setInteger(i, *(unsigned short*)parm.getValue());
+ break;
+ }
+ case Operation::UINT:
+ {
+ inputDataObject->setInteger(i, *(unsigned int*)parm.getValue());
+ break;
+ }
+ case Operation::ULONG:
+ {
+ inputDataObject->setInteger(i, *(unsigned long*)parm.getValue());
+ break;
+ }
+ case Operation::FLOAT:
+ {
+ inputDataObject->setFloat(i, *(float*)parm.getValue());
+ break;
+ }
+ case Operation::DOUBLE:
+ {
+ inputDataObject->setDouble(i, *(double*)parm.getValue());
+ break;
+ }
+ case Operation::LONGDOUBLE:
+ {
+ inputDataObject->setDouble(i, *(long double*)parm.getValue());
+ break;
+ }
+ case Operation::CHARS:
+ {
+ inputDataObject->setCString(i, *(char**)parm.getValue());
+ break;
+ }
+ case Operation::STRING:
+ {
+ inputDataObject->setCString(i, (*(string*)parm.getValue()).c_str());
+ break;
+ }
+ case Operation::DATAOBJECT:
+ {
+ inputDataObject->setDataObject(i, *(DataObjectPtr*)parm.getValue());
+ break;
+ }
+ default: throw "unsupported parameter type";
+ }
+ }
+ }
+
+ // Create the Axiom object from the request dataobject
+ AxiomHelper* axiomHelper = AxiomHelper::getHelper();
+ request_node = axiomHelper->toAxiomNode(inputDataObject,
+ wsdlOperation.getInputTypeUri().c_str(), wsdlOperation.getInputTypeName().c_str());
+ AxiomHelper::releaseHelper(axiomHelper);
+ }
+ else
+ {
+ // RPC
+ }
+
+ char* str = AXIOM_NODE_TO_STRING(request_node, env);
+ LOGINFO_1(3, "Sending this OM node in XML : %s \n", str);
+
+ LOGEXIT(1, "Axis2Client::createPayload");
+ return request_node;
+ }
+
+ void Axis2Client::setReturn(axiom_node_t* ret_node,
+ Operation& operation,
+ const WSDLOperation& wsdlOperation,
+ axis2_env_t* env)
+ {
+ LOGENTRY(1, "Axis2Client::setReturn");
+
+ if (wsdlOperation.isDocumentStyle())
+ {
+ // Document style
+ DataFactoryPtr dataFactory = compositeReference->getComposite()->getDataFactory();
+
+ // Get the AXIOM node representing the SOAP Body
+ axiom_node_t* body = AXIOM_NODE_GET_PARENT(ret_node, env);
+
+ // Convert the AXIOM node to an SDO DataObject
+ char* str = NULL;
+ str = AXIOM_NODE_TO_STRING(body, env);
+ if (str)
+ {
+ AXIS2_LOG_INFO((env)->log, "Axis2Client invoke has response OM: %s\n", str);
+ }
+
+ // Convert the SOAP body to an SDO DataObject
+ AxiomHelper* axiomHelper = AxiomHelper::getHelper();
+ DataObjectPtr outputBodyDataObject = axiomHelper->toSdo(body, dataFactory);
+ AxiomHelper::releaseHelper(axiomHelper);
+
+ if(!outputBodyDataObject)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service invoke: Could not convert received Axiom node to SDO");
+ /** TODO: return a SOAP fault here */
+ return;
+ }
+
+ // Get the first body part representing the doc-lit-wrapped wrapper element
+ DataObjectPtr outputDataObject = NULL;
+ PropertyList bpl = outputBodyDataObject->getInstanceProperties();
+ if (bpl.size()!=0)
+ {
+ if (bpl[0].isMany())
+ {
+ DataObjectList& parts = outputBodyDataObject->getList((unsigned int)0);
+ outputDataObject = parts[0];
+ }
+ else
+ {
+ outputDataObject = outputBodyDataObject->getDataObject(bpl[0]);
+ }
+ }
+ if (outputDataObject == NULL)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Client invoke: Could not convert body part to SDO");
+ return;
+ }
+
+ PropertyList pl = outputDataObject->getInstanceProperties();
+ unsigned int i = 0;
+
+ switch(pl[i].getTypeEnum())
+ {
+ case Type::BooleanType:
+ {
+ bool* boolData = new bool;
+ *boolData = outputDataObject->getBoolean(pl[i]);
+ operation.setReturnValue(boolData);
+ }
+ break;
+ case Type::ByteType:
+ {
+ char* byteData = new char;
+ *byteData = outputDataObject->getByte(pl[i]);
+ operation.setReturnValue(byteData);
+ }
+ break;
+ case Type::BytesType:
+ {
+ int len = outputDataObject->getLength(pl[i]);
+ char* bytesData = new char[len+1];
+ int bytesWritten = outputDataObject->getBytes(pl[i], bytesData, len);
+ // Ensure the bytes end with the null char. Not sure if this is neccessary
+ if(bytesWritten <= len)
+ {
+ bytesData[bytesWritten] = 0;
+ }
+ else
+ {
+ bytesData[len] = 0;
+ }
+ //printf("outputDataObject has BytesType named %s with length %d\n", name, bytesWritten);
+ operation.setReturnValue(&bytesData);
+ }
+ break;
+ case Type::CharacterType:
+ {
+ // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType
+ wchar_t* charData = new wchar_t;
+ *charData = outputDataObject->getCharacter(pl[i]);
+ operation.setReturnValue(charData);
+ }
+ break;
+ case Type::DoubleType:
+ {
+ long double* doubleData = new long double;
+ *doubleData = outputDataObject->getDouble(pl[i]);
+ operation.setReturnValue(doubleData);
+ }
+ break;
+ case Type::FloatType:
+ {
+ float* floatData = new float;
+ *floatData = outputDataObject->getFloat(pl[i]);
+ operation.setReturnValue(floatData);
+ }
+ break;
+ case Type::IntegerType:
+ {
+ long* intData = new long;
+ *intData = outputDataObject->getInteger(pl[i]);
+ operation.setReturnValue(intData);
+ }
+ break;
+ case Type::ShortType:
+ {
+ short* shortData = new short;
+ *shortData = outputDataObject->getShort(pl[i]);
+ operation.setReturnValue(shortData);
+ }
+ break;
+ case Type::StringType:
+ {
+ string* str = new string(outputDataObject->getCString(pl[i]));
+ operation.setReturnValue(str);
+ }
+ break;
+ case Type::DataObjectType:
+ {
+ DataObjectPtr dataObjectData = outputDataObject->getDataObject(pl[i]);
+ if(!dataObjectData)
+ {
+ LOGINFO(4, "SDO DataObject return value was null");
+ }
+ operation.setReturnValue(&dataObjectData);
+ }
+ break;
+ case Type::OpenDataObjectType:
+ {
+ /*
+ * This code deals with xsd:any element parameters
+ */
+
+ DataObjectList& dataObjectList = outputDataObject->getList(pl[i]);
+
+ for(int j=0; j<dataObjectList.size(); j++)
+ {
+ DataObjectPtr dataObjectData = dataObjectList[j];
+ if(!dataObjectData)
+ {
+ operation.setReturnValue(&dataObjectData);
+ LOGINFO(4, "SDO OpenDataObject return value was null");
+ }
+ else
+ {
+
+ SequencePtr sequence = dataObjectData->getSequence();
+ if (sequence->size()!=0)
+ {
+ // Return a text element
+ if (sequence->isText(0))
+ {
+ string* stringData = new string(sequence->getCStringValue(0));
+ operation.setReturnValue(stringData);
+ }
+ else
+ {
+ // Return a DataObject representing a complex element
+ DataObjectPtr dob = sequence->getDataObjectValue(0);
+ if(!dob)
+ {
+ LOGINFO(4, "SDO DataObject return value was null");
+ }
+ operation.setReturnValue(&dob);
+ }
+ }
+ else
+ {
+ // Empty content, add an empty string
+ LOGINFO(4, "SDO OpenDataObject return value was empy");
+ string *stringData = new string("");
+ operation.setReturnValue(stringData);
+ }
+ }
+ }
+ }
+ break;
+ case Type::DateType:
+ LOGERROR(0, "SDO DateType return values are not yet supported");
+ break;
+ case Type::LongType:
+ LOGERROR(0, "SDO LongType (int64_t) return values are not yet supported");
+ break;
+ case Type::UriType:
+ LOGERROR(0, "SDO UriType return values are not yet supported");
+ break;
+ case Type::BigDecimalType:
+ LOGERROR(0, "SDO BigDecimalType return values are not yet supported");
+ break;
+ case Type::BigIntegerType:
+ LOGERROR(0, "SDO BigIntegerType return values are not yet supported");
+ break;
+ default:
+ LOGERROR(0, "Unknown SDO type has been found in return value. Unknown types are not yet supported");
+ break;
+ }
+ }
+ else
+ {
+ // RPC
+ }
+ LOGEXIT(1, "Axis2Client::setReturn");
+ }
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.h
new file mode 100644
index 0000000000..5ec302f0c8
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.h
@@ -0,0 +1,67 @@
+/*
+ * 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$ */
+
+
+#ifndef tuscany_sca_extension_ws_axis2client_h
+#define tuscany_sca_extension_ws_axis2client_h
+
+#include <axiom.h>
+
+#include "tuscany/sca/core/Operation.h"
+#include "tuscany/sca/model/CompositeReference.h"
+#include "tuscany/sca/model/WSDLOperation.h"
+
+using namespace tuscany::sca::model;
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ class Axis2Client
+ {
+ public:
+ Axis2Client(CompositeReference* externalService);
+ virtual ~Axis2Client();
+
+ virtual void invoke(Operation& operation);
+
+ private:
+ CompositeReference* compositeReference;
+
+ axiom_node_t* createPayload(Operation& operation,
+ const WSDLOperation& wsdlOp,
+ axis2_env_t* env);
+
+ void setReturn(axiom_node_t* returnNode,
+ Operation& operation,
+ const WSDLOperation& wsdlOp,
+ axis2_env_t* env);
+
+ };
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_extension_ws_axis2client_h
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp
new file mode 100644
index 0000000000..c260445b60
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "WSServiceBindingExtension.h"
+#include "model/WSServiceBinding.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/core/SCARuntime.h"
+
+extern "C"
+{
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ void tuscany_sca_extension_initialize()
+ {
+ tuscany::sca::ws::WSServiceBindingExtension::initialize();
+ }
+}
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+ // ===================================================================
+ // Constructor for the WSServiceBinding class.
+ // ===================================================================
+ WSServiceBindingExtension::WSServiceBindingExtension()
+ {
+ LOGENTRY(1, "WSServiceBindingExtension::constructor");
+ LOGEXIT(1, "WSServiceBindingExtension::constructor");
+ }
+
+ // ===================================================================
+ // Destructor for the WSServiceBindingExtension class.
+ // ===================================================================
+ WSServiceBindingExtension::~WSServiceBindingExtension()
+ {
+ LOGENTRY(1, "WSServiceBindingExtension::destructor");;
+ LOGEXIT(1, "WSServiceBindingExtension::destructor");
+ }
+
+ const string WSServiceBindingExtension::extensionName("ws");
+ const string WSServiceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding");
+
+
+ // ===================================================================
+ // loadModelElement - load the info from binding.ws
+ // ===================================================================
+ ServiceBinding* WSServiceBindingExtension::getServiceBinding(Composite *composite, Service* service, DataObjectPtr scdlBinding)
+ {
+ string bindingType = scdlBinding->getType().getName();
+ if (bindingType == "WebServiceBinding")
+ {
+ string uri = scdlBinding->getCString("uri");
+ string endpoint = scdlBinding->getCString("endpoint");
+ commonj::sdo::DataObjectList& soap = scdlBinding->getList("soapbinding");
+ string version;
+ if (soap.size()!=0)
+ {
+ version = soap.getCString(0);
+ }
+ else
+ {
+ version = "";
+ }
+
+ WSServiceBinding* serviceBinding = new WSServiceBinding(service, uri, endpoint, version);
+
+ return serviceBinding;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ void WSServiceBindingExtension::initialize()
+ {
+ LOGENTRY(1, "WSServiceBindingExtension::initialize");;
+ SCARuntime::getInstance()->registerServiceBindingExtension(new WSServiceBindingExtension());
+ LOGEXIT(1, "WSServiceBindingExtension::initialize");;
+ }
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.h
new file mode 100644
index 0000000000..db2c0c791f
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.h
@@ -0,0 +1,75 @@
+/*
+ * 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$ */
+
+
+#ifndef tuscany_sca_extension_ws_wsservicebindingextension_h
+#define tuscany_sca_extension_ws_wsservicebindingextension_h
+
+#include "tuscany/sca/extension/ServiceBindingExtension.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ class WSServiceBindingExtension : public ServiceBindingExtension
+ {
+ public:
+ /**
+ * Default constructor
+ */
+ WSServiceBindingExtension();
+
+ /**
+ * Destructor
+ */
+ virtual ~WSServiceBindingExtension();
+
+ /**
+ * return the name of the extension
+ */
+ virtual const string& getExtensionName() {return extensionName;}
+
+ /**
+ * return the QName of schema elemant for this implementation extension
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#binding.ws")
+ */
+ virtual const string& getExtensionTypeQName() {return typeQName;}
+
+ virtual ServiceBinding* getServiceBinding(Composite* composite, Service* service, DataObjectPtr scdlBinding);
+
+ static void initialize();
+
+ private:
+ static const string extensionName;
+ static const string typeQName;
+
+ };
+
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif //tuscany_sca_extension_ws_wsservicebindingextension_h
+
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp
new file mode 100644
index 0000000000..5839aa8722
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4091)
+#endif
+
+#include "tuscany/sca/util/Logging.h"
+#include "Axis2Client.h"
+#include "WSServiceWrapper.h"
+#include "tuscany/sca/core/Operation.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/ServiceType.h"
+
+#include "commonj/sdo/SDO.h"
+using namespace commonj::sdo;
+
+using namespace tuscany::sca;
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ WSServiceWrapper::WSServiceWrapper(Service* service) : ServiceWrapper(service)
+ {
+ // Define the SOAP Body type and element to allow a SOAP body to
+ // be loaded in a DataObject
+ DataFactoryPtr dataFactory = service->getComponent()->getComposite()->getDataFactory();
+ try {
+ const Type& bodyType = dataFactory->getType("http://www.w3.org/2003/05/soap-envelope", "Body");
+ } catch (SDORuntimeException e)
+ {
+ dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "RootType", false, false, false);
+ dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "Body", false, true, false);
+ dataFactory->addPropertyToType(
+ "http://www.w3.org/2003/05/soap-envelope", "RootType",
+ "Body",
+ "http://www.w3.org/2003/05/soap-envelope", "Body",
+ false, false, true);
+
+ dataFactory->addType("http://schemas.xmlsoap.org/soap/envelope/", "RootType", false, false, false);
+ dataFactory->addType("http://schemas.xmlsoap.org/soap/envelope/", "Body", false, true, false);
+ dataFactory->addPropertyToType(
+ "http://schemas.xmlsoap.org/soap/envelope/", "RootType",
+ "Body",
+ "http://schemas.xmlsoap.org/soap/envelope/", "Body",
+ false, false, true);
+ }
+ }
+
+ WSServiceWrapper::~WSServiceWrapper()
+ {
+ }
+
+ ///
+ /// This method will be called when a web service call needs to be made.
+ ///
+ void WSServiceWrapper::invoke(Operation& operation)
+ {
+ LOGENTRY(1, "WSServiceWrapper::invoke");
+
+ const string& operationName = operation.getName();
+
+ LOGINFO_2(2,"Service: %s, Operation: %s", getService()->getType()->getName().c_str() , operationName.c_str());
+
+ for (unsigned int i=0; i<operation.getNParms(); i++)
+ {
+ LOGINFO_2(2, "Parameter %p, Type %u", operation.getParameterValue(i),(int) operation.getParameterType(i));
+ }
+
+ // Create the Axis2 client that will handle the Web Service invocation
+ Service* service = getService();
+ CompositeReference* compositeReference = (CompositeReference*)service->getComponent();
+
+ Axis2Client client(compositeReference);
+ client.invoke(operation);
+
+ LOGEXIT(1, "WSServiceWrapper::invoke");
+ }
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
+
+
+
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.h
new file mode 100644
index 0000000000..93607db4a2
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.h
@@ -0,0 +1,67 @@
+/*
+ * 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$ */
+
+#ifndef tuscany_sca_extension_ws_wsservicewrapper_h
+#define tuscany_sca_extension_ws_wsservicewrapper_h
+
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/core/Operation.h"
+#include "tuscany/sca/model/Service.h"
+
+using namespace tuscany::sca::model;
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+
+ namespace ws
+ {
+
+ class WSServiceWrapper : public ServiceWrapper
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param target The service wrapper represents a Web service.
+ */
+ WSServiceWrapper(Service* service);
+
+ /**
+ * Destructor
+ */
+ virtual ~WSServiceWrapper();
+
+ /**
+ * All business method calls on the target service are performed through
+ * this invoke method.
+ * @param operation The details of the method, paramaters and return value for the
+ * business method to be called on the target service.
+ */
+ virtual void invoke(Operation& operation);
+ };
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_ws_wsservicewrapper_h
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.cpp
new file mode 100644
index 0000000000..8980ec489b
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.cpp
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/ws/model/WSServiceBinding.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/ws/WSServiceWrapper.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ // Constructor
+ WSServiceBinding::WSServiceBinding(Service* service, const string& uri, const string& endpoint, const string& version)
+ : ServiceBinding(service, uri), endpoint(endpoint), soapVersion(version)
+ {
+ parseEndpoint();
+
+ serviceWrapper = new WSServiceWrapper(service);
+ }
+
+ void WSServiceBinding::parseEndpoint()
+ {
+ // Endpoint is of the form: <wsdl-namepace-uri>#wsdl.endpoint(<service-name>/<endpoint-name>)
+ string::size_type hash = endpoint.find("#");
+ if (hash != string::npos)
+ {
+ // Found a hash
+
+ // Namepace is the part before the #
+ wsdlNamespaceURL = endpoint.substr(0, hash);
+
+
+ if ( (hash+1) < endpoint.length())
+ {
+ // Check the next part is wsdl.endpoint(
+ int ending = hash+15;
+ string check = endpoint.substr(hash+1, 14);
+ if (check.compare("wsdl.endpoint(") == 0)
+ {
+ // Find the matching )
+ int endBracket = endpoint.find(")",ending);
+ if (endBracket-1 > ending+1)
+ {
+ string serviceAndEndpoint = endpoint.substr(ending, endBracket-ending);
+ // Look for a '/'
+ string::size_type slash = serviceAndEndpoint.find("/");
+ if (slash != string::npos)
+ {
+ serviceName = serviceAndEndpoint.substr(0, slash);
+
+ if ( (slash+1) < serviceAndEndpoint.length())
+ {
+ endpointName = serviceAndEndpoint.substr(slash+1);
+ }
+ else
+ {
+ endpointName = "";
+ }
+
+ }
+ else
+ {
+ // No '/' so all of it is the service name
+ serviceName = serviceAndEndpoint;
+ endpointName = "";
+
+ }
+ }
+ else
+ {
+ // Nothing between the ()
+ serviceName = "";
+ endpointName = "";
+ }
+ }
+ else
+ {
+ // not the correct characters after the #, ignore the rest
+ serviceName = "";
+ endpointName = "";
+ }
+
+ }
+ else
+ {
+ // Nothing after the hash
+ serviceName = "";
+ endpointName = "";
+ }
+ }
+ else
+ {
+ // No hash at all
+ wsdlNamespaceURL = endpoint;
+ serviceName = "";
+ endpointName = "";
+ }
+ }
+
+ // Destructor
+ WSServiceBinding::~WSServiceBinding()
+ {
+ }
+
+ ServiceWrapper* WSServiceBinding::getServiceWrapper()
+ {
+ return serviceWrapper;
+ }
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.h
new file mode 100644
index 0000000000..15691ce6eb
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/model/WSServiceBinding.h
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_extension_ws_model_wsservicebinding_h
+#define tuscany_sca_extension_ws_model_wsservicebinding_h
+
+#include "tuscany/sca/model/ServiceBinding.h"
+#include "tuscany/sca/model/Service.h"
+
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+ /**
+ * Information about a web service binding for service or a reference.
+ */
+ class WSServiceBinding : public model::ServiceBinding
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param uri The uri of the binding.
+ * @param endpoint The definition of the endpoint to which the service
+ * or reference is to be bound. This is of the form
+ * "namespace"#endpoint("service"/"endpoint")
+ */
+ WSServiceBinding(model::Service* service, const string& uri, const string& endpoint, const string& version);
+
+ /**
+ * Destructor.
+ */
+ virtual ~WSServiceBinding();
+
+ /**
+ * Returns the type of binding.
+ */
+ virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"; };
+
+ /**
+ * Create a wrapper for the service configured by this
+ * binding.
+ */
+ virtual ServiceWrapper* getServiceWrapper();
+
+ /**
+ * Return the part of the endpoint definition describing the wsdl
+ * namespace.
+ * @return The wsdl namespace.
+ */
+ string getWSDLNamespaceURL() const { return wsdlNamespaceURL; };
+
+ /**
+ * Return the service part of the endpoint definition.
+ * @return The service to use.
+ */
+ string getServiceName() const { return serviceName; };
+
+ /**
+ * Return the endpoint name part of the endpoint definition.
+ * @return The endpoint name to use.
+ */
+ string getEndpointName() const { return endpointName; };
+
+ /**
+ * Return the SOAP version.
+ * @return The SOAP version to use.
+ */
+ string getSOAPVersion() const { return soapVersion; };
+
+ private:
+
+ /**
+ * Parse the endpoint specification.
+ */
+ void parseEndpoint();
+
+ /**
+ * The full endpoint string.
+ */
+ string endpoint;
+
+ /**
+ * Namespace from the endpoint.
+ */
+ string wsdlNamespaceURL;
+
+ /**
+ * Service name from the endpoint.
+ */
+ string serviceName;
+
+ /**
+ * WSDL Endpoint name.
+ */
+ string endpointName;
+
+ /**
+ * SOAP version.
+ */
+ string soapVersion;
+
+ /**
+ * The wrapper for the service configured by this binding.
+ */
+ ServiceWrapper* serviceWrapper;
+
+ };
+
+ } // End namespace model
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_extension_ws_model_wsservicebinding_h
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/deploy.bat b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/deploy.bat
new file mode 100644
index 0000000000..2bba10425c
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/reference/deploy.bat
@@ -0,0 +1,65 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sca root not specified
+goto usage
+)
+set rootdir=%1
+set deploydir=%rootdir%\deploy
+set extdir=%deploydir%\extensions
+set wsextdir=%extdir%\ws
+set refextdir=%wsextdir%\reference
+set srcdir=%rootdir%\runtime\extensions\ws\reference
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+call %srcdir%\..\deploy.bat %rootdir%
+
+if not exist %deploydir% mkdir %deploydir%
+if not exist %extdir% mkdir %extdir%
+if not exist %wsextdir% mkdir %wsextdir%
+if not exist %refextdir% mkdir %refextdir%
+if not exist %refextdir%\bin mkdir %refextdir%\bin
+if not exist %refextdir%\lib mkdir %refextdir%\lib
+
+set libname=tuscany_sca_ws_reference
+
+del %refextdir%\bin\%libname%.*
+del %refextdir%\lib\%libname%.*
+
+copy %inpath%\%libname%.lib %refextdir%\lib
+copy %inpath%\%libname%.dll %refextdir%\bin
+
+if exist %inpath%\%libname%.pdb copy %inpath%\%libname%.pdb %refextdir%\bin
+
+goto end
+:usage
+echo Usage: deploy <sca-root> <build-output>
+:end
+
+endlocal
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/Makefile.am b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/Makefile.am
new file mode 100644
index 0000000000..18e9ba89b9
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/Makefile.am
@@ -0,0 +1,18 @@
+# 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.
+
+SUBDIRS = axis2c
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/Makefile.am b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/Makefile.am
new file mode 100644
index 0000000000..feadf9e317
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/Makefile.am
@@ -0,0 +1,18 @@
+# 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.
+
+SUBDIRS = src \ No newline at end of file
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/Makefile.am b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/Makefile.am
new file mode 100644
index 0000000000..37ab185259
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/Makefile.am
@@ -0,0 +1,86 @@
+# 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.
+
+libdir=$(prefix)/extensions/ws/service/lib
+lib_LTLIBRARIES = \
+libtuscany_sca_ws_service.la \
+libtuscany_sca_ws_dispatcher.la
+
+noinst_HEADERS = \
+tuscany/sca/ws/*.h \
+tuscany/sca/ws/model/*.h
+
+libtuscany_sca_ws_service_la_SOURCES = \
+tuscany/sca/ws/WSReferenceBindingExtension.cpp \
+tuscany/sca/ws/model/WSReferenceBinding.cpp \
+tuscany/sca/ws/WSServiceProxy.cpp \
+tuscany/sca/ws/Axis2Service.cpp \
+tuscany/sca/ws/Axis2Utils.cpp
+
+libtuscany_sca_ws_service_la_LIBADD = \
+ -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -ltuscany_sdo_axiom \
+ -L$(top_builddir)/runtime/core/src -ltuscany_sca \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom \
+ -laxis2_wsdl \
+ -laxis2_engine \
+ -laxis2_parser \
+ -laxis2_minizip \
+ -lpthread \
+ -lwoden \
+ -laxis2_http_sender \
+ -laxis2_http_receiver
+
+rootdir=$(prefix)/extensions/ws/service
+root_DATA = axis2.xml
+root_SCRIPTS = deploy.sh
+
+libtuscany_sca_ws_dispatcher_la_SOURCES = \
+tuscany/sca/ws/Axis2Dispatcher.cpp \
+tuscany/sca/ws/Axis2DispatcherModule.cpp
+
+libtuscany_sca_ws_dispatcher_la_LIBADD = \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom \
+ -laxis2_wsdl \
+ -laxis2_engine \
+ -laxis2_parser \
+ -laxis2_minizip \
+ -lpthread \
+ -lwoden \
+ -laxis2_http_sender \
+ -laxis2_http_receiver
+
+servicedir=$(rootdir)/services/tuscany
+service_DATA = services.xml
+
+moduledir=$(rootdir)/modules/tuscany
+module_DATA = module.xml
+
+EXTRA_DIST = axis2.xml services.xml module.xml deploy.sh
+
+install-data-hook:
+ cd $(servicedir); ln -s -f ../../lib/libtuscany_sca_ws_service.so libtuscany_sca_ws_service.so
+ cd $(moduledir); ln -s -f ../../lib/libtuscany_sca_ws_dispatcher.so libtuscany_sca_ws_dispatcher.so
+
+INCLUDES = -I$(top_builddir)/runtime/core/src \
+ -I${TUSCANY_SDOCPP}/include \
+ -I${AXIS2C_HOME}/include
+
+AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/axis2.xml b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/axis2.xml
new file mode 100644
index 0000000000..641085466e
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/axis2.xml
@@ -0,0 +1,181 @@
+<!--
+ 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.
+-->
+<axisconfig name="Axis2/C">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment" locked="false">false</parameter>
+ <parameter name="hotupdate" locked="false">false</parameter>
+ <parameter name="enableMTOM" locked="false">false</parameter>
+ <parameter name="enableREST" locked="false">true</parameter>
+
+ <parameter name="userName" locked="false">admin</parameter>
+ <parameter name="password" locked="false">axis2</parameter>
+
+ <parameter name="seralizeLocation" locked="false">.</parameter>
+ <hostConfiguration>
+ <ip>127.0.0.1</ip>
+ <port>5555</port>
+ </hostConfiguration>
+
+
+ <!--if you want to extract the service archive file and work with that please uncomment this-->
+ <!--else , it wont extract archive file or does not take into consideration if someone drop-->
+ <!--exploded directory into /service directory-->
+ <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
+
+
+ <!-- The way of adding listener to the system-->
+ <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+ <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+ <!-- </listener>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+ <!--messageReceiver mep="INOUT" class="axis2_receivers"/-->
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http" class="axis2_http_receiver">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+ <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.pop3.port" locked="false">110</parameter>
+ <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
+ </transportReceiver> -->
+
+ <!--
+ <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+ -->
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <!--
+ <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+ <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ -->
+ <transportSender name="http" class="axis2_http_sender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <!--parameter name="Transfer-Encoding">chunked</parameter-->
+ <!--parameter name="PROXY" proxy_host="127.0.0.1" proxy_port="8080" locked="true"/-->
+ </transportSender>
+ <!--
+ <transportSender name="https" class="axis2_http_sender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ </transportSender>
+ -->
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+ </transportSender>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <module ref="addressing"/>
+
+ <module ref="tuscany"/>
+
+ <!--Configuring module , providing paramters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="inflow">
+ <!-- System pre defined phases -->
+ <phase name="TransportIn"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch">
+ <handler name="AddressingBasedDispatcher"
+ class="axis2_engine">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="RequestURIBasedDispatcher"
+ class="axis2_engine">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="axis2_engine">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="axis2_engine">
+ <order phase="Dispatch"/>
+ </handler>
+ </phase>
+ <phase name="PostDispatch">
+ <handler name="DispatchPostConditionsEvaluator"
+ class="axis2_engine">
+ <order phase="PostDispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="axis2_engine">
+ <order phase="PostDispatch"/>
+ </handler>
+ <handler name="SOAPProcessingModelChecker"
+ class="axis2_engine">
+ <order phase="PostDispatch"/>
+ </handler>
+ </phase>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <!--phase name="userphase1"/-->
+ </phaseOrder>
+ <phaseOrder type="outflow">
+ <!-- user can add his own phases to this area -->
+ <!--phase name="RMPhase"/-->
+ <!--phase name="userphase1"/-->
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <!--phase name="PolicyDetermination"/-->
+ <!--phase name="MessageOut"/-->
+ </phaseOrder>
+ <phaseOrder type="INfaultflow">
+ <!-- user can add his own phases to this area -->
+ <!--phase name="userphase1"/-->
+ <!--phase name="RMPhase"/-->
+ </phaseOrder>
+ <phaseOrder type="Outfaultflow">
+ <!-- user can add his own phases to this area -->
+ <!--phase name="RMPhase"/-->
+ <!--phase name="userphase1"/-->
+ <!--phase name="PolicyDetermination"/-->
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/deploy.cmd b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/deploy.cmd
new file mode 100644
index 0000000000..6493e1cec9
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/deploy.cmd
@@ -0,0 +1,39 @@
+@echo off
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+rem Will deploy the Tuscany SCA WS service Axis2C service and module
+rem to the correct places within the AXIS2C_HOME directory
+setlocal
+set currentPath=%~d0%~p0
+
+if "%AXIS2C_HOME%" == "" (
+echo "AXIS2C_HOME not set"
+goto end
+)
+echo Deploying to Axis2C installed at %AXIS2C_HOME%
+
+if not exist %AXIS2C_HOME%\services\tuscany mkdir %AXIS2C_HOME%\services\tuscany
+if not exist %AXIS2C_HOME%\modules\tuscany mkdir %AXIS2C_HOME%\modules\tuscany
+
+copy %currentPath%\services\tuscany\* %AXIS2C_HOME%\services\tuscany
+copy %currentPath%\modules\tuscany\* %AXIS2C_HOME%\modules\tuscany
+copy %currentPath%\axis2.xml %AXIS2C_HOME%\axis2.xml
+
+:end
+endlocal
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/deploy.sh b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/deploy.sh
new file mode 100755
index 0000000000..ffe571b0ee
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/deploy.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+APFULLDIR=`pwd`
+
+if [ x$AXIS2C_HOME = x ]; then
+echo "AXIS2C_HOME not set"
+exit;
+fi
+echo "Deploying to Axis2C installed at $AXIS2C_HOME"
+
+if ! [ -d $AXIS2C_HOME/services/tuscany ]; then
+ mkdir $AXIS2C_HOME/services/tuscany
+fi
+
+if ! [ -d $AXIS2C_HOME/modules/tuscany ]; then
+ mkdir $AXIS2C_HOME/modules/tuscany
+fi
+
+cp $APFULLDIR/services/tuscany/services.xml $AXIS2C_HOME/services/tuscany
+
+if ! [ -f $AXIS2C_HOME/services/tuscany/libtuscany_sca_ws_service.so ]; then
+ ln -s $APFULLDIR/services/tuscany/libtuscany_sca_ws_service.so $AXIS2C_HOME/services/tuscany/libtuscany_sca_ws_service.so
+fi
+
+cp $APFULLDIR/modules/tuscany/module.xml $AXIS2C_HOME/modules/tuscany
+if ! [ -f $AXIS2C_HOME/modules/tuscany/libtuscany_sca_ws_dispatcher.so ]; then
+ ln -s $APFULLDIR/modules/tuscany/libtuscany_sca_ws_dispatcher.so $AXIS2C_HOME/modules/tuscany/libtuscany_sca_ws_dispatcher.so
+fi
+
+cp $APFULLDIR/axis2.xml $AXIS2C_HOME/axis2.xml
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/module.xml b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/module.xml
new file mode 100644
index 0000000000..97d4d43a86
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/module.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.
+-->
+<module name="tuscany" class="tuscany_sca_ws_dispatcher">
+ <inflow>
+ <handler name="TuscanyDispatcher" class="tuscany_sca_ws_dispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ </inflow>
+</module>
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/services.xml b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/services.xml
new file mode 100644
index 0000000000..335d4d96be
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/services.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<serviceGroup>
+<service name="TuscanyService">
+ <parameter name="ServiceClass" locked="xsd:false">tuscany_sca_ws_service</parameter>
+ <operation name="execute"/>
+</service>
+</serviceGroup>
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Dispatcher.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Dispatcher.cpp
new file mode 100644
index 0000000000..fe3eb52064
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Dispatcher.cpp
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#pragma warning(disable: 4091)
+#endif
+
+#include <axis2_handler_desc.h>
+#include <axis2_qname.h>
+#include <axis2_relates_to.h>
+#include <axis2_svc.h>
+#include <axis2_const.h>
+#include <axis2_conf_ctx.h>
+#include <axis2_addr.h>
+#include <axis2_utils.h>
+#include <axiom_soap_envelope.h>
+#include <axiom_soap_body.h>
+
+extern "C"
+{
+
+axis2_status_t AXIS2_CALL
+Axis2Dispatcher_invoke (
+ axis2_handler_t * handler,
+ const axis2_env_t *env,
+ struct axis2_msg_ctx *msg_ctx);
+
+axis2_svc_t *AXIS2_CALL
+Axis2Dispatcher_find_svc(
+ axis2_msg_ctx_t *msg_ctx,
+ const axis2_env_t *env);
+
+axis2_op_t *AXIS2_CALL
+Axis2Dispatcher_find_op(
+ axis2_msg_ctx_t *msg_ctx,
+ const axis2_env_t *env,
+ axis2_svc_t *svc);
+
+AXIS2_EXPORT axis2_handler_t* AXIS2_CALL
+Axis2Dispatcher_create(const axis2_env_t *env,
+ axis2_qname_t *qname)
+{
+ axis2_handler_t *handler = NULL;
+
+ handler = axis2_handler_create(env);
+ if (!handler)
+ {
+ return NULL;
+ }
+
+ /* handler init is handled by conf loading, so no need to do it here */
+
+ /* set the base struct's invoke op */
+ if (handler->ops)
+ handler->ops->invoke = Axis2Dispatcher_invoke;
+
+ return handler;
+}
+
+axis2_svc_t *AXIS2_CALL
+Axis2Dispatcher_find_svc(
+ axis2_msg_ctx_t *msg_ctx,
+ const axis2_env_t *env)
+{
+ axis2_svc_t *svc = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+ if (conf_ctx)
+ {
+ axis2_conf_t *conf = NULL;
+ conf = AXIS2_CONF_CTX_GET_CONF(conf_ctx, env);
+ if (conf)
+ {
+ axis2_char_t* service_name = "TuscanyService";
+ svc = AXIS2_CONF_GET_SVC(conf, env, service_name);
+ if (svc)
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "Service found using target endpoint address");
+ }
+ }
+ }
+
+ return svc;
+}
+
+axis2_op_t *AXIS2_CALL
+Axis2Dispatcher_find_op(
+ axis2_msg_ctx_t *msg_ctx,
+ const axis2_env_t *env,
+ axis2_svc_t *svc)
+{
+ axis2_op_t *op = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ axis2_qname_t *op_qname = NULL;
+ axis2_char_t* execute_op_name = "execute";
+ op_qname = axis2_qname_create(env, execute_op_name, NULL, NULL);
+
+ op = AXIS2_SVC_GET_OP_WITH_NAME(svc, env, AXIS2_QNAME_GET_LOCALPART(op_qname, env));
+
+ AXIS2_QNAME_FREE(op_qname, env);
+ if (op)
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "TuscanyService execute operation found");
+ }
+ return op;
+}
+
+axis2_status_t AXIS2_CALL
+Axis2Dispatcher_invoke(
+ axis2_handler_t * handler,
+ const axis2_env_t *env,
+ struct axis2_msg_ctx *msg_ctx)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if (!(AXIS2_MSG_CTX_GET_SERVER_SIDE(msg_ctx, env)))
+ return AXIS2_SUCCESS;
+
+ msg_ctx->ops->find_svc = Axis2Dispatcher_find_svc;
+ msg_ctx->ops->find_op = Axis2Dispatcher_find_op;
+
+ axis2_svc_t *axis_service = NULL;
+ axis2_op_t *op = NULL;
+
+ axis_service = AXIS2_MSG_CTX_GET_SVC(msg_ctx, env);
+
+ if (!axis_service)
+ {
+ axis_service = AXIS2_MSG_CTX_FIND_SVC(msg_ctx, env);
+ if (axis_service)
+ {
+ AXIS2_MSG_CTX_SET_SVC(msg_ctx, env, axis_service);
+ /*TODO Set the Service Group Context to the message Context*/
+ }
+ }
+ op = AXIS2_MSG_CTX_GET_OP(msg_ctx, env);
+ if (!op)
+ {
+ op = AXIS2_MSG_CTX_FIND_OP(msg_ctx, env, axis_service);
+
+ if (op)
+ {
+ AXIS2_MSG_CTX_SET_OP(msg_ctx, env, op);
+ }
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+}
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2DispatcherModule.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2DispatcherModule.cpp
new file mode 100644
index 0000000000..0dc8f3358a
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2DispatcherModule.cpp
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#pragma warning(disable: 4091)
+#endif
+
+#include <axis2_module.h>
+#include <axis2_addr_mod.h>
+#include <axis2_conf_ctx.h>
+#include <axis2_disp.h>
+
+extern "C"
+{
+
+axis2_status_t AXIS2_CALL
+Axis2DispatcherModule_shutdown(axis2_module_t *module,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+Axis2DispatcherModule_init(
+ axis2_module_t *module,
+ const axis2_env_t *env,
+ axis2_conf_ctx_t *conf_ctx,
+ axis2_module_desc_t *module_desc);
+
+axis2_status_t AXIS2_CALL
+Axis2DispatcherModule_fill_handler_create_func_map(axis2_module_t *module,
+ const axis2_env_t *env);
+
+AXIS2_EXTERN axis2_handler_t* AXIS2_CALL
+Axis2Dispatcher_create(const axis2_env_t *env,
+ axis2_qname_t *qname);
+
+axis2_module_t *
+Axis2DispatcherModule_create(const axis2_env_t *env)
+{
+ axis2_module_t *module = NULL;
+ module = (axis2_module_t*)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_module_t));
+
+
+ module->ops = (axis2_module_ops_t*)AXIS2_MALLOC(
+ env->allocator, sizeof(axis2_module_ops_t));
+
+ module->ops->shutdown = Axis2DispatcherModule_shutdown;
+ module->ops->init = Axis2DispatcherModule_init;
+ module->ops->fill_handler_create_func_map =
+ Axis2DispatcherModule_fill_handler_create_func_map;
+
+ return module;
+}
+
+axis2_status_t AXIS2_CALL
+Axis2DispatcherModule_init(
+ axis2_module_t *module,
+ const axis2_env_t *env,
+ axis2_conf_ctx_t *conf_ctx,
+ axis2_module_desc_t *module_desc)
+{
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+Axis2DispatcherModule_shutdown(axis2_module_t *module,
+ const axis2_env_t *env)
+{
+ if(module->ops)
+ {
+ AXIS2_FREE(env->allocator, module->ops);
+ module->ops = NULL;
+ }
+
+ if(module->handler_create_func_map)
+ {
+ axis2_hash_free(module->handler_create_func_map, env);
+ module->handler_create_func_map = NULL;
+ }
+
+ if(module)
+ {
+ AXIS2_FREE(env->allocator, module);
+ module = NULL;
+ }
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+Axis2DispatcherModule_fill_handler_create_func_map(axis2_module_t *module,
+ const axis2_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ module->handler_create_func_map = axis2_hash_make(env);
+ axis2_hash_set(module->handler_create_func_map, "TuscanyDispatcher",
+ (axis2_ssize_t)AXIS2_HASH_KEY_STRING, (const void *)Axis2Dispatcher_create);
+
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+
+AXIS2_EXPORT int
+axis2_get_instance(axis2_module_t **inst,
+ const axis2_env_t *env)
+{
+ *inst = Axis2DispatcherModule_create(env);
+ if(!(*inst))
+ {
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXPORT int
+axis2_remove_instance(axis2_module_t *inst,
+ const axis2_env_t *env)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ if (inst)
+ {
+ status = Axis2DispatcherModule_shutdown(inst, env);
+ }
+ return status;
+}
+
+}
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp
new file mode 100644
index 0000000000..046a6e221b
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp
@@ -0,0 +1,506 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#pragma warning(disable: 4091)
+#endif
+
+#include <axis2_svc_skeleton.h>
+#include <axis2_array_list.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
+#include <axiom.h>
+#include <stdio.h>
+
+#include <sdo_axiom.h>
+using commonj::sdo::DataObjectPtr;
+using commonj::sdo::DataFactoryPtr;
+using commonj::sdo::DataObjectList;
+using commonj::sdo::PropertyList;
+using commonj::sdo_axiom::AxiomHelper;
+
+#include "tuscany/sca/util/Exceptions.h"
+#include "WSServiceProxy.h"
+#include "model/WSReferenceBinding.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/CompositeService.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/ReferenceType.h"
+#include "tuscany/sca/model/WSDLDefinition.h"
+#include "tuscany/sca/model/WSDLOperation.h"
+#include "tuscany/sca/model/WSDLInterface.h"
+#include "tuscany/sca/model/Interface.h"
+#include "tuscany/sca/core/TuscanyRuntime.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/util/Utils.h"
+#include "Axis2Utils.h"
+
+using namespace tuscany::sca;
+using namespace tuscany::sca::ws;
+using namespace tuscany::sca::model;
+
+int AXIS2_CALL
+Axis2Service_free(axis2_svc_skeleton_t *svc_skeleton,
+ const axis2_env_t *env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t* AXIS2_CALL
+Axis2Service_invoke(axis2_svc_skeleton_t *svc_skeleton,
+ const axis2_env_t *env,
+ axiom_node_t *node,
+ axis2_msg_ctx_t *msg_ctx);
+
+int AXIS2_CALL Axis2Service_init(axis2_svc_skeleton_t *svc_skeleton,
+ const axis2_env_t *env);
+
+axis2_svc_skeleton_t *
+axis2_Axis2Service_create(axis2_env_t *env)
+{
+ axis2_svc_skeleton_t *svc_skeleton = NULL;
+ svc_skeleton = (axis2_svc_skeleton_t *) AXIS2_MALLOC((env)->allocator,
+ sizeof(axis2_svc_skeleton_t));
+
+
+ svc_skeleton->ops = (axis2_svc_skeleton_ops_t *) AXIS2_MALLOC(
+ (env)->allocator, sizeof(axis2_svc_skeleton_ops_t));
+
+ svc_skeleton->func_array = NULL;
+
+ svc_skeleton->ops->free = Axis2Service_free;
+ svc_skeleton->ops->init = Axis2Service_init;
+ svc_skeleton->ops->invoke = Axis2Service_invoke;
+ /*svc_skeleton->ops->on_fault = Axis2Service_on_fault;*/
+
+ return svc_skeleton;
+}
+
+int AXIS2_CALL
+Axis2Service_init(axis2_svc_skeleton_t *svc_skeleton,
+ const axis2_env_t *env)
+{
+ // This method never seems to be called - an old Axis2C artifact?
+
+ svc_skeleton->func_array = axis2_array_list_create(env, 0);
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+Axis2Service_free(axis2_svc_skeleton_t *svc_skeleton,
+ const axis2_env_t *env)
+{
+ /*if(svc_skeleton->func_array)
+ {
+ AXIS2_ARRAY_LIST_FREE(svc_skeleton->func_array, env);
+ svc_skeleton->func_array = NULL;
+ }*/
+
+ if(svc_skeleton->ops)
+ {
+ AXIS2_FREE((env)->allocator, svc_skeleton->ops);
+ svc_skeleton->ops = NULL;
+ }
+
+ if(svc_skeleton)
+ {
+ AXIS2_FREE((env)->allocator, svc_skeleton);
+ svc_skeleton = NULL;
+ }
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * Initialize the Tuscany runtime
+ */
+
+static string systemRoot = "";
+static string componentName = "";
+static string serviceName = "";
+static TuscanyRuntime* tuscanyRuntime = NULL;
+static CompositeService* compositeService = NULL;
+
+void initTuscanyRuntime(const axis2_env_t *env, const char* root, const char *component, const char* service)
+{
+ AXIS2_LOG_INFO((env)->log, "Axis2Service init, root: %s, component: %s, service: %s\n", root, component, service);
+ try
+ {
+
+ bool newInitParams = false;
+
+ if(systemRoot != root)
+ {
+ systemRoot = root;
+ newInitParams = true;
+ }
+
+ if(componentName != component)
+ {
+ componentName = component;
+ newInitParams = true;
+ }
+
+ if(serviceName != service)
+ {
+ serviceName = service;
+ newInitParams = true;
+ }
+
+ if(tuscanyRuntime == NULL)
+ {
+ AXIS2_LOG_INFO((env)->log, "Creating new Tuscany runtime\n");
+ tuscanyRuntime = new TuscanyRuntime(componentName, systemRoot);
+ tuscanyRuntime->start();
+ }
+ else if(tuscanyRuntime != NULL && newInitParams)
+ {
+ AXIS2_LOG_INFO((env)->log, "Restarting Tuscany runtime\n");
+ tuscanyRuntime->stop();
+ tuscanyRuntime->setDefaultComponentName(componentName);
+ tuscanyRuntime->setSystemRoot(systemRoot);
+ tuscanyRuntime->start();
+ }
+
+ if(compositeService == NULL)
+ {
+ Composite* composite = (Composite*)SCARuntime::getInstance()->getDefaultComponent()->getType();
+ compositeService = (CompositeService*)composite->findComponent(serviceName);
+ }
+ else
+ {
+ if(newInitParams)
+ {
+ Composite* composite = SCARuntime::getInstance()->getDefaultComponent()->getComposite();
+ compositeService = (CompositeService*)composite->findComponent(serviceName);
+ }
+ }
+ }
+ catch(TuscanyRuntimeException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "%s has been caught: %s\n", ex.getEClassName(), ex.getMessageText());
+ }
+}
+
+
+/*
+ * This method invokes the target service method
+ */
+axiom_node_t* AXIS2_CALL
+Axis2Service_invoke(axis2_svc_skeleton_t *svc_skeleton,
+ const axis2_env_t *env,
+ axiom_node_t *node,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ if (node)
+ {
+ if (AXIOM_NODE_GET_NODE_TYPE(node, env) == AXIOM_ELEMENT)
+ {
+ axiom_element_t *element = NULL;
+ element = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(node, env);
+ if (element)
+ {
+ string op_name = "";
+ axis2_bool_t rest = AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env);
+ if (rest)
+ {
+ axis2_endpoint_ref_t *endpoint_ref = AXIS2_MSG_CTX_GET_FROM(msg_ctx, env);
+ if (endpoint_ref)
+ {
+ const axis2_char_t *address = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
+ if (address)
+ {
+ axis2_char_t **url_tokens = axis2_parse_request_url_for_svc_and_op(env, address);
+ if (url_tokens)
+ {
+ if (url_tokens[1])
+ {
+ op_name = url_tokens[1];
+ }
+ if (NULL != url_tokens[1])
+ AXIS2_FREE(env->allocator, url_tokens[1]);
+ if (NULL != url_tokens[0])
+ AXIS2_FREE(env->allocator, url_tokens[0]);
+ AXIS2_FREE(env->allocator, url_tokens);
+ }
+ }
+ }
+ }
+ else
+ {
+ // This gets the operation name from the root element name - this is correct for DocLit Wrapped style
+ op_name = AXIOM_ELEMENT_GET_LOCALNAME(element, env);
+ }
+
+ if (op_name != "")
+ {
+ // Get the Tuscany system root and composite service name from the Axis2
+ // service parameters
+ char* rootParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanySystemRoot");
+ if (rootParam == NULL)
+ rootParam = "";
+
+ char* serviceParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyService");
+ if (serviceParam != NULL)
+ {
+ AXIS2_LOG_INFO((env)->log, "Axis2Service invoke called with system root: %s, service name: %s, operation name: %s", rootParam, serviceParam, op_name.c_str());
+
+ // Service is of the form "component name"/"composite service name"
+ string component, service;
+ Utils::rTokeniseString("/", serviceParam, component, service);
+
+ initTuscanyRuntime(env, rootParam, component.c_str(), service.c_str());
+ }
+ else {
+
+ // Use the default system root and component, the service is
+ // derived from the target address
+ axis2_endpoint_ref_t *endpoint_ref = NULL;
+ endpoint_ref = AXIS2_MSG_CTX_GET_FROM(msg_ctx, env);
+ axis2_char_t *address = NULL;
+ address = (axis2_char_t*) AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
+ axis2_char_t **url_tokens = NULL;
+ url_tokens = axis2_parse_request_url_for_svc_and_op(env, address);
+ string service(url_tokens[0]);
+
+ AXIS2_LOG_INFO((env)->log, "Axis2Service invoke called with system root: %s, service name: %s, operation name: %s", rootParam, service.c_str(), op_name.c_str());
+
+ initTuscanyRuntime(env, rootParam, "", service.c_str());
+ }
+
+ if(!compositeService)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service_invoke: Tuscany initialisation failed");
+ return 0;
+ }
+
+ DataFactoryPtr dataFactory = compositeService->getComposite()->getDataFactory();
+ if (dataFactory == 0)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service_invoke: CompositeService has no SCA implementation");
+ return 0;
+ }
+
+ // Get the WS binding and the WSDL operation
+ Composite* composite = compositeService->getComposite();
+ Reference* reference = compositeService->getReference();
+ WSReferenceBinding* binding = (WSReferenceBinding*)reference->getBinding();
+ WSDLOperation wsdlOperation;
+
+ string wsdlNamespace = binding->getWSDLNamespaceURL();
+ if (wsdlNamespace != "")
+ {
+
+ // Lookup the WSDL model from the composite, keyed on the namespace
+ // (the wsdl will have been loaded at startup)
+ WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(wsdlNamespace);
+ if (wsdlDefinition == 0)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "WSDL description %s not found\n", wsdlNamespace.c_str());
+ string msg = "WSDL not found for " + wsdlNamespace;
+ throw SystemConfigurationException(msg.c_str());
+ }
+
+ // Find the target operation in the wsdl port type.
+ try {
+ wsdlOperation = wsdlDefinition->findOperation(
+ binding->getServiceName(),
+ binding->getEndpointName(),
+ op_name.c_str());
+ }
+ catch(SystemConfigurationException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
+ throw;
+ }
+
+ }
+ else
+ {
+ Interface* iface = reference->getType()->getInterface();
+ if (iface != NULL &&
+ iface->getInterfaceTypeQName() == WSDLInterface::typeQName)
+ {
+ WSDLInterface* wsdlInterface = (WSDLInterface*)iface;
+ wsdlNamespace = wsdlInterface->getNamespaceURI();
+
+ if (wsdlNamespace != "")
+ {
+
+ WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace);
+ if (wsdl == 0)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "WSDL description %s not found\n", wsdlNamespace.c_str());
+ string msg = "WSDL not found for " + wsdlNamespace;
+ throw SystemConfigurationException(msg.c_str());
+ }
+
+ try
+ {
+ wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name.c_str());
+ }
+ catch(SystemConfigurationException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
+ throw;
+ }
+ }
+ }
+ }
+
+ if (wsdlNamespace == "")
+ {
+ // Create a default document literal wrapped WSDL operation
+ wsdlNamespace = compositeService->getName();
+ wsdlOperation = WSDLOperation();
+ wsdlOperation.setOperationName(op_name.c_str());
+ wsdlOperation.setSoapAction(wsdlNamespace+ "#" +op_name);
+ wsdlOperation.setEndpoint("");
+ wsdlOperation.setSoapVersion(WSDLOperation::SOAP11);
+ wsdlOperation.setDocumentStyle(true);
+ wsdlOperation.setWrappedStyle(true);
+ wsdlOperation.setEncoded(false);
+ wsdlOperation.setInputType(wsdlNamespace + "#" + op_name);
+ wsdlOperation.setOutputType(wsdlNamespace + "#" + op_name + "Response");
+ }
+
+ // Convert the input AXIOM node to an SDO DataObject
+ axiom_node_t* body = AXIOM_NODE_GET_PARENT(node, env);
+ char* str = NULL;
+ str = AXIOM_NODE_TO_STRING(body, env);
+ if (str)
+ {
+ AXIS2_LOG_INFO((env)->log, "Axis2Service invoke has request OM: %s\n", str);
+ }
+
+ // Convert the SOAP body to an SDO DataObject
+ AxiomHelper* axiomHelper = AxiomHelper::getHelper();
+ DataObjectPtr inputBodyDataObject = NULL;
+
+ try
+ {
+ inputBodyDataObject = axiomHelper->toSdo(body, dataFactory);
+ }
+ catch(SDORuntimeException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service_invoke: SDORuntimeException thrown: %s", ex.getMessageText());
+ }
+
+ if(!inputBodyDataObject)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service_invoke: Could not convert received Axiom node to SDO");
+ /** TODO: return a SOAP fault here */
+ return 0;
+ }
+
+ // Get the first body part representing the doc-lit-wrapped wrapper element
+ DataObjectPtr inputDataObject = NULL;
+ PropertyList bpl = inputBodyDataObject->getInstanceProperties();
+ if (bpl.size()!=0)
+ {
+ if (bpl[0].isMany())
+ {
+ DataObjectList& parts = inputBodyDataObject->getList((unsigned int)0);
+ inputDataObject = parts[0];
+ }
+ else
+ {
+ inputDataObject = inputBodyDataObject->getDataObject(bpl[0]);
+ }
+ }
+ if (inputDataObject == NULL)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service_invoke: Could not convert body part to SDO");
+ return 0;
+ }
+
+ // Dispatch to the WS proxy
+ WSServiceProxy* proxy = (WSServiceProxy*)binding->getServiceProxy();
+
+ DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject);
+
+ if(!outputDataObject)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service_invoke: Failure whilst invoking CompositeService");
+
+ /** TODO: return a SOAP fault here */
+ return 0;
+ }
+
+ // Convert the output DataObject to an Axiom node
+ axiom_node_t* outputNode = axiomHelper->toAxiomNode(outputDataObject,
+ wsdlOperation.getOutputTypeUri().c_str(), wsdlOperation.getOutputTypeName().c_str());
+
+ AxiomHelper::releaseHelper(axiomHelper);
+
+ str = AXIOM_NODE_TO_STRING(outputNode, env);
+ if (str)
+ {
+ AXIS2_LOG_INFO((env)->log, "Axis2Service invoke has response OM : %s\n", str);
+ }
+
+
+ //LOGEXIT(1, "Axis2Service_invoke");
+ return outputNode;
+ }
+ }
+ }
+ }
+
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service_invoke: invalid OM parameters in request");
+ //LOGERROR(0, "Axis2Service service ERROR: invalid OM parameters in request\n");
+
+ /** TODO: return a SOAP fault here */
+ return 0;
+}
+
+
+extern "C"
+{
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+
+AXIS2_EXPORT int axis2_get_instance(axis2_svc_skeleton **inst,
+ axis2_env_t *env)
+{
+ *inst = axis2_Axis2Service_create(env);
+ if(!(*inst))
+ {
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXPORT int axis2_remove_instance(axis2_svc_skeleton_t *inst,
+ axis2_env_t *env)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ if (inst)
+ {
+ status = AXIS2_SVC_SKELETON_FREE(inst, env);
+ }
+ return status;
+}
+}
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp
new file mode 100644
index 0000000000..7a30ab2994
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#pragma warning(disable: 4091)
+#endif
+#include "Axis2Utils.h"
+
+#include <axis2_svc_ctx.h>
+#include <axis2_defines.h>
+
+#include "tuscany/sca/util/Logging.h"
+
+using namespace tuscany::sca;
+using namespace tuscany::sca::ws;
+
+
+/* Static utility method to retrieve service parameters from the service.xml file
+ * Get an odd linking error if this method (or the header's it requires) are in
+ * a different class.
+ */
+char* Axis2Utils::getAxisServiceParameterValue(const axis2_env_t *env, axis2_msg_ctx_t *msg_ctx, char* parameterName)
+{
+ struct axis2_svc *svc = NULL;
+ struct axis2_op_ctx *op_ctx = NULL;
+ struct axis2_svc_ctx *svc_ctx = NULL;
+ axis2_param_t *param = NULL;
+ char* paramValue = NULL;
+
+ LOGENTRY(1, "Axis2Utils::getAxisServiceParameterValue");
+
+ op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env);
+ svc_ctx = AXIS2_OP_CTX_GET_PARENT(op_ctx, env);
+ svc = AXIS2_SVC_CTX_GET_SVC(svc_ctx, env);
+ if(NULL == svc)
+ {
+ return NULL;
+ }
+
+ param = AXIS2_SVC_GET_PARAM(svc, env, parameterName);
+ if(!param)
+ {
+ LOGERROR_1(1,"Axis parameter %s cannot be found", parameterName);
+ }
+ else
+ {
+ paramValue = (char*) AXIS2_PARAM_GET_VALUE(param, env);
+ }
+
+ LOGEXIT(1, "Axis2Utils::getAxisServiceParameterValue");
+ return paramValue;
+}
+
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.h
new file mode 100644
index 0000000000..4e8b069010
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.h
@@ -0,0 +1,46 @@
+/*
+ * 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$ */
+
+#ifndef tuscany_sca_extension_ws_axis2utils_h
+#define tuscany_sca_extension_ws_axis2utils_h
+
+#include <axis2_env.h>
+#include <axis2_msg_ctx.h>
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ class Axis2Utils
+ {
+ public:
+ static char* getAxisServiceParameterValue(const axis2_env_t *env, axis2_msg_ctx_t *msg_ctx, char* parameterName);
+ };
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_extension_ws_axis2utils_h
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp
new file mode 100644
index 0000000000..2cf5e5d8e1
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+
+#include "WSReferenceBindingExtension.h"
+#include "model/WSReferenceBinding.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/core/SCARuntime.h"
+
+
+extern "C"
+{
+ #if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+ #endif
+ void tuscany_sca_extension_initialize()
+ {
+ tuscany::sca::ws::WSReferenceBindingExtension::initialize();
+ }
+}
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+ // ===================================================================
+ // Constructor for the WSReferenceBinding class.
+ // ===================================================================
+ WSReferenceBindingExtension::WSReferenceBindingExtension()
+ {
+ LOGENTRY(1, "WSReferenceBindingExtension::constructor");
+ LOGEXIT(1, "WSReferenceBindingExtension::constructor");
+ }
+
+ // ===================================================================
+ // Destructor for the WSReferenceBindingExtension class.
+ // ===================================================================
+ WSReferenceBindingExtension::~WSReferenceBindingExtension()
+ {
+ LOGENTRY(1, "WSReferenceBindingExtension::destructor");;
+ LOGEXIT(1, "WSReferenceBindingExtension::destructor");
+ }
+
+ const string WSReferenceBindingExtension::extensionName("ws");
+ const string WSReferenceBindingExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding");
+
+ // ===================================================================
+ // loadModelElement - load the info from binding.ws
+ // ===================================================================
+ ReferenceBinding* WSReferenceBindingExtension::getReferenceBinding(Composite *composite, Reference* reference, DataObjectPtr scdlBinding)
+ {
+ string bindingType = scdlBinding->getType().getName();
+ if (bindingType == "WebServiceBinding")
+ {
+ string uri = scdlBinding->getCString("uri");
+ string endpoint = scdlBinding->getCString("endpoint");
+ commonj::sdo::DataObjectList& soap = scdlBinding->getList("soapbinding");
+ string version;
+ if (soap.size()!=0)
+ {
+ version = soap.getCString(0);
+ }
+ else
+ {
+ version = "";
+ }
+
+ WSReferenceBinding* serviceBinding = new WSReferenceBinding(reference, uri, endpoint, version);
+
+ return serviceBinding;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ void WSReferenceBindingExtension::initialize()
+ {
+ LOGENTRY(1, "WSReferenceBindingExtension::initialize");;
+ SCARuntime::getInstance()->registerReferenceBindingExtension(new WSReferenceBindingExtension());
+ LOGEXIT(1, "WSReferenceBindingExtension::initialize");;
+ }
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.h
new file mode 100644
index 0000000000..c7972fe15a
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.h
@@ -0,0 +1,74 @@
+/*
+ * 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$ */
+
+#ifndef tuscany_sca_extension_ws_wsreferencebindingextension_h
+#define tuscany_sca_extension_ws_wsreferencebindingextension_h
+
+#include "tuscany/sca/extension/ReferenceBindingExtension.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ class WSReferenceBindingExtension : public ReferenceBindingExtension
+ {
+ public:
+ /**
+ * Default constructor
+ */
+ WSReferenceBindingExtension();
+
+ /**
+ * Destructor
+ */
+ virtual ~WSReferenceBindingExtension();
+
+ /**
+ * return the name of the extension
+ */
+ virtual const string& getExtensionName() {return extensionName;}
+
+ /**
+ * return the QName of schema elemant for this implementation extension
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#binding.ws")
+ */
+ virtual const string& getExtensionTypeQName() {return typeQName;}
+
+ virtual ReferenceBinding* getReferenceBinding(Composite* composite, Reference *reference, DataObjectPtr scdlBinding);
+
+ static void initialize();
+
+ private:
+ static const string extensionName;
+ static const string typeQName;
+
+ };
+
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_extension_ws_wsreferencebindingextension_h
+
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp
new file mode 100644
index 0000000000..960c91ed60
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp
@@ -0,0 +1,587 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "WSServiceProxy.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Exceptions.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/ReferenceType.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/ComponentType.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/ServiceBinding.h"
+#include "tuscany/sca/model/WSDLDefinition.h"
+#include "tuscany/sca/model/WSDLInterface.h"
+#include "tuscany/sca/model/WSDLOperation.h"
+#include "model/WSReferenceBinding.h"
+
+#include "commonj/sdo/SDO.h"
+using namespace commonj::sdo;
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ // ============================
+ // Constructor: Create a proxy
+ // ============================
+ WSServiceProxy::WSServiceProxy(Reference* reference)
+ : ServiceProxy(reference)
+ {
+ LOGENTRY(1,"WSServiceProxy::constructor");
+
+ // Get the target service wrapper
+ WSReferenceBinding* referenceBinding = (WSReferenceBinding*)reference->getBinding();
+ serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper();
+
+ // Define the SOAP Body type and element to allow a SOAP body to
+ // be loaded in a DataObject
+ DataFactoryPtr dataFactory = reference->getComponent()->getComposite()->getDataFactory();
+ try {
+ const Type& bodyType = dataFactory->getType("http://www.w3.org/2003/05/soap-envelope", "Body");
+ } catch (SDORuntimeException e)
+ {
+
+ // Define the SOAP 1.2 Body type
+ dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "RootType", false, false, false);
+ dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "Body", false, true, false);
+ dataFactory->addPropertyToType(
+ "http://www.w3.org/2003/05/soap-envelope", "RootType",
+ "Body",
+ "http://www.w3.org/2003/05/soap-envelope", "Body",
+ false, false, true);
+
+ // Define the SOAP 1.1 Body type
+ dataFactory->addType("http://schemas.xmlsoap.org/soap/envelope/", "RootType", false, false, false);
+ dataFactory->addType("http://schemas.xmlsoap.org/soap/envelope/", "Body", false, true, false);
+ dataFactory->addPropertyToType(
+ "http://schemas.xmlsoap.org/soap/envelope/", "RootType",
+ "Body",
+ "http://schemas.xmlsoap.org/soap/envelope/", "Body",
+ false, false, true);
+ }
+
+ LOGEXIT(1,"WSServiceProxy::constructor");
+ }
+
+ // ==========
+ // Destructor
+ // ==========
+ WSServiceProxy::~WSServiceProxy()
+ {
+ LOGENTRY(1,"WSServiceProxy::destructor");
+ LOGEXIT(1,"WSServiceProxy::destructor");
+ }
+
+ ///
+ /// This method will be called to process an operation invocation.
+ ///
+ DataObjectPtr WSServiceProxy::invoke(const WSDLOperation& wsdlOperation, DataObjectPtr inputDataObject)
+ {
+ LOGENTRY(1,"WSServiceProxy::invoke");
+
+ Reference* reference = getReference();
+ Component* component = reference->getComponent();
+ Composite* composite = component ->getComposite();
+
+ WSReferenceBinding* referenceBinding = (WSReferenceBinding*)reference->getBinding();
+ DataFactoryPtr dataFactoryPtr = reference->getComponent()->getComposite()->getDataFactory();
+
+ bool documentStyle = wsdlOperation.isDocumentStyle();
+ bool wrappedStyle = wsdlOperation.isWrappedStyle();
+
+ const char* outputTypeURI = wsdlOperation.getOutputTypeUri().c_str();
+ const char* outputTypeName = wsdlOperation.getOutputTypeName().c_str();
+
+ LOGINFO_2(4, "WSServiceProxy has got WSDLOperation with inputType: %s#%s",
+ wsdlOperation.getInputTypeUri().c_str(),
+ wsdlOperation.getInputTypeName().c_str());
+ LOGINFO_2(4, "WSServiceProxy has got WSDLOperation with outputType: %s#%s",
+ outputTypeURI,
+ outputTypeName);
+ LOGINFO_2(4, "WSServiceProxy has got WSDLOperation with documentStyle=%d and wrapped=%d",
+ documentStyle,
+ wrappedStyle);
+
+ if (documentStyle)
+ {
+ if (wrappedStyle)
+ {
+
+ // Create new Operation object and set parameters and return value
+ Operation operation(wsdlOperation.getOperationName().c_str());
+
+ // Go through the input data object to set the operation parameters
+ PropertyList pl = inputDataObject->getInstanceProperties();
+
+ for(int i=0; i<pl.size(); i++)
+ {
+ const char* name = pl[i].getName();
+
+ switch (pl[i].getTypeEnum())
+ {
+ case Type::BooleanType:
+ {
+ bool* boolData = new bool;
+ *boolData = inputDataObject->getBoolean(pl[i]);
+ operation.addParameter(boolData);
+ }
+ break;
+ case Type::ByteType:
+ {
+ char* byteData = new char;
+ *byteData = inputDataObject->getByte(pl[i]);
+ operation.addParameter(byteData);
+ }
+ break;
+ case Type::BytesType:
+ {
+ int len = inputDataObject->getLength(pl[i]);
+ char* bytesData = new char[len+1];
+ int bytesWritten = inputDataObject->getBytes(pl[i], bytesData, len);
+ // Ensure the bytes end with the null char. Not sure if this is neccessary
+ if(bytesWritten <= len)
+ {
+ bytesData[bytesWritten] = 0;
+ }
+ else
+ {
+ bytesData[len] = 0;
+ }
+ operation.addParameter(&bytesData);
+ }
+ break;
+ case Type::CharacterType:
+ {
+ // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType
+ wchar_t* charData = new wchar_t;
+ *charData = inputDataObject->getCharacter(pl[i]);
+ operation.addParameter(charData);
+ }
+ break;
+ case Type::DoubleType:
+ {
+ long double* doubleData = new long double;
+ *doubleData = inputDataObject->getDouble(pl[i]);
+ operation.addParameter(doubleData);
+ }
+ break;
+ case Type::FloatType:
+ {
+ float* floatData = new float;
+ *floatData = inputDataObject->getFloat(pl[i]);
+ operation.addParameter(floatData);
+ }
+ break;
+ case Type::IntegerType:
+ {
+ long* intData = new long;
+ *intData = inputDataObject->getInteger(pl[i]);
+ operation.addParameter(intData);
+ }
+ break;
+ case Type::ShortType:
+ {
+ short* shortData = new short;
+ *shortData = inputDataObject->getShort(pl[i]);
+ operation.addParameter(shortData);
+ }
+ break;
+ case Type::StringType:
+ {
+ string* stringData;
+ if(inputDataObject->isSet(pl[i]))
+ {
+ stringData = new string(inputDataObject->getCString(pl[i]));
+ }
+ else
+ {
+ // The data is not set, so pass an empty string as the parameter
+ stringData = new string();
+ }
+ operation.addParameter(stringData);
+ }
+ break;
+ case Type::DataObjectType:
+ {
+ DataObjectPtr dataObjectData = inputDataObject->getDataObject(pl[i]);
+ if(!dataObjectData)
+ {
+ LOGINFO_1(4, "SDO DataObject parameter named %s was null", name);
+ }
+ operation.addParameter(&dataObjectData);
+ }
+ break;
+ case Type::OpenDataObjectType:
+ {
+ /*
+ * This code deals with xsd:any element parameters
+ * Get each element as a DataObject and add in to the parameter list
+ */
+
+ DataObjectList& dataObjectList = inputDataObject->getList(pl[i]);
+
+ for(int j=0; j<dataObjectList.size(); j++)
+ {
+ DataObjectPtr dataObjectData = dataObjectList[j];
+ if(!dataObjectData)
+ {
+
+ // Add a null DataObject ptr
+ LOGINFO_2(4, "SDO OpenDataObject parameter named %s[%d] was null", name, j);
+ operation.addParameter(&dataObjectData);
+ }
+ else
+ {
+
+ SequencePtr sequence = dataObjectData->getSequence();
+ if (sequence->size()!=0)
+ {
+ // Add a text element
+ if (sequence->isText(0))
+ {
+ string* stringData = new string(sequence->getCStringValue(0));
+ operation.addParameter(stringData);
+ }
+ else
+ {
+ // Add a complex element DataObject
+ DataObjectPtr dob = sequence->getDataObjectValue(0);
+ if(!dob)
+ {
+ LOGINFO_1(4, "SDO DataObject parameter named %s was null", name);
+ }
+ operation.addParameter(&dob);
+ }
+ }
+ else
+ {
+ // Empty content, add an empty string
+ LOGINFO_2(4, "SDO OpenDataObject parameter named %s[%d] was empty", name, j);
+ string* stringData = new string("");
+ operation.addParameter(stringData);
+ }
+ }
+ }
+ }
+ break;
+ case Type::DateType:
+ LOGERROR_1(0, "SDO DateType parameters are not yet supported (%s)", name);
+ return NULL;
+ case Type::LongType:
+ LOGERROR_1(0, "SDO LongType (int64_t) parameters are not yet supported (%s)", name);
+ return NULL;
+ break;
+ case Type::UriType:
+ LOGERROR_1(0, "SDO UriType parameters are not yet supported (%s)", name);
+ return NULL;
+ break;
+ case Type::BigDecimalType:
+ LOGERROR_1(0, "SDO BigDecimalType parameters are not yet supported (%s)", name);
+ return NULL;
+ break;
+ case Type::BigIntegerType:
+ LOGERROR_1(0, "SDO BigIntegerType parameters are not yet supported (%s)", name);
+ return NULL;
+ break;
+ default:
+ LOGERROR_1(0, "Unknown SDO type parameter named %s has been found. Unknown types are not yet supported", name);
+ return NULL;
+ }
+ }
+
+ try
+ {
+
+ // Call into the target service wrapper
+ serviceWrapper->invoke(operation);
+
+ // Set the data in the outputDataObject to be returned
+ DataObjectPtr outputDataObject;
+ try {
+
+ // Create the output wrapper
+ const Type& rootType = dataFactoryPtr->getType(outputTypeURI, "RootType");
+ const Property& prop = rootType.getProperty(outputTypeName);
+ const Type& outputType = prop.getType();
+ outputDataObject = dataFactoryPtr->create(outputType);
+ }
+ catch (SDORuntimeException e)
+ {
+ try
+ {
+
+ // Create the output wrapper
+ const Type& outputType = dataFactoryPtr->getType(outputTypeURI, outputTypeName);
+ outputDataObject = dataFactoryPtr->create(outputType);
+ }
+ catch (SDORuntimeException e)
+ {
+ // The output wrapper type is not known, create an open DataObject
+ outputDataObject = dataFactoryPtr->create(Type::SDOTypeNamespaceURI, "OpenDataObject");
+ }
+ }
+
+ setOutputData(operation, outputDataObject, dataFactoryPtr);
+
+ LOGEXIT(1,"WSServiceProxy::invoke");
+
+ return outputDataObject;
+
+ }
+ catch(SDORuntimeException &ex)
+ {
+ // TODO: Return more error information than just a null DataObject
+ LOGERROR_2(0, "%s has been caught: %s\n", ex.getEClassName(), ex.getMessageText());
+ return NULL;
+ }
+ catch(TuscanyRuntimeException &ex)
+ {
+ // TODO: Return more error information than just a null DataObject
+ LOGERROR_2(0, "%s has been caught: %s\n", ex.getEClassName(), ex.getMessageText());
+ return NULL;
+ }
+ }
+ else
+ {
+ LOGERROR(0, "CompositeServices with non-wrapped document style WSDL Operations are not yet supported");
+ LOGEXIT(1,"WSServiceProxy::invoke");
+ return NULL;
+ }
+ }
+ else
+ {
+ // RPC style
+ LOGERROR(0, "CompositeServices with RPC style WSDL Operations are not yet supported");
+ return NULL;
+ }
+ }
+
+
+ void WSServiceProxy::setOutputData(Operation& operation, DataObjectPtr outputDataObject, DataFactoryPtr dataFactoryPtr)
+ {
+ // Go through data object to set the return value
+ PropertyList pl = outputDataObject->getType().getProperties();
+
+ if(pl.size() == 0)
+ {
+ if(outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType())
+ {
+ /*
+ * This code deals with returning xsd:any elements
+ */
+ DataObjectList& l = outputDataObject->getList("return");
+ Operation::ParameterType resultType = operation.getReturnType();
+ switch(resultType)
+ {
+ case Operation::BOOL:
+ {
+ l.append(*(bool*)operation.getReturnValue());
+ break;
+ }
+ case Operation::SHORT:
+ {
+ l.append(*(short*)operation.getReturnValue());
+ break;
+ }
+ case Operation::INT:
+ {
+ l.append(*(long*)operation.getReturnValue());
+ break;
+ }
+ case Operation::LONG:
+ {
+ l.append(*(long*)operation.getReturnValue());
+ break;
+ }
+ case Operation::USHORT:
+ {
+ l.append(*(short*)operation.getReturnValue());
+ break;
+ }
+ case Operation::UINT:
+ {
+ l.append(*(long*)operation.getReturnValue());
+ break;
+ }
+ case Operation::ULONG:
+ {
+ l.append(*(long*)operation.getReturnValue());
+ break;
+ }
+ case Operation::FLOAT:
+ {
+ l.append(*(float*)operation.getReturnValue());
+ break;
+ }
+ case Operation::DOUBLE:
+ {
+ l.append(*(long double*)operation.getReturnValue());
+ break;
+ }
+ case Operation::LONGDOUBLE:
+ {
+ l.append(*(long double*)operation.getReturnValue());
+ break;
+ }
+ case Operation::CHARS:
+ {
+ l.append(*(char**)operation.getReturnValue());
+ break;
+ }
+ case Operation::STRING:
+ {
+ l.append((*(string*)operation.getReturnValue()).c_str());
+ break;
+ }
+ case Operation::DATAOBJECT:
+ {
+ l.append(*(DataObjectPtr*)operation.getReturnValue());
+ break;
+ }
+ default:
+ {
+ string msg = "Unsupported parameter type";
+ msg += resultType;
+ throw msg.c_str();
+ }
+ }
+ }
+ else
+ {
+ LOGINFO(4, "No return values are defined");
+ }
+ }
+ else {
+
+ // Should only be one return value.. This goes through all return values
+ for(int i=0; i<pl.size(); i++)
+ {
+ const char* name = pl[i].getName();
+
+ Operation::ParameterType resultType = operation.getReturnType();
+ switch(resultType)
+ {
+ case Operation::BOOL:
+ {
+ outputDataObject->setBoolean(pl[i], *(bool*)operation.getReturnValue());
+ break;
+ }
+ case Operation::SHORT:
+ {
+ outputDataObject->setShort(pl[i], *(short*)operation.getReturnValue());
+ break;
+ }
+ case Operation::INT:
+ {
+ outputDataObject->setInteger(pl[i], *(int*)operation.getReturnValue());
+ break;
+ }
+ case Operation::LONG:
+ {
+ outputDataObject->setInteger(pl[i], *(long*)operation.getReturnValue());
+ break;
+ }
+ case Operation::USHORT:
+ {
+ outputDataObject->setInteger(pl[i], *(unsigned short*)operation.getReturnValue());
+ break;
+ }
+ case Operation::UINT:
+ {
+ outputDataObject->setInteger(pl[i], *(unsigned int*)operation.getReturnValue());
+ break;
+ }
+ case Operation::ULONG:
+ {
+ outputDataObject->setInteger(pl[i], *(unsigned long*)operation.getReturnValue());
+ break;
+ }
+ case Operation::FLOAT:
+ {
+ outputDataObject->setFloat(pl[i], *(float*)operation.getReturnValue());
+ break;
+ }
+ case Operation::DOUBLE:
+ {
+ outputDataObject->setDouble(pl[i], *(double*)operation.getReturnValue());
+ break;
+ }
+ case Operation::LONGDOUBLE:
+ {
+ outputDataObject->setDouble(pl[i], *(long double*)operation.getReturnValue());
+ break;
+ }
+ case Operation::CHARS:
+ {
+ if(*(char**)operation.getReturnValue() != NULL)
+ {
+ outputDataObject->setCString(pl[i], *(char**)operation.getReturnValue());
+ }
+ else
+ {
+ LOGINFO_1(4, "Return value is NULL, so leaving property %s unset", pl[i].getName());
+ }
+ break;
+ }
+ case Operation::STRING:
+ {
+ outputDataObject->setCString(pl[i], (*(string*)operation.getReturnValue()).c_str());
+ break;
+ }
+ case Operation::DATAOBJECT:
+ {
+
+ if(*(DataObjectPtr*)operation.getReturnValue() != NULL)
+ {
+ outputDataObject->setDataObject(pl[i], *(DataObjectPtr*)operation.getReturnValue());
+ }
+ else
+ {
+ LOGINFO_1(4, "Return value is NULL, so leaving property %s unset", pl[i].getName());
+ }
+
+ break;
+ }
+ default:
+ {
+ string msg = "Unsupported parameter type";
+ msg += resultType;
+ throw msg.c_str();
+ }
+ }
+ }
+ }
+ }
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h
new file mode 100644
index 0000000000..82ab4385f2
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h
@@ -0,0 +1,96 @@
+/*
+ * 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$ */
+
+#ifndef tuscany_sca_extension_ws_wsserviceproxy_h
+#define tuscany_sca_extension_ws_wsserviceproxy_h
+
+#include "tuscany/sca/core/ServiceProxy.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/WSDLOperation.h"
+#include "model/WSReferenceBinding.h"
+#include "commonj/sdo/SDO.h"
+
+using namespace tuscany::sca::model;
+
+using commonj::sdo::DataObjectPtr;
+using commonj::sdo::DataFactoryPtr;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ /**
+ * Holds a proxy for a given component and reference.
+ * The proxy which is held inside a ServiceProxy will be specific to the programming
+ * interface expected by the client. In this particular case the client is an Axis2
+ * Web service skeleton.
+ */
+ class WSServiceProxy : public ServiceProxy
+ {
+ public:
+ /**
+ * Create a new service proxy for a reference. The proxy will contain a pointer to
+ * the target ServiceWrapper.
+ * @param reference The reference on the source component.
+ * @param target The wrapper of the service which is wired to this reference.
+ */
+ WSServiceProxy(Reference* reference);
+
+ /**
+ * Create a new service proxy for a service. The proxy will contain a pointer to
+ * the target ServiceWrapper.
+ * @param reference The service on the target component.
+ * @param target The wrapper of the target service.
+ */
+ WSServiceProxy(Service* service);
+
+ /**
+ * Destructor.
+ */
+ virtual ~WSServiceProxy();
+
+ /**
+ * Invoke the specified operation
+ */
+ DataObjectPtr invoke(const WSDLOperation& wsdlOperation, DataObjectPtr inputDataObject);
+
+ private:
+
+ void setOutputData(Operation& operation, DataObjectPtr outputDataObject, DataFactoryPtr dataFactoryPtr);
+
+ /**
+ * The target service wrapper
+ */
+ ServiceWrapper* serviceWrapper;
+
+ };
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_extension_ws_wsserviceproxy_h
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.cpp
new file mode 100644
index 0000000000..23ecc133e8
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.cpp
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/ws/model/WSReferenceBinding.h"
+#include "tuscany/sca/core/ServiceProxy.h"
+#include "tuscany/sca/ws/WSServiceProxy.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+
+ // Constructor
+ WSReferenceBinding::WSReferenceBinding(Reference* reference, const string& uri, const string& endpoint, const string&version)
+ : ReferenceBinding(reference, uri), endpoint(endpoint), soapVersion(version)
+ {
+ parseEndpoint();
+ }
+
+ void WSReferenceBinding::parseEndpoint()
+ {
+ // Endpoint is of the form: <wsdl-namepace-uri>#wsdl.endpoint(<service-name>/<endpoint-name>)
+ string::size_type hash = endpoint.find("#");
+ if (hash != string::npos)
+ {
+ // Found a hash
+
+ // Namepace is the part before the #
+ wsdlNamespaceURL = endpoint.substr(0, hash);
+
+
+ if ( (hash+1) < endpoint.length())
+ {
+ // Check the next part is wsdl.endpoint(
+ int ending = hash+15;
+ string check = endpoint.substr(hash+1, 14);
+ if (check.compare("wsdl.endpoint(") == 0)
+ {
+ // Find the matching )
+ int endBracket = endpoint.find(")",ending);
+ if (endBracket-1 > ending+1)
+ {
+ string serviceAndEndpoint = endpoint.substr(ending, endBracket-ending);
+ // Look for a '/'
+ string::size_type slash = serviceAndEndpoint.find("/");
+ if (slash != string::npos)
+ {
+ serviceName = serviceAndEndpoint.substr(0, slash);
+
+ if ( (slash+1) < serviceAndEndpoint.length())
+ {
+ endpointName = serviceAndEndpoint.substr(slash+1);
+ }
+ else
+ {
+ endpointName = "";
+ }
+
+ }
+ else
+ {
+ // No '/' so all of it is the service name
+ serviceName = serviceAndEndpoint;
+ endpointName = "";
+
+ }
+ }
+ else
+ {
+ // Nothing between the ()
+ serviceName = "";
+ endpointName = "";
+ }
+ }
+ else
+ {
+ // not the correct characters after the #, ignore the rest
+ serviceName = "";
+ endpointName = "";
+ }
+
+ }
+ else
+ {
+ // Nothing after the hash
+ serviceName = "";
+ endpointName = "";
+ }
+ }
+ else
+ {
+ // No hash at all
+ wsdlNamespaceURL = endpoint;
+ serviceName = "";
+ endpointName = "";
+ }
+ }
+
+ // Destructor
+ WSReferenceBinding::~WSReferenceBinding()
+ {
+ }
+
+ void WSReferenceBinding::configure(ServiceBinding *binding)
+ {
+ targetServiceBinding = binding;
+
+ serviceProxy = new WSServiceProxy(getReference());
+ }
+
+ ServiceProxy* WSReferenceBinding::getServiceProxy()
+ {
+ return serviceProxy;
+ }
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.h b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.h
new file mode 100644
index 0000000000..90e28e326b
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/model/WSReferenceBinding.h
@@ -0,0 +1,153 @@
+/*
+ * 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$ */
+
+#ifndef tuscany_sca_extension_ws_model_wsreferencebinding_h
+#define tuscany_sca_extension_ws_model_wsreferencebinding_h
+
+#include "tuscany/sca/model/ReferenceBinding.h"
+
+using namespace tuscany::sca::model;
+
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace ws
+ {
+ /**
+ * Information about a web service binding for service or a reference.
+ */
+ class WSReferenceBinding : public ReferenceBinding
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param uri The uri of the binding.
+ * @param endpoint The definition of the endpoint to which the entrypoint
+ * or external service is to be bound. This is of the form
+ * "namespace"#endpoint("service"/"endpoint")
+ */
+ WSReferenceBinding(Reference* reference, const string&uri, const string& endpoint, const string& version);
+
+ /**
+ * Destructor.
+ */
+ virtual ~WSReferenceBinding();
+
+ /**
+ * Returns the type of binding.
+ */
+ virtual string getType() { return "http://www.osoa.org/xmlns/sca/1.0#WebServiceBinding"; };
+
+ /**
+ * Configure this binding from a service binding.
+ */
+ virtual void configure(ServiceBinding* serviceBinding);
+
+ /**
+ * Create a proxy representing the reference to the
+ * client component.
+ */
+ virtual ServiceProxy* getServiceProxy();
+
+ /**
+ * Return the part of the endpoint definition describing the wsdl
+ * namespace.
+ * @return The wsdl namespace.
+ */
+ string getWSDLNamespaceURL() const { return wsdlNamespaceURL; };
+
+ /**
+ * Return the service part of the endpoint definition.
+ * @return The service to use.
+ */
+ string getServiceName() const { return serviceName; };
+
+ /**
+ * Return the endpoint name part of the endpoint definition.
+ * @return The endpoint name to use.
+ */
+ string getEndpointName() const { return endpointName; };
+
+ /**
+ * Return the SOAP version.
+ * @return The SOAP version to use.
+ */
+ string getSOAPVersion() const { return soapVersion; };
+
+ /**
+ * Returns the target service binding.
+ */
+ ServiceBinding* getTargetServiceBinding() const { return targetServiceBinding; };
+
+ private:
+
+ /**
+ * Parse the endpoint specification.
+ */
+ void parseEndpoint();
+
+ /**
+ * The full endpoint string.
+ */
+ string endpoint;
+
+ /**
+ * Namespace from the endpoint.
+ */
+ string wsdlNamespaceURL;
+
+ /**
+ * Service name from the endpoint.
+ */
+ string serviceName;
+
+ /**
+ * Endpoint name from the endpoint.
+ */
+ string endpointName;
+
+ /**
+ * SOAP version.
+ */
+ string soapVersion;
+
+ /**
+ * The proxy representing the reference to the client
+ * component.
+ */
+ ServiceProxy* serviceProxy;
+
+ /**
+ * The service binding of the target
+ */
+ ServiceBinding* targetServiceBinding;
+ };
+
+ } // End namespace ws
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_extension_ws_model_wsreferencebinding_h
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/deploy.bat b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/deploy.bat
new file mode 100644
index 0000000000..0722342b03
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/deploy.bat
@@ -0,0 +1,73 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sca root not specified
+goto usage
+)
+set rootdir=%1
+set deploydir=%rootdir%\deploy
+set extdir=%deploydir%\extensions
+set wsextdir=%extdir%\ws
+set svcextdir=%wsextdir%\service
+set svcsdir=%svcextdir%\services
+set srcdir=%rootdir%\runtime\extensions\ws\service\axis2c\src
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+if not exist %deploydir% mkdir %deploydir%
+if not exist %extdir% mkdir %extdir%
+if not exist %wsextdir% mkdir %wsextdir%
+if not exist %svcextdir% mkdir %svcextdir%
+if not exist %svcextdir%\bin mkdir %svcextdir%\bin
+if not exist %svcextdir%\lib mkdir %svcextdir%\lib
+
+set libname=tuscany_sca_ws_service
+
+del %svcextdir%\bin\%libname%.*
+del %svcextdir%\lib\%libname%.*
+
+copy %inpath%\%libname%.lib %svcextdir%\lib
+copy %inpath%\%libname%.dll %svcextdir%\bin
+
+if exist %inpath%\%libname%.pdb copy %inpath%\%libname%.pdb %svcextdir%\bin
+
+if not exist %svcsdir% mkdir %svcsdir%
+if not exist %svcsdir%\tuscany mkdir %svcsdir%\tuscany
+
+copy %srcdir%\axis2.xml %svcextdir%
+copy %srcdir%\deploy.cmd %svcextdir%
+copy %srcdir%\services.xml %svcsdir%\tuscany
+copy %inpath%\%libname%.dll %svcsdir%\tuscany
+if exist %inpath%\%libname%.pdb copy %inpath%\%libname%.pdb %svcsdir%\tuscany
+
+goto end
+:usage
+echo Usage: deploy <sca-root> <build-output>
+:end
+
+endlocal
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/deploymodule.bat b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/deploymodule.bat
new file mode 100644
index 0000000000..246728b6b2
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/service/deploymodule.bat
@@ -0,0 +1,69 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sca root not specified
+goto usage
+)
+set rootdir=%1
+set deploydir=%rootdir%\deploy
+set extdir=%deploydir%\extensions
+set wsextdir=%extdir%\ws
+set svcextdir=%wsextdir%\service
+set modsdir=%svcextdir%\modules
+set srcdir=%rootdir%\runtime\extensions\ws\service\axis2c\src
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+if not exist %deploydir% mkdir %deploydir%
+if not exist %extdir% mkdir %extdir%
+if not exist %wsextdir% mkdir %wsextdir%
+
+set libname=tuscany_sca_ws_dispatcher
+
+del %svcextdir%\bin\%libname%.*
+del %svcextdir%\lib\%libname%.*
+
+copy %inpath%\%libname%.lib %svcextdir%\lib
+copy %inpath%\%libname%.dll %svcextdir%\bin
+
+if exist %inpath%\%libname%.pdb copy %inpath%\%libname%.pdb %svcextdir%\bin
+
+
+if not exist %modsdir% mkdir %modsdir%
+if not exist %modsdir%\tuscany mkdir %modsdir%\tuscany
+
+copy %srcdir%\module.xml %modsdir%\tuscany
+copy %inpath%\%libname%.dll %modsdir%\tuscany
+if exist %inpath%\%libname%.pdb copy %inpath%\%libname%.pdb %modsdir%\tuscany
+
+goto end
+:usage
+echo Usage: deploy <sca-root> <build-output>
+:end
+
+endlocal
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/xsd/sca-binding-webservice.xsd b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/xsd/sca-binding-webservice.xsd
new file mode 100644
index 0000000000..2c1c2abbcc
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/runtime/extensions/ws/xsd/sca-binding-webservice.xsd
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <element name="binding.ws" type="sca:WebServiceBinding" substitutionGroup="sca:binding"/>
+ <complexType name="WebServiceBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <element name="soapbinding" type="sca:SOAPBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="endpoint" type="anyURI" use="optional" />
+ <attribute name="location" type="anyURI" use="optional" />
+ <attribute name="conformanceURIs" type="sca:ConformanceURIList" use="optional" />
+ <attribute name="interfaceMapping" type="string" use="optional" />
+ <anyAttribute namespace="##any" processContents="lax" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="SOAPBinding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="name" type="NCName" use="optional" />
+ <attribute name="version" type="string" use="optional" />
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <simpleType name="ConformanceURIList">
+ <list itemType="anyURI"/>
+ </simpleType>
+</schema>