You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by sh...@apache.org on 2010/04/07 09:20:41 UTC

svn commit: r931454 - in /axis/axis2/c/core/trunk: axiom/include/ axiom/src/om/ axiom/src/soap/ src/core/transport/amqp/util/ src/core/transport/http/util/

Author: shankar
Date: Wed Apr  7 07:20:41 2010
New Revision: 931454

URL: http://svn.apache.org/viewvc?rev=931454&view=rev
Log:
Fixing issue AXIS2C-1233

Added:
    axis/axis2/c/core/trunk/axiom/src/soap/axiom_soap_builder_internal.h
Modified:
    axis/axis2/c/core/trunk/axiom/include/axiom_soap_builder.h
    axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h
    axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c
    axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c
    axis/axis2/c/core/trunk/src/core/transport/amqp/util/axis2_amqp_util.c
    axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c

Modified: axis/axis2/c/core/trunk/axiom/include/axiom_soap_builder.h
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/include/axiom_soap_builder.h?rev=931454&r1=931453&r2=931454&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/include/axiom_soap_builder.h (original)
+++ axis/axis2/c/core/trunk/axiom/include/axiom_soap_builder.h Wed Apr  7 07:20:41 2010
@@ -245,7 +245,6 @@ extern "C"
         const axutil_env_t * env);
 
 
-
     /** @} */
 #ifdef __cplusplus
 }

Modified: axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h?rev=931454&r1=931453&r2=931454&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h (original)
+++ axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h Wed Apr  7 07:20:41 2010
@@ -24,9 +24,8 @@
  * @{
  */
 
-/** @} */
-
 #include <axiom_stax_builder.h>
+#include <axiom_soap_builder.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -97,6 +96,17 @@ extern "C"
         struct axiom_stax_builder *builder,
         const axutil_env_t * env);
 
+    void AXIS2_CALL
+    axiom_stax_builder_set_soap_builder(
+        axiom_stax_builder_t *om_builder,
+        const axutil_env_t *env,
+        axiom_soap_builder_t *soap_builder);
+
+    axiom_node_t *AXIS2_CALL
+    axiom_stax_builder_get_root_node(
+        axiom_stax_builder_t *om_builder,
+        const axutil_env_t * env);
+
 
 
 #if 0

Modified: axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c?rev=931454&r1=931453&r2=931454&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c (original)
+++ axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c Wed Apr  7 07:20:41 2010
@@ -25,6 +25,7 @@
 #include <axiom_doctype.h>
 #include "axiom_node_internal.h"
 #include "axiom_stax_builder_internal.h"
+#include <axiom_soap_builder_internal.h>
 #include "axiom_document_internal.h"
 
 struct axiom_stax_builder
@@ -50,6 +51,9 @@ struct axiom_stax_builder
     /** Indicate the  current element level. */
     int element_level;
 
+    /** reference to the soap builder, to build soap releated elements */
+    axiom_soap_builder_t *soap_builder;
+
     axutil_hash_t *declared_namespaces;
 };
 
@@ -104,6 +108,7 @@ axiom_stax_builder_create(
     om_builder->current_event = -1;
     om_builder->root_node = NULL;
     om_builder->element_level = 0;
+    om_builder->soap_builder = NULL;
     return om_builder;
 }
 
@@ -742,6 +747,20 @@ axiom_stax_builder_next_with_token(
         default:
             break;
     }
+
+    /* if stax builder is also a soap builder, build soap related elements */
+    if(om_builder->soap_builder &&
+        (token == AXIOM_XML_READER_START_ELEMENT || token == AXIOM_XML_READER_EMPTY_ELEMENT))
+    {
+        AXIS2_ASSERT(om_builder->lastnode != NULL);
+        if(axiom_soap_builder_construct_node(om_builder->soap_builder, env, om_builder->lastnode)
+            != AXIS2_SUCCESS)
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occurred when building soap node");
+            om_builder->done = AXIS2_TRUE;
+            return -1;
+        }
+    }
     return token;
 }
 
@@ -813,6 +832,22 @@ axiom_stax_builder_set_element_level(
     om_builder->element_level = element_level;
 }
 
+void AXIS2_CALL
+axiom_stax_builder_set_soap_builder(
+    axiom_stax_builder_t *om_builder,
+    const axutil_env_t *env,
+    axiom_soap_builder_t *soap_builder)
+{
+    om_builder->soap_builder = soap_builder;
+}
+
+axiom_node_t *AXIS2_CALL
+axiom_stax_builder_get_root_node(
+    axiom_stax_builder_t *om_builder,
+    const axutil_env_t * env)
+{
+    return om_builder->root_node;
+}
 #if 0
 static axiom_node_t *
 axiom_stax_builder_create_om_doctype(

Added: axis/axis2/c/core/trunk/axiom/src/soap/axiom_soap_builder_internal.h
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/soap/axiom_soap_builder_internal.h?rev=931454&view=auto
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/soap/axiom_soap_builder_internal.h (added)
+++ axis/axis2/c/core/trunk/axiom/src/soap/axiom_soap_builder_internal.h Wed Apr  7 07:20:41 2010
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIOM_SOAP_BUILDER_INTERNAL_H_
+#define AXIOM_SOAP_BUILDER_INTERNAL_H_
+
+/** @defgroup axiom_soap AXIOM (Axis Object Model)
+ * @ingroup axis2
+ * @{
+ */
+
+#include <axiom_soap_builder.h>
+
+    axis2_status_t AXIS2_CALL
+    axiom_soap_builder_construct_node(
+        axiom_soap_builder_t * soap_builder,
+        const axutil_env_t * env,
+        axiom_node_t * om_element_node);
+
+/** @} */
+
+#endif /* AXIOM_SOAP_BUILDER_INTERNAL_H_ */

Modified: axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c?rev=931454&r1=931453&r2=931454&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c (original)
+++ axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c Wed Apr  7 07:20:41 2010
@@ -24,16 +24,11 @@
 #include "_axiom_soap_body.h"
 #include "_axiom_soap_header_block.h"
 #include <axiom_stax_builder_internal.h>
+#include "axiom_soap_builder_internal.h"
 #include "_axiom_soap_fault.h"
 #include <axutil_http_chunked_stream.h>
 
 static axis2_status_t
-axiom_soap_builder_construct_node(
-    axiom_soap_builder_t * soap_builder,
-    const axutil_env_t * env,
-    axiom_node_t * om_element_node);
-
-static axis2_status_t
 axiom_soap_builder_identify_soap_version(
     axiom_soap_builder_t * soap_builder,
     const axutil_env_t * env,
@@ -151,6 +146,7 @@ axiom_soap_builder_create(
     soap_builder->soap_version = AXIOM_SOAP12;
     soap_builder->last_node_status = -1;
     soap_builder->om_builder = stax_builder;
+    axiom_stax_builder_set_soap_builder(stax_builder, env, soap_builder);
     soap_builder->done = AXIS2_FALSE;
 
     status = axiom_soap_builder_identify_soap_version(soap_builder, env, soap_version);
@@ -324,37 +320,8 @@ axiom_soap_builder_next(
         return AXIS2_FAILURE;
     }
 
-    /* Get the status of previous node before building next node. We need the previous state of the
-     * node to identify very first element, which is SOAP Envelope. If last_node_status is
-     * AXIS2_BUILDER_LAST_NODE_NULL, then it means next node is SOAP Envelope
-     */
-    if(axiom_stax_builder_get_lastnode(soap_builder->om_builder, env))
-    {
-        soap_builder->last_node_status = AXIS2_BUILDER_LAST_NODE_NOT_NULL;
-    }
-    else
-    {
-        soap_builder->last_node_status = AXIS2_BUILDER_LAST_NODE_NULL;
-    }
-
     current_event = axiom_stax_builder_next_with_token(soap_builder->om_builder, env);
-    if(current_event == AXIOM_XML_READER_START_ELEMENT
-        || current_event == AXIOM_XML_READER_EMPTY_ELEMENT)
-    {
-        axiom_node_t *current_node = axiom_stax_builder_get_lastnode(soap_builder->om_builder, env);
-        if(current_node)
-        {
-            status = axiom_soap_builder_construct_node(soap_builder, env, current_node);
-        }
-        else
-        {
-            /* there is an error. So, don't continue building it */
-            soap_builder->done = AXIS2_TRUE;
-            status = AXIS2_FAILURE;
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occurred when building node");
-        }
-    }
-    else if(current_event == -1)
+    if(current_event == -1)
     {
         /* there is an error. So, don't continue building it */
         soap_builder->done = AXIS2_TRUE;
@@ -381,7 +348,7 @@ axiom_soap_builder_get_document_element(
     return document_node;
 }
 
-static axis2_status_t
+axis2_status_t AXIS2_CALL
 axiom_soap_builder_construct_node(
     axiom_soap_builder_t * soap_builder,
     const axutil_env_t * env,
@@ -393,6 +360,18 @@ axiom_soap_builder_construct_node(
     int status = AXIS2_SUCCESS;
     axiom_node_t *parent = NULL;
 
+    /* Check whether current node is the very first element, which is SOAP Envelope.
+     * If last_node_status is AXIS2_BUILDER_LAST_NODE_NULL, then it means next node is SOAP Envelope
+     */
+    if(om_element_node == axiom_stax_builder_get_root_node(soap_builder->om_builder, env))
+    {
+        soap_builder->last_node_status = AXIS2_BUILDER_LAST_NODE_NULL;
+    }
+    else
+    {
+        soap_builder->last_node_status = AXIS2_BUILDER_LAST_NODE_NOT_NULL;
+    }
+
     /* get OM element struct from node */
     om_element = (axiom_element_t *)axiom_node_get_data_element(om_element_node, env);
     if(!om_element)

Modified: axis/axis2/c/core/trunk/src/core/transport/amqp/util/axis2_amqp_util.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/src/core/transport/amqp/util/axis2_amqp_util.c?rev=931454&r1=931453&r2=931454&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/src/core/transport/amqp/util/axis2_amqp_util.c (original)
+++ axis/axis2/c/core/trunk/src/core/transport/amqp/util/axis2_amqp_util.c Wed Apr  7 07:20:41 2010
@@ -264,18 +264,6 @@ axis2_amqp_util_get_soap_envelope(
     }
 
     soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
-
-    if(soap_envelope)
-    {
-        /* hack to get around MTOM problem */
-        axiom_soap_body_t *soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
-
-        if(soap_body)
-        {
-            axiom_soap_body_has_fault(soap_body, env);
-        }
-    }
-
     return soap_envelope;
 }
 

Modified: axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c?rev=931454&r1=931453&r2=931454&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c (original)
+++ axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c Wed Apr  7 07:20:41 2010
@@ -2258,16 +2258,7 @@ axis2_http_transport_utils_create_soap_m
             axiom_soap_builder_set_mime_body_parts(soap_builder, env, binary_data_map);
         }
 
-        if(soap_envelope)
-        {
-            /* hack to get around MTOM problem */
-            axiom_soap_body_t *soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
 
-            if(soap_body)
-            {
-                axiom_soap_body_has_fault(soap_body, env);
-            }
-        }
         if(stream)
         {
             axutil_stream_free(stream, env);