You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ma...@apache.org on 2008/12/10 09:58:59 UTC

svn commit: r725031 - in /webservices/axis2/trunk/c/src/core/transport/http/sender: http_client.c http_sender.c http_transport_sender.c

Author: manjula
Date: Wed Dec 10 00:58:59 2008
New Revision: 725031

URL: http://svn.apache.org/viewvc?rev=725031&view=rev
Log:
Fixing Axis2C-1301

Modified:
    webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c
    webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c
    webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c

Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c?rev=725031&r1=725030&r2=725031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c Wed Dec 10 00:58:59 2008
@@ -54,6 +54,7 @@
     /* These are for mtom case */
     axutil_array_list_t *mime_parts;
     axis2_bool_t doing_mtom;
+    axis2_char_t *mtom_sending_callback_name;
 };
 
 AXIS2_EXTERN axis2_http_client_t *AXIS2_CALL
@@ -93,6 +94,7 @@
     http_client->req_body_size = 0;
     http_client->mime_parts = NULL;
     http_client->doing_mtom = AXIS2_FALSE;
+    http_client->mtom_sending_callback_name = NULL;
 
     return http_client;
 }
@@ -156,11 +158,12 @@
     return;
 }
 
-/*This is the main method which writes to the socket in the case of a client 
- * sends an http_request. Previously this mrthod does not distinguish between a 
+/* This is the main method which writes to the socket in the case of a client 
+ * sends an http_request. Previously this method does not distinguish between a 
  * mtom request and non mtom request. Because what finally it had was the 
  * complete buffer with the request. But now MTOM invocations are done 
- * differently so this method should distinguish those invocations*/
+ * differently in order to support large attachments so this method should 
+ * distinguish those invocations */
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_http_client_send(
@@ -399,14 +402,29 @@
         axis2_status_t status = AXIS2_SUCCESS;
         axutil_http_chunked_stream_t *chunked_stream = NULL;
         
+        /* If the callback name is not there, then we will check whether there 
+         * is any mime_parts which has type callback. If we found then no point 
+         * of continuing we should return a failure */
+   
+        if(!(client->mtom_sending_callback_name))
+        {
+            if(axis2_http_transport_utils_is_callback_required(
+                env, client->mime_parts))
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Sender callback not specified");
+                return AXIS2_FAILURE;
+            }
+        }
+
         /* For MTOM we automatically enabled chunking */
-        chunked_stream = axutil_http_chunked_stream_create(env, 
+        chunked_stream = axutil_http_chunked_stream_create(env,
                 client->data_stream);
-    
+
+
         /* This method will write the Attachment + data to the wire */
 
         status = axis2_http_transport_utils_send_mtom_message(chunked_stream, env, 
-                client->mime_parts);      
+                client->mime_parts, client->mtom_sending_callback_name);      
 
         axutil_http_chunked_stream_free(chunked_stream, env);
         chunked_stream = NULL;
@@ -926,3 +944,13 @@
     return client->doing_mtom;
 }
 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_http_client_set_mtom_sending_callback_name(
+    axis2_http_client_t * client,
+    const axutil_env_t * env,
+    axis2_char_t *callback_name)
+{
+    client->mtom_sending_callback_name = 
+        callback_name;
+    return AXIS2_SUCCESS;
+}

Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c?rev=725031&r1=725030&r2=725031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c Wed Dec 10 00:58:59 2008
@@ -484,8 +484,26 @@
 
         if (doing_mtom)
         {
+            axutil_param_t *callback_name_param = NULL;
             axis2_status_t mtom_status = AXIS2_FAILURE;
             axutil_array_list_t *mime_parts = NULL;
+            axis2_char_t *mtom_sending_callback_name = NULL;
+
+            /* Getting the sender callback name paramter if it is 
+             * specified in the configuration file */
+
+            callback_name_param = axis2_msg_ctx_get_parameter(msg_ctx, env ,
+                AXIS2_MTOM_SENDING_CALLBACK);
+            if(callback_name_param)
+            {
+                mtom_sending_callback_name =
+                    (axis2_char_t *) axutil_param_get_value (callback_name_param, env);
+                if(mtom_sending_callback_name)
+                {
+                    axis2_http_client_set_mtom_sending_callback_name(
+                        sender->client, env, mtom_sending_callback_name);
+                }
+            }
 
             /* Here we put all the attachment related stuff in a array_list
                After this method we have the message in parts */

Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c?rev=725031&r1=725030&r2=725031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c Wed Dec 10 00:58:59 2008
@@ -532,7 +532,7 @@
                     axutil_array_list_t *mime_parts = NULL;
                    
                     /*Create the attachment related data and put them to an
-                     *arra_list */
+                     *array_list */
                     mtom_status = axiom_output_flush(om_output, env);
                     if(mtom_status == AXIS2_SUCCESS)
                     {