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/10/02 05:50:40 UTC

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

Author: jsdelfino
Date: Sun Oct  1 20:50:39 2006
New Revision: 451866

URL: http://svn.apache.org/viewvc?view=rev&rev=451866
Log:
Fixed handling of REST requests, extract the correct operation name from URI in the endpoint address instead of the request body element.

Modified:
    incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.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=451866&r1=451865&r2=451866
==============================================================================
--- 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 Oct  1 20:50:39 2006
@@ -53,7 +53,6 @@
 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);
@@ -214,9 +213,39 @@
             element = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(node, env);
             if (element)
             {
-                // This gets the operation name from the root element name - this is correct for DocLit Wrapped style
-                axis2_char_t *op_name = AXIOM_ELEMENT_GET_LOCALNAME(element, env);
-                if (op_name)
+                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)
+                    {
+                        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 
@@ -227,7 +256,7 @@
                     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);
+                        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;
@@ -247,7 +276,7 @@
                         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);
+                        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());
                     }
@@ -290,7 +319,7 @@
                             wsdlOperation =  wsdlDefinition->findOperation(
                                 binding->getServiceName(),
                                 binding->getEndpointName(),
-                                op_name);
+                                op_name.c_str());
                         }
                         catch(SystemConfigurationException &ex)
                         {   
@@ -321,7 +350,7 @@
                         
                                 try
                                 {
-                                    wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name);
+                                    wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name.c_str());
                                 }
                                 catch(SystemConfigurationException &ex)
                                 {   
@@ -337,7 +366,7 @@
                         // Create a default document literal wrapped WSDL operation
                         wsdlNamespace = compositeService->getName();
                         wsdlOperation = WSDLOperation();
-                        wsdlOperation.setOperationName(op_name);
+                        wsdlOperation.setOperationName(op_name.c_str());
                         wsdlOperation.setSoapAction(wsdlNamespace+ "#" +op_name);
                         wsdlOperation.setEndpoint("");
                         wsdlOperation.setSoapVersion(WSDLOperation::SOAP11);



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