You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/01/28 14:32:56 UTC

svn commit: r373146 - in /webservices/axis2/trunk/c: modules/core/engine/ modules/util/ test/core/clientapi/

Author: samisa
Date: Sat Jan 28 05:32:42 2006
New Revision: 373146

URL: http://svn.apache.org/viewcvs?rev=373146&view=rev
Log:
Added rindex method to string to be used in SOAP Action based dispatcher. 
Also fixed the SOAP action based dispatcher to find the operation using SOAP action

Modified:
    webservices/axis2/trunk/c/modules/core/engine/addr_disp.c
    webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c
    webservices/axis2/trunk/c/modules/core/engine/soap_action_disp.c
    webservices/axis2/trunk/c/modules/core/engine/soap_body_disp.c
    webservices/axis2/trunk/c/modules/util/axis2_string.h
    webservices/axis2/trunk/c/modules/util/string.c
    webservices/axis2/trunk/c/test/core/clientapi/test_client.c

Modified: webservices/axis2/trunk/c/modules/core/engine/addr_disp.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/addr_disp.c?rev=373146&r1=373145&r2=373146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/addr_disp.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/addr_disp.c Sat Jan 28 05:32:42 2006
@@ -98,13 +98,10 @@
         if (address)
         {
             axis2_char_t **url_tokens = NULL;
+            axis2_char_t message[1024];
+            sprintf(message, "Checking for service using WSA enpoint address : %s", address);
+            AXIS2_LOG(env, message, AXIS2_LOG_INFO);
 
-            axis2_char_t *msg= AXIS2_STRACAT("Checking for Operation using WSAAction : ", address, env);
-            
-            AXIS2_LOG(env, msg, AXIS2_LOG_INFO);
-            AXIS2_FREE((*env)->allocator, msg);
-            msg = NULL;
-            
             if ( (AXIS2_STRCMP(AXIS2_WSA_ANONYMOUS_URL, address) == 0 ) || 
                   (AXIS2_STRCMP(AXIS2_WSA_NAMESPACE_SUBMISSION, address) == 0 ))
             {
@@ -163,9 +160,9 @@
     
     if (action)
     {
-        AXIS2_LOG(env, "Checking for Operation using WSAAction : ", AXIS2_LOG_INFO);
-        AXIS2_LOG(env, action, AXIS2_LOG_INFO);
-        AXIS2_LOG(env, "\n", AXIS2_LOG_INFO);
+        axis2_char_t message[1024];
+        sprintf(message, "Checking for Operation using WSAAction : %s", action);
+        AXIS2_LOG(env, message, AXIS2_LOG_INFO);
         
         qname = axis2_qname_create(env, action, NULL, NULL);
         return AXIS2_SVC_GET_OP_WITH_QNAME(svc, env, qname);

Modified: webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c?rev=373146&r1=373145&r2=373146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/req_uri_disp.c Sat Jan 28 05:32:42 2006
@@ -99,7 +99,7 @@
         {
             axis2_char_t **url_tokens = NULL;
             axis2_char_t message[1024];
-            sprintf(message, "Checking for Service using target endpoint address : %s", address);
+            sprintf(message, "Checking for service using target endpoint address : %s", address);
             AXIS2_LOG(env, message, AXIS2_LOG_INFO);
             
             url_tokens = axis2_parse_request_url_for_svc_and_op(env, address);
@@ -166,7 +166,7 @@
                     axis2_qname_t *op_qname = NULL;
                     axis2_op_t *op = NULL;
                     axis2_char_t message[1024];
-                    sprintf(message, "Checking for Service using target endpoint uri fragment : %s", url_tokens[1]);
+                    sprintf(message, "Checking for operation using target endpoint uri fragment : %s", url_tokens[1]);
                     AXIS2_LOG(env, message, AXIS2_LOG_INFO);
                     op_qname = axis2_qname_create(env, url_tokens[1], NULL, NULL);
                     op = AXIS2_SVC_GET_OP_WITH_NAME(svc, env, AXIS2_QNAME_GET_LOCALPART(op_qname, env));

Modified: webservices/axis2/trunk/c/modules/core/engine/soap_action_disp.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/soap_action_disp.c?rev=373146&r1=373145&r2=373146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/soap_action_disp.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/soap_action_disp.c Sat Jan 28 05:32:42 2006
@@ -86,7 +86,7 @@
 {    
     AXIS2_FUNC_PARAM_CHECK(msg_ctx, env, NULL);    
 
-    AXIS2_LOG(env, "Checking for Service using SOAPAction is a TODO item\n", AXIS2_LOG_INFO);
+    AXIS2_LOG(env, "Checking for Service using SOAPAction is a TODO item", AXIS2_LOG_INFO);
 
     return NULL;
 }
@@ -112,23 +112,33 @@
     if (action)
     {
         axis2_op_t *op = NULL;        
+        axis2_char_t message[1024];
+        sprintf(message, "Checking for operation using SOAP action : %s", action);
+        AXIS2_LOG(env, message, AXIS2_LOG_INFO);
 
         op = AXIS2_SVC_GET_OP_BY_SOAP_ACTION(svc, env, action);
         if (!op)
         {
-            axis2_qname_t *op_qname = axis2_qname_create(env, action, NULL, NULL);
-            op = AXIS2_SVC_GET_OP_WITH_QNAME(svc, env, op_qname);
-            AXIS2_QNAME_FREE(op_qname, env);
-        }
+            axis2_char_t * op_name = NULL;
+            op_name = AXIS2_RINDEX(action, '/');
 
-        /* HACK: Please remove this when we add support for custom action uri */
-        /*if (!op)
-        {
-            if (action.lastIndexOf('/') != -1) 
+            if (op_name)
             {
-                op = service.getOperation(new QName(action.substring(action.lastIndexOf('/'), action.length())));
+                op_name += 1;
             }
-        }*/
+            else
+            {
+                op_name = action;
+            }
+
+            if (op_name)
+            {
+                axis2_qname_t *op_qname = axis2_qname_create(env, 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);
+            }
+        }
+
         return op;
     }
     

Modified: webservices/axis2/trunk/c/modules/core/engine/soap_body_disp.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/soap_body_disp.c?rev=373146&r1=373145&r2=373146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/soap_body_disp.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/soap_body_disp.c Sat Jan 28 05:32:42 2006
@@ -114,7 +114,7 @@
                                 {
                                     axis2_char_t **url_tokens = NULL;
                                     axis2_char_t message[1024];
-                                    sprintf(message, "Checking for Service using target endpoint address : %s", uri);
+                                    sprintf(message, "Checking for service using SOAP message body's first child's namespace URI : %s", uri);
                                     AXIS2_LOG(env, message, AXIS2_LOG_INFO);
                                     
                                     url_tokens = axis2_parse_request_url_for_svc_and_op(env, uri);

Modified: webservices/axis2/trunk/c/modules/util/axis2_string.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/axis2_string.h?rev=373146&r1=373145&r2=373146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/axis2_string.h (original)
+++ webservices/axis2/trunk/c/modules/util/axis2_string.h Sat Jan 28 05:32:42 2006
@@ -59,6 +59,8 @@
     axis2_strstr (const axis2_char_t *heystack,
                     const axis2_char_t *needle);
 
+    AXIS2_DECLARE(axis2_char_t *)
+    axis2_rindex(const axis2_char_t *s, axis2_char_t c);
 
 #define AXIS2_STRDUP(pts, env) axis2_strdup(pts, env)
 #define AXIS2_STRCMP(s1, s2) axis2_strcmp(s1, s2)
@@ -67,6 +69,7 @@
 #define AXIS2_STRNCASECMP(s1,s2,n) axis2_strncasecmp(s1,s2,n)
 #define AXIS2_STRACAT(s1, s2, env) axis2_stracat(s1, s2, env)
 #define AXIS2_STRSTR(s1, s2) axis2_strstr(s1, s2)
+#define AXIS2_RINDEX(s, c) axis2_rindex(s, c)
 
 /** @} */
     

Modified: webservices/axis2/trunk/c/modules/util/string.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/string.c?rev=373146&r1=373145&r2=373146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/string.c (original)
+++ webservices/axis2/trunk/c/modules/util/string.c Sat Jan 28 05:32:42 2006
@@ -113,3 +113,11 @@
 {
 	return strstr(heystack, needle);
 }
+
+
+AXIS2_DECLARE(axis2_char_t *)
+axis2_rindex(const axis2_char_t *s, axis2_char_t c)
+{
+    return rindex(s, c);
+}
+

Modified: webservices/axis2/trunk/c/test/core/clientapi/test_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/core/clientapi/test_client.c?rev=373146&r1=373145&r2=373146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/core/clientapi/test_client.c (original)
+++ webservices/axis2/trunk/c/test/core/clientapi/test_client.c Sat Jan 28 05:32:42 2006
@@ -109,6 +109,7 @@
 	sprintf(tmpstr, "%d", strlen(buffer));
 	strcat(buffer_l, tmpstr);
 	strcat(buffer_l, "\r\n");
+	strcat(buffer_l, "SOAPAction: http://localhost:9090/axis2/services/echo/echo\r\n");
 	strcat(buffer_l, "Content-Type: application/soap+xml;\r\n");
 	strcat(buffer_l, "\r\n");