ws-savan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r553519 - in /webservices/savan/trunk/c: include/ samples/server/listener/ samples/server/publisher/ src/client/ src/handlers/ src/subscribers/
Date Thu, 05 Jul 2007 14:28:23 GMT
Author: damitha
Date: Thu Jul  5 07:28:22 2007
New Revision: 553519

URL: http://svn.apache.org/viewvc?view=rev&rev=553519
Log:
Fixed a segmentation fault that occured while freeing svc_client in publishing client

Modified:
    webservices/savan/trunk/c/include/savan_subscriber.h
    webservices/savan/trunk/c/samples/server/listener/listener.c
    webservices/savan/trunk/c/samples/server/listener/services.xml
    webservices/savan/trunk/c/samples/server/publisher/publisher_skeleton.c
    webservices/savan/trunk/c/src/client/savan_publishing_client.c
    webservices/savan/trunk/c/src/handlers/savan_out_handler.c
    webservices/savan/trunk/c/src/subscribers/savan_subscriber.c

Modified: webservices/savan/trunk/c/include/savan_subscriber.h
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/include/savan_subscriber.h?view=diff&rev=553519&r1=553518&r2=553519
==============================================================================
--- webservices/savan/trunk/c/include/savan_subscriber.h (original)
+++ webservices/savan/trunk/c/include/savan_subscriber.h Thu Jul  5 07:28:22 2007
@@ -177,7 +177,7 @@
     savan_subscriber_publish(
         savan_subscriber_t *subscriber,
         const axutil_env_t *env,
-        struct axis2_msg_ctx *msg_ctx);
+        axiom_node_t *payload);
 
     /**
      * Set whether the subscription is renewed or not.

Modified: webservices/savan/trunk/c/samples/server/listener/listener.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/samples/server/listener/listener.c?view=diff&rev=553519&r1=553518&r2=553519
==============================================================================
--- webservices/savan/trunk/c/samples/server/listener/listener.c (original)
+++ webservices/savan/trunk/c/samples/server/listener/listener.c Thu Jul  5 07:28:22 2007
@@ -23,12 +23,13 @@
 axis2_listener_notify(const axutil_env_t *env, axiom_node_t *node)
 {
     axis2_char_t *str = NULL;
-
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Start:axis2_listener_notify");
     AXIS2_ENV_CHECK(env, NULL);
 
     str = axiom_node_to_string(node, env);
     if (str)
         printf("\nReceived : %s\n", str);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "End:axis2_listener_notify");
 
     return NULL;
 }

Modified: webservices/savan/trunk/c/samples/server/listener/services.xml
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/samples/server/listener/services.xml?view=diff&rev=553519&r1=553518&r2=553519
==============================================================================
--- webservices/savan/trunk/c/samples/server/listener/services.xml (original)
+++ webservices/savan/trunk/c/samples/server/listener/services.xml Thu Jul  5 07:28:22 2007
@@ -1,17 +1,7 @@
 <service name="listener">
     <parameter name="ServiceClass" locked="xsd:false">listener</parameter>
-    <parameter name="xmpp_id" locked="xsd:false">test3@localhost/Default</parameter>
-    <parameter name="xmpp_password" locked="xsd:false">test3</parameter>
-
    <operation name="notify">
            <!--messageReceiver class="axis2_receivers" /-->
            <parameter name="wsamapping">http://ws.apache.org/axis2/c/samples/notify</parameter>
    </operation>
-
-   <operation name="notify">
-           <!--messageReceiver class="axis2_receivers" /-->
-           <parameter name="wsamapping">xmpp://ws.apache.org/axis2/c/samples/notify</parameter>
-           <parameter name="xmpp_subscribe">test5@localhost</parameter>
-   </operation>
-
 </service>

Modified: webservices/savan/trunk/c/samples/server/publisher/publisher_skeleton.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/samples/server/publisher/publisher_skeleton.c?view=diff&rev=553519&r1=553518&r2=553519
==============================================================================
--- webservices/savan/trunk/c/samples/server/publisher/publisher_skeleton.c (original)
+++ webservices/savan/trunk/c/samples/server/publisher/publisher_skeleton.c Thu Jul  5 07:28:22
2007
@@ -151,11 +151,7 @@
     axiom_node_t *node,
     axis2_msg_ctx_t *msg_ctx)
 {
-    axis2_conf_ctx_t *conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    axis2_conf_t *conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-
-    start_publisher_thread(env, conf); 
-    return axis2_publisher_start(env, node);
+    return NULL;
 }
 
 static void
@@ -246,17 +242,13 @@
 
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "inside thread worker func...");
 
-    /* Build a payload and pass it to the savan publishing client */ 
-    test_ns = axiom_namespace_create (env, "http://www.wso2.com/savan/c/publisher", "test");
-    test_elem = axiom_element_create(env, NULL, "notify", test_ns, &test_node);
-    
-    axiom_element_set_text(test_elem, env, "test data", test_node);
 
     svc = axis2_conf_get_svc(conf, env, "publisher");
     conf_ctx = axis2_conf_ctx_create(env, conf);
     while(1)
     {
         axutil_hash_t *subs_list = NULL;
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Inside while loop");
 
         param = axis2_svc_get_param(svc, env, SAVAN_SUBSCRIBER_LIST);
         if(param)
@@ -266,6 +258,10 @@
             savan_publishing_client_t *pub_client = NULL;
 
             pub_client = savan_publishing_client_create(env, conf_ctx, svc);
+            /* Build a payload and pass it to the savan publishing client */ 
+            test_ns = axiom_namespace_create (env, "http://www.wso2.com/savan/c/publisher",
"test");
+            test_elem = axiom_element_create(env, NULL, "notify", test_ns, &test_node);
+            axiom_element_set_text(test_elem, env, "test data", test_node);
             savan_publishing_client_publish(pub_client, env, test_node);
             savan_publishing_client_free(pub_client, env);
         }

Modified: webservices/savan/trunk/c/src/client/savan_publishing_client.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/client/savan_publishing_client.c?view=diff&rev=553519&r1=553518&r2=553519
==============================================================================
--- webservices/savan/trunk/c/src/client/savan_publishing_client.c (original)
+++ webservices/savan/trunk/c/src/client/savan_publishing_client.c Thu Jul  5 07:28:22 2007
@@ -24,6 +24,7 @@
 #include <platforms/axutil_platform_auto_sense.h>
 
 #include <savan_publishing_client.h>
+#include <savan_subscriber.h>
 #include <savan_constants.h>
 
 struct savan_publishing_client_t
@@ -77,54 +78,47 @@
     const axutil_env_t *env,
     axiom_node_t *payload)
 {
-    const axis2_char_t *repo_path = NULL;
-    const axis2_char_t *address = NULL;
-    axis2_endpoint_ref_t* endpoint_ref = NULL;
-    axis2_options_t *options = NULL;
-    axis2_svc_client_t* svc_client = NULL;
-    axutil_qname_t *op_qname = NULL;
+    axutil_hash_t *store = NULL;
+    axutil_param_t *param = NULL;
+    axutil_hash_index_t *hi = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] "
         "Start:savan_publishing_client_publish");
     
-    repo_path = AXIS2_GETENV("AXIS2C_HOME");
-    
-    /* Set end point reference of a dummy service */
-    address = "http://localhost:9090/axis2/services/dummy";
-    
-    /* Create EPR with given address */
-    endpoint_ref = axis2_endpoint_ref_create(env, address);
-
-    /* Setup options */
-    options = axis2_options_create(env);
-    axis2_options_set_to(options, env, endpoint_ref);
-    axis2_options_set_action(options, env,
-            "http://ws.apache.org/axis2/c/savan/dummy");
-    
-    op_qname = axutil_qname_create(env, "publish", NULL, NULL);
-        
-    /* Create service client */
-    svc_client = axis2_svc_client_create_with_conf_ctx_and_svc(env, repo_path,
-        client->conf_ctx, client->svc); 
-    if (!svc_client)
+    param = axis2_svc_get_param(client->svc, env, SAVAN_SUBSCRIBER_LIST);
+    if (!param)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to create a"
-            "service client for publishing"); 
-        return AXIS2_FAILURE;
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan][out handler] "
+            "Subscribe store not found");
+        return AXIS2_SUCCESS; /* returning FAILURE will break handler chain */
     }
 
-    /* Set service client options */
-    axis2_svc_client_set_options(svc_client, env, options);
-
-    axis2_svc_client_engage_module(svc_client, env, "savan");
+    store = (axutil_hash_t*)axutil_param_get_value(param, env);
+    if (!store)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan][out handler] "
+            "Subscribe store is null");
+        return AXIS2_SUCCESS; /* returning FAILURE will break handler chain */
+    }
+    for (hi = axutil_hash_first(store, env); hi; hi =
+        axutil_hash_next(env, hi))
+    {
+        void *val = NULL;
+        savan_subscriber_t * sub = NULL;
+        axutil_hash_this(hi, NULL, NULL, &val);
+        sub = (savan_subscriber_t *)val;
+        if (sub)
+        {
+            axis2_char_t *id = savan_subscriber_get_id(sub, env);
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan][out handler] "
+                "Publishing to %s", id);
+            savan_subscriber_publish(sub, env, payload);
+        }
 
-    /* Send publishing message */
-    axis2_svc_client_send_robust_with_op_qname(svc_client, env, op_qname, 
-        payload); 
-    if(svc_client)
-        axis2_svc_client_free(svc_client, env);
+        val = NULL;
+    }
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] "
         "End:savan_publishing_client_publish");
     

Modified: webservices/savan/trunk/c/src/handlers/savan_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/handlers/savan_out_handler.c?view=diff&rev=553519&r1=553518&r2=553519
==============================================================================
--- webservices/savan/trunk/c/src/handlers/savan_out_handler.c (original)
+++ webservices/savan/trunk/c/src/handlers/savan_out_handler.c Thu Jul  5 07:28:22 2007
@@ -79,84 +79,6 @@
     const axutil_env_t *env,
     struct axis2_msg_ctx *msg_ctx)
 {
-    savan_message_types_t msg_type = SAVAN_MSG_TYPE_UNKNOWN;
-    
-    AXIS2_ENV_CHECK( env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
-    
-    /* Determine the eventing msg type */
-    msg_type = savan_util_get_message_type(msg_ctx, env);
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan][out handler] msg type:"
-        " %d", msg_type);
-    if (msg_type == SAVAN_MSG_TYPE_UNKNOWN)
-    {
-        axutil_hash_t *store = NULL;
-        axutil_hash_index_t *hi = NULL;
-        axis2_svc_t *svc = NULL;
-        axutil_param_t *param = NULL;
-		const axis2_char_t *svc_name = NULL;
-        /* Treat unknown msgs as msgs for publishing */
-
-        svc =  axis2_msg_ctx_get_svc(msg_ctx, env);
-        if (svc)
-        {
-            svc_name = axis2_svc_get_name(svc, env);
-        }
-        
-        if(svc_name && (0 == axutil_strcmp(svc_name, "subscription")))
-        {
-            return AXIS2_SUCCESS;
-        }
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "************************:svc_name:%s\n",
svc_name);
-        if (!svc)
-        {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan][out handler] "
-                "Service not found");
-            return AXIS2_SUCCESS; /* returning FAILURE will break handler chain */
-        }
-
-        param = axis2_svc_get_param(svc, env, SAVAN_SUBSCRIBER_LIST);
-        if (!param)
-        {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan][out handler] "
-                "Subscribe store not found");
-            return AXIS2_SUCCESS; /* returning FAILURE will break handler chain */
-        }
-
-        store = (axutil_hash_t*)axutil_param_get_value(param, env);
-        if (!store)
-        {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan][out handler] "
-                "Subscribe store is null");
-            return AXIS2_SUCCESS; /* returning FAILURE will break handler chain */
-        }
-
-        /* Treat unknown msgs as msgs for publishing */
-        
-        /* Iterate the subscribe store and send the msg to each one */
-
-        for (hi = axutil_hash_first(store, env); hi; hi = 
-            axutil_hash_next(env, hi))
-        {
-            void *val = NULL;
-            savan_subscriber_t * sub = NULL;
-            axutil_hash_this(hi, NULL, NULL, &val);
-            sub = (savan_subscriber_t *)val;
-            if (sub)
-            {
-                axis2_char_t *id = savan_subscriber_get_id(sub, env);
-                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan][out handler] "
-                    "Publishing to %s", id);
-                savan_subscriber_publish(sub, env, msg_ctx);
-            }
-
-            val = NULL;
-        }
-
-
-        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
-    }
-       
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/savan/trunk/c/src/subscribers/savan_subscriber.c
URL: http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/subscribers/savan_subscriber.c?view=diff&rev=553519&r1=553518&r2=553519
==============================================================================
--- webservices/savan/trunk/c/src/subscribers/savan_subscriber.c (original)
+++ webservices/savan/trunk/c/src/subscribers/savan_subscriber.c Thu Jul  5 07:28:22 2007
@@ -258,50 +258,33 @@
 savan_subscriber_publish(
     savan_subscriber_t *subscriber,
     const axutil_env_t *env,
-    struct axis2_msg_ctx *msg_ctx)
+    axiom_node_t *payload)
 {
     axis2_svc_client_t *svc_client = NULL;
-    axis2_op_client_t *op_client = NULL;
-    axis2_conf_ctx_t *conf_ctx = NULL;
-    axis2_conf_t *conf = NULL;
-    axis2_svc_t *svc = NULL;
     axis2_char_t *path = NULL;
     axis2_options_t *options = NULL;
     axis2_status_t status = AXIS2_SUCCESS;
-    axutil_qname_t *op_qname = NULL;
+    axis2_endpoint_ref_t *to = NULL;
+    const axis2_char_t *address = NULL;
 
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[savan] Start:savan_subscriber_publish");
 	
-
     path = AXIS2_GETENV("AXIS2C_HOME");
-    conf_ctx =  axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    conf =  axis2_conf_ctx_get_conf(conf_ctx, env);
-
-    /* Get anonymous service from conf. This will be null for the first time,
-     * but then it will be created when we create the svc_client */
-    svc = axis2_conf_get_svc(conf, env, AXIS2_ANON_SERVICE);
-
-    svc_client = axis2_svc_client_create_with_conf_ctx_and_svc(env, path,
-        conf_ctx, svc);
+    svc_client = axis2_svc_client_create(env, path);
 
     /* Setup options */
     options = axis2_options_create(env);
-    axis2_options_set_to(options, env, subscriber->notify_to);
+    address = axis2_endpoint_ref_get_address(subscriber->notify_to, env);
+    to = axis2_endpoint_ref_create(env, address);
+    axis2_options_set_to(options, env, to);
 
     /* Set service client options */
     axis2_svc_client_set_options(svc_client, env, options);
+    axis2_svc_client_send_robust(svc_client, env, payload);
 
-    /* Engage addressing module */
-    /*axis2_svc_client_engage_module(svc_client, env, AXIS2_MODULE_ADDRESSING);*/
-
-    op_qname = axutil_qname_create(env, AXIS2_ANON_OUT_ONLY_OP, NULL, NULL);
-
-    op_client = axis2_svc_client_create_op_client(svc_client, env,
-        op_qname);
-
-    axis2_op_client_add_msg_ctx(op_client, env, msg_ctx);
-    status = axis2_op_client_execute(op_client, env, AXIS2_TRUE);
+    if(svc_client)
+        axis2_svc_client_free(svc_client, env);
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
         "[savan] End:savan_subscriber_publish");
     return status;



Mime
View raw message