ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r373135 - /webservices/axis2/trunk/c/modules/core/engine/soap_body_disp.c
Date Sat, 28 Jan 2006 11:02:55 GMT
Author: samisa
Date: Sat Jan 28 03:02:50 2006
New Revision: 373135

URL: http://svn.apache.org/viewcvs?rev=373135&view=rev
Log:
Added the SOAP body processing to get this working. Initial tests are successful.

Modified:
    webservices/axis2/trunk/c/modules/core/engine/soap_body_disp.c

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=373135&r1=373134&r2=373135&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 03:02:50 2006
@@ -17,12 +17,12 @@
 #include <axis2_disp.h>
 #include <axis2_handler_desc.h>
 #include <axis2_qname.h>
-#include <axis2_relates_to.h>
 #include <axis2_svc.h>
 #include <axis2.h>
 #include <axis2_conf_ctx.h>
-#include <axis2_addr.h>
 #include <axis2_utils.h>
+#include <axis2_soap_envelope.h>
+#include <axis2_soap_body.h>
 
 axis2_status_t AXIS2_CALL axis2_soap_body_disp_invoke (struct axis2_handler * handler, 
                                                 axis2_env_t **env,
@@ -84,30 +84,70 @@
 axis2_svc_t* AXIS2_CALL axis2_soap_body_disp_find_svc(axis2_msg_ctx_t *msg_ctx, 
                     axis2_env_t **env) 
 {    
-    AXIS2_FUNC_PARAM_CHECK(msg_ctx, env, NULL);    
-/*
-    OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
-
-        if (bodyFirstChild != null) {
-            OMNamespace ns = bodyFirstChild.getNamespace();
-            if (ns != null) {
-                String filePart = ns.getName();
-                log.debug("Checking for Service using SOAP message body's first child's namespace
: " + filePart);
-
-                String[] values = Utils.parseRequestURLForServiceAndOperation(
-                        filePart);
-                if (values[1] != null) {
-                    opName = new QName(values[1]);
-                }
-                if (values[0] != null) {
-                    serviceName = values[0];
-                    AxisConfiguration registry =
-                            messageContext.getConfigurationContext().getAxisConfiguration();
-                    return registry.getService(serviceName);
+    axis2_soap_envelope_t *soap_envelope = NULL;
+    
+    AXIS2_FUNC_PARAM_CHECK(msg_ctx, env, NULL); 
+    soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, env);
+    if (soap_envelope)
+    {
+        axis2_soap_body_t *soap_body = AXIS2_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
+        if (soap_body)
+        {
+            axis2_om_node_t *body_node = AXIS2_SOAP_BODY_GET_BASE_NODE(soap_body, env);
+            if (body_node)
+            {
+                axis2_om_node_t *body_first_child_node = 
+                    AXIS2_OM_NODE_GET_FIRST_CHILD(body_node, env);
+                if (body_first_child_node)
+                {                    
+                    if (AXIS2_OM_NODE_GET_NODE_TYPE(body_first_child_node, env) == AXIS2_OM_ELEMENT)
+                    {
+                        axis2_om_element_t *element = NULL;                        
+                        element = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(body_first_child_node,
env);
+                        if (element)
+                        {
+                            axis2_om_namespace_t *ns = AXIS2_OM_ELEMENT_GET_NAMESPACE(element,
env);
+                            if (ns)
+                            {
+                                axis2_char_t *uri = AXIS2_OM_NAMESPACE_GET_URI(ns, env);
+                                if (uri)
+                                {
+                                    axis2_char_t **url_tokens = NULL;
+                                    axis2_char_t message[1024];
+                                    sprintf(message, "Checking for Service using target endpoint
address : %s", uri);
+                                    AXIS2_LOG(env, message, AXIS2_LOG_INFO);
+                                    
+                                    url_tokens = axis2_parse_request_url_for_svc_and_op(env,
uri);
+                                    
+                                    if (url_tokens)
+                                    {                
+                                        if (url_tokens[0])
+                                        {                    
+                                            axis2_conf_ctx_t *conf_ctx = NULL;
+                                            
+                                            conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx,
env);
+                                            if (conf_ctx)
+                                            {
+                                                axis2_conf_t *conf = NULL;
+                                                conf = AXIS2_CONF_CTX_GET_CONF(conf_ctx,
env);
+                                                if (conf)
+                                                {
+                                                    axis2_svc_t *svc = NULL;
+                                                    svc = AXIS2_CONF_GET_SVC(conf, env, url_tokens[0]);
+                                                    return svc;
+                                                }
+                                            }                    
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
                 }
             }
         }
-*/        
+    }
+    
     return NULL;
 }
 
@@ -122,21 +162,49 @@
                                 axis2_env_t **env,
                                 axis2_svc_t *svc)
 {
-        
+    axis2_soap_envelope_t *soap_envelope = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(msg_ctx, env, NULL); 
     AXIS2_PARAM_CHECK((*env)->error, svc, NULL);
-/*
-    OMElement bodyFirstChild = messageContext.getEnvelope().getBody()
-                .getFirstElement();
-        if (bodyFirstChild == null) {
-            return null;
-        } else {
-            log.debug("Checking for Operation using SOAP message body's first child's local
name : " + bodyFirstChild.getLocalName());
-            opName = new QName(bodyFirstChild.getLocalName());
-        }
 
-        return service.getOperation(opName);
-*/    
+    soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, env);
+    if (soap_envelope)
+    {
+        axis2_soap_body_t *soap_body = AXIS2_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
+        if (soap_body)
+        {
+            axis2_om_node_t *body_node = AXIS2_SOAP_BODY_GET_BASE_NODE(soap_body, env);
+            if (body_node)
+            {
+                axis2_om_node_t *body_first_child_node = 
+                    AXIS2_OM_NODE_GET_FIRST_CHILD(body_node, env);
+                if (body_first_child_node)
+                {                    
+                    if (AXIS2_OM_NODE_GET_NODE_TYPE(body_first_child_node, env) == AXIS2_OM_ELEMENT)
+                    {
+                        axis2_om_element_t *element = NULL;                        
+                        element = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(body_first_child_node,
env);
+                        if (element)
+                        {
+                            axis2_char_t *element_name = AXIS2_OM_ELEMENT_GET_LOCALNAME(element,
env);
+                            if (element_name)
+                            {
+                                axis2_qname_t *op_qname = NULL;
+                                axis2_op_t *op = NULL;
+                                axis2_char_t message[1024];
+                                sprintf(message, "Checking for operation using SOAP message
body's first child's local name : %s", element_name);
+                                AXIS2_LOG(env, message, AXIS2_LOG_INFO);
+                                op_qname = axis2_qname_create(env, element_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;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
     return NULL;
 }
             



Mime
View raw message