You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/11/26 11:49:29 UTC

svn commit: r479335 - in /incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws: Axis2Service.cpp WSServiceProxy.cpp

Author: jsdelfino
Date: Sun Nov 26 02:49:28 2006
New Revision: 479335

URL: http://svn.apache.org/viewvc?view=rev&rev=479335
Log:
Code cleanup, improved exception handling and error reporting, moved global functions to the tuscany::sca::ws namespace, adjusted the logic in initSCARuntime to stop caching state locally as the SCA runtime can be reset/switched by another binding co-existing in the server.

Modified:
    incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp
    incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp

Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp?view=diff&rev=479335&r1=479334&r2=479335
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp Sun Nov 26 02:49:28 2006
@@ -29,14 +29,8 @@
 #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 "tuscany/sca/util/Logging.h"
@@ -55,513 +49,518 @@
 #include "tuscany/sca/util/Utils.h"
 #include "Axis2Utils.h"
 
+#include <sstream>
+
+using commonj::sdo::DataObjectPtr;
+using commonj::sdo::DataFactoryPtr;
+using commonj::sdo::DataObjectList;
+using commonj::sdo::PropertyList;
+using commonj::sdo_axiom::AxiomHelper;
+
 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)
+namespace tuscany
 {
-    /*if(svc_skeleton->func_array)
+    namespace sca
     {
-        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; 
-}
-
- 
-static SCARuntime* scaRuntime = NULL;
-static CompositeService* compositeService = NULL;
-
-static string serviceName = "";
-
-/**
- * Initialize the SCA runtime
- */
-static void initializeSCARuntime(const char* root, const char *component, const char* service)
-{
-    logentry();
-    loginfo("Root: %s, component: %s, service: %s", root, component, service);
-    
-    try
-    {
-
-        bool restart = false;
-        bool resolve = false;
-
-        string systemRoot = SCARuntime::getSystemRoot();
-        if (systemRoot != root)
-        {
-            systemRoot = root;
-            restart = true;
-            resolve = true;
-        }
-
-        string componentName = SCARuntime::getDefaultComponentName();
-        if (componentName != component)
+        namespace ws
         {
-            componentName = component;
-            resolve = true;
-        }
         
-        if (serviceName != service)
-        {
-            serviceName = service;
-            resolve = true;
-        }
-        
-        if (scaRuntime == NULL)
-        {
-            loginfo("Creating new SCA runtime");
-            SCARuntime::setSystemRoot(systemRoot);
-            SCARuntime::setSystemPath("");
-            SCARuntime::setDefaultComponentName(componentName);
-            scaRuntime = SCARuntime::getInstance();
-        }
-        else if (restart)
-        {
-            loginfo("Restarting SCA runtime");
-            SCARuntime::releaseInstance();
-            SCARuntime::setSystemRoot(systemRoot);
-            SCARuntime::setSystemPath("");
-            SCARuntime::setDefaultComponentName(componentName);
-            scaRuntime = SCARuntime::getInstance();
-        }
-        else if (resolve)
-        {
-            loginfo("Refreshing SCA runtime");
-            SCARuntime::releaseInstance();
-            SCARuntime::setSystemRoot(systemRoot);
-            SCARuntime::setSystemPath("");
-            SCARuntime::setDefaultComponentName(componentName);
-            scaRuntime = SCARuntime::getInstance();
-        }
-
-        if (compositeService == NULL)
-        {
-            loginfo("Resolving composite: %s, service: %s", componentName.c_str(), serviceName.c_str());
-            Component* component = scaRuntime->getDefaultComponent();
-            if (component == NULL)
+            int AXIS2_CALL
+            Axis2Service_free(axis2_svc_skeleton_t *svc_skeleton,
+                      const axis2_env_t *env);
+            
+            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_CALL
+            axis2_Axis2Service_create(axis2_env_t *env);
+            
+            axis2_svc_skeleton_t*
+            axis2_Axis2Service_create(axis2_env_t *env)
             {
-                string msg = "Component not found " + componentName;
-                throwException(SystemConfigurationException, msg.c_str());
+                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;
             }
-            Composite* composite = (Composite*)component->getType();
-            compositeService = (CompositeService*)composite->findComponent(serviceName);
-            if (compositeService == NULL)
+            
+            int AXIS2_CALL
+            Axis2Service_init(axis2_svc_skeleton_t *svc_skeleton,
+                                    const axis2_env_t *env)
             {
-                string msg = "Composite service not found " + serviceName;
-                throwException(SystemConfigurationException, msg.c_str());
+                // This method never seems to be called - an old Axis2C artifact?
+            
+                svc_skeleton->func_array = axis2_array_list_create(env, 0);
+                return AXIS2_SUCCESS;
             }
-        }
-        else
-        {
-            if (resolve)
+            
+            int AXIS2_CALL
+            Axis2Service_free(axis2_svc_skeleton_t *svc_skeleton,
+                        const axis2_env_t *env)
             {
-                loginfo("Switching to composite: %s, service: %s", componentName.c_str(), serviceName.c_str());
-                Component* component = scaRuntime->getDefaultComponent();
-                if (component == NULL)
+                if(svc_skeleton->ops)
                 {
-                    string msg = "Component not found " + componentName;
-                    throwException(SystemConfigurationException, msg.c_str());
+                    AXIS2_FREE((env)->allocator, svc_skeleton->ops);
+                    svc_skeleton->ops = NULL;
                 }
-                Composite* composite = (Composite*)component->getType();
-                compositeService = (CompositeService*)composite->findComponent(serviceName);
-                if (compositeService == NULL)
+                
+                if(svc_skeleton)
                 {
-                    string msg = "Composite service not found " + serviceName;
-                    throwException(SystemConfigurationException, msg.c_str());
+                    AXIS2_FREE((env)->allocator, svc_skeleton);
+                    svc_skeleton = NULL;
                 }
+                return AXIS2_SUCCESS; 
             }
-            else
-            {
-                loginfo("Reusing composite: %s, service: %s", componentName.c_str(), serviceName.c_str());
-            }
-        }
-    }
-    catch(TuscanyRuntimeException &ex)
-    {
-        logerror("Failed to initialize SCA runtime: %s", (const char*)ex);
-        throw;
-    }  
-}
-
-
-/*
- * 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)
-{
-    logentry();
-
-    try
-    {    
-        if (node)
-        {
-            if (AXIOM_NODE_GET_NODE_TYPE(node, env) == AXIOM_ELEMENT)
+            
+             
+            /**
+             * Initialize the SCA runtime
+             */
+            CompositeService* initializeSCARuntime(const char* root, const char* path, const char *component, const char* service)
             {
-                axiom_element_t *element = NULL;
-                element = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(node, env);
-                if (element)
+                logentry();
+                loginfo("Root: %s, path: %s, component: %s, service: %s", root, path, component, service);
+                
+                try
                 {
-                    string op_name = "";
+                    bool restart = false;
+                    bool resolve = false;
+            
+                    string systemRoot = SCARuntime::getSystemRoot();
+                    if (systemRoot != root)
+                    {
+                        systemRoot = root;
+                        restart = true;
+                        resolve = true;
+                    }
+            
+                    string systemPath = SCARuntime::getSystemPath();
+                    if (systemPath != path)
+                    {
+                        systemPath = path;
+                        restart = true;
+                        resolve = true;
+                    }
+            
+                    string componentName = SCARuntime::getDefaultComponentName();
+                    if (componentName != component)
+                    {
+                        componentName = component;
+                        resolve = true;
+                    }
                     
-                    axis2_bool_t rest = AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env);
-                    if (rest)
+                    string serviceName = service;
+            
+                    SCARuntime* scaRuntime;
+                    if (restart)
                     {
-                        axis2_endpoint_ref_t *endpoint_ref = AXIS2_MSG_CTX_GET_FROM(msg_ctx, env);
-                        if (endpoint_ref)
-                        {
-                            const axis2_char_t *addr = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
-                            if (addr)
-                            {
-                                // REST request, the op name is the last segment of the path
-                                string raddress = addr;
-                                string path;
-                                string query;
-                                Utils::tokeniseString("?", raddress, path, query);
-                                string uri;
-                                Utils::rTokeniseString("/", path, uri, op_name);
-                            }
-                        }
+                        loginfo("Starting SCA runtime");
+                        SCARuntime::releaseInstance();
+                        SCARuntime::setSystemRoot(systemRoot);
+                        SCARuntime::setSystemPath(systemPath);
+                        SCARuntime::setDefaultComponentName(componentName);
+                        scaRuntime = SCARuntime::getInstance();
+                    }
+                    else if (resolve)
+                    {
+                        loginfo("Starting SCA runtime");
+                        SCARuntime::releaseInstance();
+                        SCARuntime::setSystemRoot(systemRoot);
+                        SCARuntime::setSystemPath(systemPath);
+                        SCARuntime::setDefaultComponentName(componentName);
+                        scaRuntime = SCARuntime::getInstance();
                     }
                     else
                     {
-                        // SOAP request                
-                        // Get the operation name from the root element name, this is correct for DocLit Wrapped style
-                        op_name = AXIOM_ELEMENT_GET_LOCALNAME(element, env);
+                        scaRuntime = SCARuntime::getInstance();
                     }
-                    
-                    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)
-                        {
-                            loginfo("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);
-                    
-                            initializeSCARuntime(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);
-                            string address = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
-                            
-                            axis2_bool_t isrest = AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env);
-                            string path;
-                            if (isrest)
-                            {
-                                string op;
-                                Utils::rTokeniseString("/", address, path, op);
-                            }
-                            else
-                            {
-                                path = address;
-                            }
-    
-                            string path2;                        
-                            string service;
-                            Utils::rTokeniseString("/", path, path2, service);
-                            
-                            string path3;
-                            string component;
-                            Utils::rTokeniseString("/", path2, path3, component);
-                            if (component == "services")
-                            {
-                                component = "";
-                            }
-                            
-                            loginfo("System root: %s, component name: %s, service name: %s, operation name: %s",
-                                rootParam, component.c_str(), service.c_str(), op_name.c_str());
-                            
-                            initializeSCARuntime(rootParam, component.c_str(), service.c_str());
-                        }
-    
-                        if(!compositeService)
-                        {
-                   		    logerror("Failed to initialize SCA runtime, could not initialize CompositeService");
-                            return 0;
-                        }
-    
-                        DataFactoryPtr dataFactory = compositeService->getComposite()->getDataFactory();
-                        if (dataFactory == 0)
-                        {
-                            logerror("Failed to initialize SCA runtime, could not get DataFactory");
-                            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)
-                            {
-                                string msg = "WSDL not found for: " + wsdlNamespace;
-                                throwException(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)
-                            {   
-                                throw;
-                            }
-                            
-                        }
-                        else
+            
+                    loginfo("Resolving composite: %s, service: %s", componentName.c_str(), serviceName.c_str());
+                    Component* compositeComponent = scaRuntime->getDefaultComponent();
+                    if (compositeComponent == NULL)
+                    {
+                        string msg = "Component not found " + componentName;
+                        throwException(SystemConfigurationException, msg.c_str());
+                    }
+                    Composite* composite = (Composite*)compositeComponent->getType();
+                    CompositeService* compositeService = (CompositeService*)composite->findComponent(serviceName);
+                    if (compositeService == NULL)
+                    {
+                        string msg = "Composite service not found " + serviceName;
+                        throwException(SystemConfigurationException, msg.c_str());
+                    }
+                
+                    return compositeService;  
+                }
+                catch(TuscanyRuntimeException &ex)
+                {
+                    ostringstream msg;
+                    msg << ex;
+                    logerror("Failed to initialize SCA runtime: %s", msg.str().c_str());
+                    throw;
+                }
+            }
+            
+            
+            /*
+             * 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)
+            {
+                logentry();
+            
+                try
+                {    
+                    if (node)
+                    {
+                        if (AXIOM_NODE_GET_NODE_TYPE(node, env) == AXIOM_ELEMENT)
                         {
-                            Interface* iface = reference->getType()->getInterface();
-                            if (iface != NULL &&
-                                iface->getInterfaceTypeQName() == WSDLInterface::typeQName)
+                            axiom_element_t *element = NULL;
+                            element = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(node, env);
+                            if (element)
                             {
-                                WSDLInterface* wsdlInterface = (WSDLInterface*)iface;
-                                wsdlNamespace = wsdlInterface->getNamespaceURI();
+                                string op_name = "";
                                 
-                                if (wsdlNamespace != "")
+                                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 *addr = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
+                                        if (addr)
+                                        {
+                                            // REST request, the op name is the last segment of the path
+                                            string raddress = addr;
+                                            string path;
+                                            string query;
+                                            Utils::tokeniseString("?", raddress, path, query);
+                                            string uri;
+                                            Utils::rTokeniseString("/", path, uri, op_name);
+                                        }
+                                    }
+                                }
+                                else
                                 {
+                                    // SOAP request                
+                                    // Get 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 != "")
+                				{
+                                    CompositeService* compositeService;
+                                    
+                                    // Get the Tuscany system root, path and composite service name from the Axis2
+                                    // service parameters 
+                                    char* rootParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyRoot");
+                                    if (rootParam == NULL)
+                                        rootParam = "";
+                                    
+                                    char* pathParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyPath");
+                                    if (pathParam == NULL)
+                                        pathParam = "";
+                                    
+                                    char* serviceParam = Axis2Utils::getAxisServiceParameterValue(env, msg_ctx, "TuscanyService");
+                                    if (serviceParam != NULL)
+                                    {
+                                        loginfo("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);
+                                
+                                        compositeService = initializeSCARuntime(rootParam, pathParam, 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);
+                                        string address = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
+                                        
+                                        axis2_bool_t isrest = AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env);
+                                        string path;
+                                        if (isrest)
+                                        {
+                                            string op;
+                                            Utils::rTokeniseString("/", address, path, op);
+                                        }
+                                        else
+                                        {
+                                            path = address;
+                                        }
+                
+                                        string path2;                        
+                                        string service;
+                                        Utils::rTokeniseString("/", path, path2, service);
+                                        
+                                        string path3;
+                                        string component;
+                                        Utils::rTokeniseString("/", path2, path3, component);
+                                        if (component == "services")
+                                        {
+                                            component = "";
+                                        }
+                                        
+                                        loginfo("System root: %s, component name: %s, service name: %s, operation name: %s",
+                                            rootParam, component.c_str(), service.c_str(), op_name.c_str());
+                                        
+                                        compositeService = initializeSCARuntime(rootParam, pathParam, component.c_str(), service.c_str());
+                                    }
+                
+                                    if(!compositeService)
+                                    {
+                               		    throwException(SystemConfigurationException, 
+                                            "Failed to initialize SCA runtime, could not initialize CompositeService");
+                                    }
+                
+                                    DataFactoryPtr dataFactory = compositeService->getComposite()->getDataFactory();
+                                    if (dataFactory == 0)
+                                    {
+                                        throwException(SystemConfigurationException, 
+                                            "Failed to initialize SCA runtime, could not get DataFactory");
+                                    }
+                
+                                    // Get the WS binding and the WSDL operation
+                                    Composite* composite = compositeService->getComposite();
+                                    Reference* reference = compositeService->getReference();
+                                    WSReferenceBinding* binding = (WSReferenceBinding*)reference->getBinding();
+                                    WSDLOperation wsdlOperation;
+                                     
+                                    // First use the WSDL definition specified in the binding 
+                                    string wsdlNamespace = binding->getWSDLNamespaceURL();
+                                    if (wsdlNamespace != "")
+                                    {
+                                        WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(wsdlNamespace);
+                                        if (wsdlDefinition == 0)
+                                        {
+                                            string msg = "WSDL not found for: " + wsdlNamespace;
+                                            throwException(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)
+                                        {   
+                                            throw;
+                                        }
+                                        
+                                    }
+                                    else
+                                    {
+                                        // Then use the WSDL definition specified in the WSDL interface, if any
+                                        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)
+                                                {
+                                                    string msg = "WSDL not found for: " + wsdlNamespace;
+                                                    throwException(SystemConfigurationException, msg.c_str());
+                                                }
+                                        
+                                                try
+                                                {
+                                                    wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name.c_str());
+                                                }
+                                                catch(SystemConfigurationException& ex)
+                                                {   
+                                                    throw;
+                                                }
+                                            }
+                                        }
+                                    }
+                                    
+                                    // No WSDL definition was specified in the binding or interface
+                                    // Create a default document literal wrapped WSDL operation
+                                    if (wsdlNamespace == "")
+                                    {
+                                        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(string("http://tempuri.org") + "#" + op_name);
+                                        wsdlOperation.setOutputType(string("http://tempuri.org") + "#" + op_name + "Response");
+                                    }
+                                    else if (!wsdlOperation.isDocumentStyle() || !wsdlOperation.isWrappedStyle())
+                                    {
+                                        throwException(ServiceInvocationException,
+                                            "Only wrapped document style WSDL operations are currentlysupported");
+                                    }
+                
+                                    // 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)
+                                    {
+                                        loginfo("Received request Axis2 OM: %s", str);
+                                    }
+                
+                                    // Convert the SOAP body to an SDO DataObject
+                                    DataObjectPtr inputBodyDataObject = NULL;
+                                    DataObjectPtr inputDataObject = NULL; 
+
+                                    AxiomHelper* axiomHelper = AxiomHelper::getHelper();
+                
+                                    try
+                                    {
+                                        inputBodyDataObject = axiomHelper->toSdo(body, dataFactory);
+                                        if(!inputBodyDataObject)
+                                        {
+                                            string msg = "Could not convert request Axis2 OM to SDO";
+                                            throwException(ServiceInvocationException, msg.c_str());
+                                        }                    
+                    
+                                        // Get the first body part representing the doc-lit-wrapped wrapper element
+                                        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)
+                                        {
+                                            string msg = "Could not convert Axis2 body part to SDO";
+                                            throwException(ServiceInvocationException, msg.c_str());
+                                        }
+                                    }
+                                    catch(SDORuntimeException &ex)
+                                    {
+                                        throwException(ServiceDataException, ex);
+                                    }
+                
+                                    //  Dispatch to the WS proxy
+                                    WSServiceProxy* proxy = (WSServiceProxy*)binding->getServiceProxy();
+                
+                                    DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject);
                                     
-                                    WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace);
-                                    if (wsdl == 0)
+                                    if(!outputDataObject)
                                     {
-                                        string msg = "WSDL not found for: " + wsdlNamespace;
-                                        throwException(SystemConfigurationException, msg.c_str());
+                                        return 0;
                                     }
-                            
+                                    
                                     try
                                     {
-                                        wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name.c_str());
+                                        // 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)
+                                        {
+                                            loginfo("Sending response Axis2 OM : %s", str);
+                                        }
+                                        
+                    					return outputNode;
                                     }
-                                    catch(SystemConfigurationException& ex)
-                                    {   
-                                        throw;
+                                    catch(SDORuntimeException &ex)
+                                    {
+                                        throwException(ServiceDataException, ex);
                                     }
                                 }
                             }
                         }
-                        
-                        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(string("http://tempuri.org") + "#" + op_name);
-                            wsdlOperation.setOutputType(string("http://tempuri.org") + "#" + 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)
-                        {
-                            loginfo("Received request Axis2 OM: %s", 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)
-                        {
-                            throw;
-                        }
-    
-                        if(!inputBodyDataObject)
-                        {
-                            string msg = "Could not convert request Axis2 OM to SDO";
-                            throwException(ServiceInvocationException, msg.c_str());
-                        }                    
-    
-                        // 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)
-                        {
-                            string msg = "Could not convert Axis2 body part to SDO";
-                            throwException(ServiceInvocationException, msg.c_str());
-                        }
-    
-                        //  Dispatch to the WS proxy
-                        WSServiceProxy* proxy = (WSServiceProxy*)binding->getServiceProxy();
-    
-                        DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject);
-                        
-                        if(!outputDataObject)
-                        {
-                            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)
-                        {
-                            loginfo("Sending response Axis2 OM : %s", str);
-                        }
-                            
-    					return outputNode;
                     }
+                    
+                	string msg = "Invalid parameters in Axis2 request OM";
+                    throwException(ServiceInvocationException, msg.c_str());
+            
                 }
+                catch(TuscanyRuntimeException& ex)
+                {
+                    ostringstream msg;
+                    msg << ex;
+                    logerror("Failed to process Web service invocation: %s", msg.str().c_str());
+                }        
+                return 0;
             }
-        }
-        
-    	string msg = "Invalid parameters in Axis2 request OM";
-        throwException(ServiceInvocationException, msg.c_str());
-
-    }
-    catch(TuscanyRuntimeException& ex)
-    {
-        logerror("Failed to process Web service invocation: %s", (const char*)ex);
-    }        
-    return 0;
-}
 
+        } // End namespace ws
+    } // End namespace sca
+} // End namespace tuscany
 
 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))
+    
+    /**
+     * Following block distinguish the exposed part of the dll.
+     */
+    
+    AXIS2_EXPORT int axis2_get_instance(axis2_svc_skeleton **inst,
+                            axis2_env_t *env)
     {
-        return AXIS2_FAILURE;
+        *inst = axis2_Axis2Service_create(env);
+        if(!(*inst))
+        {
+            return AXIS2_FAILURE;
+        }
+    
+        return AXIS2_SUCCESS;
     }
-
-    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);
+    
+    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;
     }
-    return status;
-}
 }

Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp?view=diff&rev=479335&r1=479334&r2=479335
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp Sun Nov 26 02:49:28 2006
@@ -121,9 +121,6 @@
                 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();
 
@@ -133,262 +130,220 @@
                 loginfo("WSDLOperation outputType: %s#%s",
                     outputTypeURI, 
                     outputTypeName);
-                loginfo("WSDLOperation documentStyle: %d, wrapped: %d",        
-                    documentStyle,
-                    wrappedStyle);
                 
-                if (documentStyle)
+                try
                 {
-                    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++)
+                    // 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()) 
                         {
-                            const char* name = pl[i].getName();
-                    
-                            switch (pl[i].getTypeEnum()) 
+                        case Type::BooleanType:
                             {
-                            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:
+                                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)
                                 {
-                                    long double* doubleData = new long double;
-                                    *doubleData = inputDataObject->getDouble(pl[i]);
-                                    operation.addParameter(doubleData);
+                                    bytesData[bytesWritten] = 0;
                                 }
-                                break;
-                            case Type::FloatType:
+                                else
                                 {
-                                    float* floatData = new float;
-                                    *floatData = inputDataObject->getFloat(pl[i]);
-                                    operation.addParameter(floatData); 
+                                    bytesData[len] = 0;
                                 }
-                                break;
-                            case Type::IntegerType:
+                                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]))
                                 {
-                                    long* intData = new long;
-                                    *intData = inputDataObject->getInteger(pl[i]);
-                                    operation.addParameter(intData);
+                                    stringData = new string(inputDataObject->getCString(pl[i]));                                        
                                 }
-                                break;
-                            case Type::ShortType:
+                                else
                                 {
-                                    short* shortData = new short;
-                                    *shortData = inputDataObject->getShort(pl[i]);
-                                    operation.addParameter(shortData);
+                                    // The data is not set, so pass an empty string as the parameter
+                                    stringData = new string();
                                 }
-                                break;
-                            case Type::StringType:
+                                operation.addParameter(stringData);
+                            }
+                            break;
+                        case Type::DataObjectType:
+                            {
+                                DataObjectPtr dataObjectData = inputDataObject->getDataObject(pl[i]);
+                                if(!dataObjectData)
                                 {
-                                    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);
+                                    loginfo("Null DataObject parameter named %s", name);
                                 }
-                                break;
-                            case Type::DataObjectType:
+                                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 = inputDataObject->getDataObject(pl[i]);
+                                    DataObjectPtr dataObjectData = dataObjectList[j];
                                     if(!dataObjectData)
                                     {
-                                        loginfo("Null DataObject parameter named %s", name);
+                                        
+                                        // Add a null DataObject ptr
+                                        loginfo("Null OpenDataObject parameter named %s[%d]", name, j);
+                                        operation.addParameter(&dataObjectData);
                                     }
-                                    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++)
+                                    else
                                     {
-                                        DataObjectPtr dataObjectData = dataObjectList[j];
-                                        if(!dataObjectData)
-                                        {
-                                            
-                                            // Add a null DataObject ptr
-                                            loginfo("Null OpenDataObject parameter named %s[%d]", name, j);
-                                            operation.addParameter(&dataObjectData);
-                                        }
-                                        else
+                                        
+                                        SequencePtr sequence = dataObjectData->getSequence();
+                                        if (sequence->size()!=0)
                                         {
-                                            
-                                            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("Null DataObject parameter named %s", name);
-                                                    }
-                                                    operation.addParameter(&dob);
-                                                }
+                                            // Add a text element        
+                                            if (sequence->isText(0))
+                                            {                                        
+                                                string* stringData = new string(sequence->getCStringValue(0));
+                                                operation.addParameter(stringData);
                                             }
                                             else
                                             {
-                                                // Empty content, add an empty string
-                                                loginfo("Empty OpenDataObject parameter named %s[%d]", name, j);
-                                                string* stringData = new string(""); 
-                                                operation.addParameter(stringData);
+                                                // Add a complex element DataObject
+                                                DataObjectPtr dob = sequence->getDataObjectValue(0);
+                                                if(!dob)
+                                                {
+                                                    loginfo("Null DataObject parameter named %s", name);
+                                                }
+                                                operation.addParameter(&dob);
                                             }
-                                        }                       
-                                    }
+                                        }
+                                        else
+                                        {
+                                            // Empty content, add an empty string
+                                            loginfo("Empty OpenDataObject parameter named %s[%d]", name, j);
+                                            string* stringData = new string(""); 
+                                            operation.addParameter(stringData);
+                                        }
+                                    }                       
                                 }
-                                break;
-                            case Type::DateType:
-                                logwarning("SDO DateType parameters are not yet supported (%s)", name);
-                                return NULL;
-                            case Type::LongType:
-                                logwarning("SDO LongType (int64_t) parameters are not yet supported (%s)", name);
-                                return NULL;
-                                break;
-                            case Type::UriType:
-                                logwarning("SDO UriType parameters are not yet supported (%s)", name);
-                                return NULL;
-                                break;
-                            case Type::BigDecimalType:
-                                logwarning("SDO BigDecimalType parameters are not yet supported (%s)", name);
-                                return NULL;
-                                break;
-                            case Type::BigIntegerType:
-                                logwarning("SDO BigIntegerType parameters are not yet supported (%s)", name);
-                                return NULL;
-                                break;
-                            default:
-                                logwarning("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&)
+                            break;
+                        default:
                             {
-                                try
-                                {
-                                    
-                                    // Create the output wrapper
-                                    const Type& outputType = dataFactoryPtr->getType(outputTypeURI, outputTypeName);
-                                    outputDataObject = dataFactoryPtr->create(outputType);
-                                }
-                                catch (SDORuntimeException&)
-                                {
-                                    // The output wrapper type is not known, create an open DataObject 
-                                    outputDataObject = dataFactoryPtr->create(Type::SDOTypeNamespaceURI, "OpenDataObject");
-                                }
+                                ostringstream msg;
+                                msg << "Unsupported param type: " << pl[i].getTypeEnum();
+                                throwException(SystemConfigurationException, msg.str().c_str());
                             }
+                        }         
+                    }
                             
-                            setOutputData(operation, outputDataObject, dataFactoryPtr);                            
-
-                            return outputDataObject;
-
-                        }
-                      catch(SDORuntimeException& ex)
-                      {   
-                            // TODO: Return more error information than just a null DataObject
-                            logwarning("%s has been caught: %s", ex.getEClassName(), ex.getMessageText());
-                            return NULL;
-                      }  
-                      catch(TuscanyRuntimeException& ex)
-                      {   
-                            // TODO: Return more error information than just a null DataObject
-                            logwarning("%s has been caught: %s", ex.getEClassName(), ex.getMessageText());
-                            return NULL;
-                      }  
+                    // 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);
                     }
-                    else
+                    catch (SDORuntimeException&)
                     {
-                        logwarning("Non-wrapped document style WSDL operations are not yet supported");
-                        return NULL;
+                        try
+                        {
+                            // Create the output wrapper
+                            const Type& outputType = dataFactoryPtr->getType(outputTypeURI, outputTypeName);
+                            outputDataObject = dataFactoryPtr->create(outputType);
+                        }
+                        catch (SDORuntimeException&)
+                        {
+                            // The output wrapper type is not known, create an open DataObject 
+                            outputDataObject = dataFactoryPtr->create(Type::SDOTypeNamespaceURI, "OpenDataObject");
+                        }
                     }
+                    
+                    setOutputData(operation, outputDataObject, dataFactoryPtr);                            
+
+                    return outputDataObject;
+
                 }
-                else
+                catch(SDORuntimeException& ex)
                 {
-                    // RPC style
-                    logwarning("RPC style WSDL Operations are not yet supported");
-                    return NULL;
-                }
+                    throwException(ServiceInvocationException, ex);                         
+                }  
+                catch(TuscanyRuntimeException& ex)
+                {
+                  throw;   
+                }  
             }
             
-            
+
             void WSServiceProxy::setOutputData(Operation& operation, DataObjectPtr outputDataObject, DataFactoryPtr dataFactoryPtr)
             {    
                 logentry();



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org