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 du...@apache.org on 2007/08/06 17:32:51 UTC

svn commit: r563170 - in /webservices/axis2/trunk/c: axiom/src/soap/soap_builder.c samples/server/mtom/mtom.c

Author: dumindu
Date: Mon Aug  6 08:32:50 2007
New Revision: 563170

URL: http://svn.apache.org/viewvc?view=rev&rev=563170
Log:
Fixed the MTOM issue with additional <xop:Include>. Jira AXIS2C-653.


Modified:
    webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c
    webservices/axis2/trunk/c/samples/server/mtom/mtom.c

Modified: webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c?view=diff&rev=563170&r1=563169&r2=563170
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c (original)
+++ webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c Mon Aug  6 08:32:50 2007
@@ -355,7 +355,7 @@
     }
     return ret_val;
 }
-
+/*TODO:Fixme*/
 static axis2_status_t
 axiom_soap_builder_construct_node(axiom_soap_builder_t *soap_builder,
         const axutil_env_t *env,
@@ -428,8 +428,21 @@
                                         axiom_text_t *data_text = NULL;
                                         axiom_node_t *data_om_node = NULL;
                                         data_text = axiom_text_create_with_data_handler(
-                                                    env, om_element_node, data_handler, &data_om_node);
-                                        axiom_text_set_optimize(data_text, env, AXIS2_FALSE);
+                                                        env, om_element_node,
+                                                        data_handler, &data_om_node);
+                                        /*axiom_text_set_optimize(data_text, env,
+                                                                AXIS2_FALSE);*/
+                                        axiom_text_set_content_id(data_text, env, id);
+                                        
+
+                                        /*remove the <xop:Include> element*/
+                                        axiom_node_detach(om_element_node, env);
+                                        axiom_node_detach(data_om_node, env);
+                                        axiom_node_free_tree(om_element_node, env);
+                                        axiom_node_add_child(parent, env,
+                                                data_om_node);
+                                        
+
                                     }
                                 }
                             }

Modified: webservices/axis2/trunk/c/samples/server/mtom/mtom.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/mtom/mtom.c?view=diff&rev=563170&r1=563169&r2=563170
==============================================================================
--- webservices/axis2/trunk/c/samples/server/mtom/mtom.c (original)
+++ webservices/axis2/trunk/c/samples/server/mtom/mtom.c Mon Aug  6 08:32:50 2007
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 #include "mtom.h"
+#include <axiom.h>
 #include <stdio.h>
 
 axiom_node_t *
@@ -28,7 +29,7 @@
     axiom_node_t *ret_node = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-
+    
     /* Expected request format is :-
      * <ns1:mtomSample xmlns:ns1="http://ws.apache.org/axis2/c/samples">
             <ns1:fileName>test.jpg</ns1:fileName>
@@ -72,12 +73,12 @@
             image_node = axiom_node_get_next_sibling(file_name_node, env);
             if (image_node)
             {
-                axiom_node_t *inc_node = NULL;
+               /* axiom_node_t *inc_node = NULL;
                 inc_node = axiom_node_get_first_child(image_node, env);
                 if (inc_node)
-                {
+                {*/
                     axiom_node_t *binary_node = NULL;
-                    binary_node = axiom_node_get_first_child(inc_node, env);
+                    binary_node = axiom_node_get_first_child(image_node, env);
                     if (binary_node)
                     {
                         axiom_data_handler_t *data_handler = NULL;
@@ -90,27 +91,27 @@
                             axiom_data_handler_write_to(data_handler, env);
                             ret_node = build_om_programatically(env, text_str);
                         }
-                    }
-                    else /* attachment has come by value, as non-optimized binary */
-                    {
-                        axiom_text_t *bin_text = (axiom_text_t *)
-                                axiom_node_get_data_element(inc_node, env);
-                        int plain_binary_len = 0;
-                        axis2_byte_t *plain_binary = NULL;
-                        axiom_data_handler_t *data_handler = NULL;
-                        
-                        axis2_char_t *base64text = (axis2_char_t *)axiom_text_get_value(bin_text, env);
-                        printf("base64text = %s\n", base64text);
-                        plain_binary_len = axutil_base64_decode_len(base64text);
-                        plain_binary =  AXIS2_MALLOC(env->
-                                    allocator, sizeof(unsigned char) * plain_binary_len);
-                        axutil_base64_decode_binary((unsigned char*)plain_binary,
-                                    base64text);
-                        data_handler = axiom_data_handler_create(env, text_str, NULL);
-                        axiom_data_handler_set_binary_data(data_handler, env, plain_binary, plain_binary_len);
-                        axiom_data_handler_write_to(data_handler, env);
-                        ret_node = build_om_programatically(env, text_str);
-                    }
+                        else /* attachment has come by value, as non-optimized binary */
+                        {
+                            axiom_text_t *bin_text = (axiom_text_t *)
+                                    axiom_node_get_data_element(binary_node, env);
+                            int plain_binary_len = 0;
+                            axis2_byte_t *plain_binary = NULL;
+                            axiom_data_handler_t *data_handler = NULL;
+                            
+                            axis2_char_t *base64text = (axis2_char_t *)axiom_text_get_value(bin_text, env);
+                            printf("base64text = %s\n", base64text);
+                            plain_binary_len = axutil_base64_decode_len(base64text);
+                            plain_binary =  AXIS2_MALLOC(env->
+                                        allocator, sizeof(unsigned char) * plain_binary_len);
+                            axutil_base64_decode_binary((unsigned char*)plain_binary,
+                                        base64text);
+                            data_handler = axiom_data_handler_create(env, text_str, NULL);
+                            axiom_data_handler_set_binary_data(data_handler, env, plain_binary, plain_binary_len);
+                            axiom_data_handler_write_to(data_handler, env);
+                            ret_node = build_om_programatically(env, text_str);
+                        }
+               /* }*/
                 }
             }
 



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