summaryrefslogtreecommitdiffstats
path: root/axiom/src/soap
diff options
context:
space:
mode:
Diffstat (limited to 'axiom/src/soap')
-rw-r--r--axiom/src/soap/axiom_soap_builder_internal.h36
-rw-r--r--axiom/src/soap/soap_builder.c53
2 files changed, 52 insertions, 37 deletions
diff --git a/axiom/src/soap/axiom_soap_builder_internal.h b/axiom/src/soap/axiom_soap_builder_internal.h
new file mode 100644
index 0000000..d23b8e8
--- /dev/null
+++ b/axiom/src/soap/axiom_soap_builder_internal.h
@@ -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_ */
diff --git a/axiom/src/soap/soap_builder.c b/axiom/src/soap/soap_builder.c
index 2496506..a2e8b23 100644
--- a/axiom/src/soap/soap_builder.c
+++ b/axiom/src/soap/soap_builder.c
@@ -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)