You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/12/27 08:46:55 UTC
svn commit: r359184 - in /webservices/axis2/trunk/c: include/
modules/xml/soap/src/
Author: samisa
Date: Mon Dec 26 23:46:43 2005
New Revision: 359184
URL: http://svn.apache.org/viewcvs?rev=359184&view=rev
Log:
Added code for SOAP body and resolved dependancies in the headers, fixed few bugs
Added:
webservices/axis2/trunk/c/modules/xml/soap/src/soap_body.c
Modified:
webservices/axis2/trunk/c/include/axis2_error.h
webservices/axis2/trunk/c/include/axis2_soap.h
webservices/axis2/trunk/c/include/axis2_soap_body.h
webservices/axis2/trunk/c/include/axis2_soap_envelope.h
webservices/axis2/trunk/c/include/axis2_soap_fault.h
webservices/axis2/trunk/c/include/axis2_soap_header.h
webservices/axis2/trunk/c/include/axis2_soap_header_block.h
webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am
Modified: webservices/axis2/trunk/c/include/axis2_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_error.h?rev=359184&r1=359183&r2=359184&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_error.h (original)
+++ webservices/axis2/trunk/c/include/axis2_error.h Mon Dec 26 23:46:43 2005
@@ -310,8 +310,9 @@
AXIS2_ERROR_MUST_UNDERSTAND_SHOULD_BE_1_0_TRUE_FALSE,
- AXIS2_ERROR_INVALID_VALUE_FOUND_IN_MUST_UNDERSTAND
-
+ AXIS2_ERROR_INVALID_VALUE_FOUND_IN_MUST_UNDERSTAND,
+ /** only one SOAP fault allowed in SOAP body */
+ AXIS2_ERROR_ONLY_ONE_SOAP_FAULT_ALLOWED_IN_BODY
};
/** @} */
Modified: webservices/axis2/trunk/c/include/axis2_soap.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_soap.h?rev=359184&r1=359183&r2=359184&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap.h Mon Dec 26 23:46:43 2005
@@ -169,4 +169,4 @@
}
#endif
-#endif /* AXIS2_SOAP_CONSTANTS_H */
\ No newline at end of file
+#endif /* AXIS2_SOAP_CONSTANTS_H */
Modified: webservices/axis2/trunk/c/include/axis2_soap_body.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_soap_body.h?rev=359184&r1=359183&r2=359184&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_body.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_body.h Mon Dec 26 23:46:43 2005
@@ -25,9 +25,8 @@
#include <axis2_env.h>
#include <axis2_om_node.h>
#include <axis2_om_element.h>
-#include <axis2_om_namespace.h>
-#include <axis2_soap_envelope.h>
-
+#include <axis2_om_namespace.h>
+#include <axis2_soap_fault.h>
#ifdef __cplusplus
@@ -36,8 +35,9 @@
#endif
-typedef struct axis2_soap_fault axis2_soap_fault_t;
+typedef struct axis2_soap_body axis2_soap_body_t;
typedef struct axis2_soap_body_ops axis2_soap_body_ops_t;
+struct axis2_soap_envelope;
/**
* @defgroup axis2_soap_body
@@ -46,50 +46,60 @@
*/
/**
+ * An object that represents the contents of the SOAP body
+ * element in a SOAP message. B SOAP body element consists of XML data
+ * that affects the way the application-specific content is processed.
+ * <P>
+ * B <code>SOAPBody</code> object contains <code>OMBodyBlock</code>
+ * objects, which have the content for the SOAP body.
+ * B <code>SOAPFault</code> object, which carries status and/or
+ * error information, is an example of a <code>OMBodyBlock</code> object.
+ */
+
+/**
* \brief soap_body operations struct
* ops Encapsulator struct of axis2_soap body
*/
AXIS2_DECLARE_DATA struct axis2_soap_body_ops
{
- /**
- * Free an axis2_soap_body
- * @param body pointer to soap_body struct
- * @param env Environment. MUST NOT be NULL
- * @return satus of the op. AXIS2_SUCCESS on success
- * else AXIS2_FAILURE
- */
-
- axis2_status_t (AXIS2_CALL *free_fn)(axis2_soap_body_t *body,
- axis2_env_t **env);
-
- axis2_soap_fault_t* (AXIS2_CALL *add_fault_with_error)
- (axis2_soap_body_t *body,
- axis2_env_t **env,
- axis2_char_t *error);
-
- axis2_bool_t (AXIS2_CALL *has_fault)(axis2_soap_body_t *body,
- axis2_env_t **env);
-
- axis2_soap_fault_t* (AXIS2_CALL *get_fault)
- (axis2_soap_body_t *body,
- axis2_env_t **env);
-
- axis2_status_t (AXIS2_CALL *add_fault_with_soap_fault)
- (axis2_soap_body_t *body,
- axis2_env_t **env,
- axis2_soap_fault_t *fault);
-
- axis2_om_node_t* (AXIS2_CALL *get_base_node)
- (axis2_soap_body_t *body,
- axis2_env_t **env);
-
- axis2_om_node_t* (AXIS2_CALL *set_base_node)
- (axis2_soap_body_t *body,
- axis2_env_t **env,
- axis2_om_node_t *node);
-
-
- };
+ axis2_status_t (AXIS2_CALL *free)(axis2_soap_body_t *body,
+ axis2_env_t **env);
+ /**
+ * Indicates whether a <code>SOAPFault</code> object exists in
+ * this <code>SOAPBody</code> object.
+ *
+ * @return <code>true</code> if a <code>SOAPFault</code> object exists in
+ * this <code>SOAPBody</code> object; <code>false</code>
+ * otherwise
+ */
+ axis2_bool_t (AXIS2_CALL *get_has_fault)(axis2_soap_body_t *body,
+ axis2_env_t **env);
+ /**
+ * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object.
+ *
+ * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object
+ */
+ axis2_soap_fault_t* (AXIS2_CALL *get_fault)(axis2_soap_body_t *body,
+ axis2_env_t **env);
+ /**
+ * @param soapFault
+ * @throws org.apache.axis2.om.OMException
+ *
+ * @throws OMException
+ */
+ axis2_status_t (AXIS2_CALL *add_fault)(axis2_soap_body_t *body,
+ axis2_env_t **env,
+ axis2_soap_fault_t *soap_fault);
+ axis2_om_node_t* (AXIS2_CALL *get_base)(axis2_soap_body_t *body,
+ axis2_env_t **env);
+ int (AXIS2_CALL *get_soap_version)(axis2_soap_body_t *body,
+ axis2_env_t **env);
+ axis2_status_t (AXIS2_CALL *set_soap_version)(axis2_soap_body_t *body,
+ axis2_env_t **env,
+ int soap_version);
+};
/**
* \brief soap_body struct
@@ -106,39 +116,26 @@
* creates a soap body struct
* @param env Environment. MUST NOT be NULL
*/
- AXIS2_DECLARE(axis2_soap_body_t *)
- axis2_soap_body_create (axis2_env_t **env);
-
+AXIS2_DECLARE(axis2_soap_body_t *)
+axis2_soap_body_create(axis2_env_t **env, struct axis2_soap_envelope *envelope);
+
/******************** Macros **************************************************/
/** free soap_body */
#define AXIS2_SOAP_BODY_FREE(body , env) \
- ((body)->ops->free_fn(body, env))
-
-#define AXIS2_SOAP_BODY_ADD_FAULT_WITH_ERROR(boby, env, error) \
- ((body)->ops->add_fault_with_error(body, env, error))
-
-#define AXIS2_SOAP_BODY_HAS_FAULT(body, env) \
- ((body)->ops->has_fault(body, env))
-
-#define AXIS2_SOAP_BODY_GET_FAULT(body, env) \
- ((body)->ops->get_fault(body, env))
-
-#define AXIS2_SOAP_BODY_ADD_SOAP_FAULT_WITH_SOAP_FAULT(body, env, fault) \
- ((body)->ops->add_fault_with_soap_fault(body, env, fault))
-
-#define AXIS2_SOAP_BODY_GET_BASE_NODE(body, env) \
- ((body)->ops->get_base_node(body, env))
-
-#define AXIS2_SOAP_BODY_SET_BASE_NODE(body, env, node) \
- ((body)->ops->set_base_node(body, env, node))
-
+ ((body)->ops->free(body, env))
+#define AXIS2_SOAP_BODY_GET_HAS_FAULT(body, env) ((body)->ops->get_has_fault(body, env))
+#define AXIS2_SOAP_BODY_GET_FAULT(body, env) ((body)->ops->get_fault(body, env))
+#define AXIS2_SOAP_BODY_ADD_FAULT(body, env, soap_fault) ((body)->ops->add_fault(body, env, soap_fault))
+#define AXIS2_SOAP_BODY_GET_BASE(body, env) ((body)->ops->get_base(body, env))
+#define AXIS2_SOAP_BODY_GET_SOAP_VERSION(body, env) ((body)->ops->get_soap_version(body, env))
+#define AXIS2_SOAP_BODY_SET_SOAP_VERSION(body, env, soap_version) ((body)->ops->set_soap_version(body, env, soap_version))
+
/** @} */
#ifdef __cplusplus
}
#endif
-
- #endif /* AXIS2_SOAP_BODY_H */
\ No newline at end of file
+#endif /* AXIS2_SOAP_BODY_H */
Modified: webservices/axis2/trunk/c/include/axis2_soap_envelope.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_soap_envelope.h?rev=359184&r1=359183&r2=359184&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_envelope.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_envelope.h Mon Dec 26 23:46:43 2005
@@ -35,8 +35,8 @@
typedef struct axis2_soap_envelope axis2_soap_envelope_t;
typedef struct axis2_soap_envelope_ops axis2_soap_envelope_ops_t;
- typedef struct axis2_soap_body axis2_soap_body_t;
- typedef struct axis2_soap_header axis2_soap_header_t;
+ struct axis2_soap_body;
+ struct axis2_soap_header;
/**
* @defgroup axis2_soap_envelope
@@ -66,17 +66,17 @@
* SOAPEnvelope</CODE> object. <P> This SOAPHeader will just be a container
* for all the headers in the <CODE>OMMessage</CODE> </P>
*/
- axis2_soap_header_t* (AXIS2_CALL *get_header)
+ struct axis2_soap_header* (AXIS2_CALL *get_header)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env);
- axis2_soap_header_t* (AXIS2_CALL *add_header_block)
+ struct axis2_soap_header* (AXIS2_CALL *add_header_block)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env,
axis2_char_t *localname,
axis2_om_namespace_t* ns);
- axis2_soap_body_t* (AXIS2_CALL *get_body)
+ struct axis2_soap_body* (AXIS2_CALL *get_body)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env);
@@ -139,4 +139,4 @@
}
#endif
-#endif /* AXIS2_SOAP_ENVELOPE_H */
\ No newline at end of file
+#endif /* AXIS2_SOAP_ENVELOPE_H */
Modified: webservices/axis2/trunk/c/include/axis2_soap_fault.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_soap_fault.h?rev=359184&r1=359183&r2=359184&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_fault.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_fault.h Mon Dec 26 23:46:43 2005
@@ -22,8 +22,6 @@
* @file axis2_soap_fault.h
* @brief axis2_soap_fault struct
*/
-#include <axis2_soap_envelope.h>
-#include <axis2_soap_body.h>
#include <axis2_soap.h>
#include <axis2_env.h>
#include <axis2_om_node.h>
@@ -35,6 +33,9 @@
{
#endif
+typedef struct axis2_soap_fault axis2_soap_fault_t;
+typedef struct axis2_soap_fault_ops axis2_soap_fault_ops_t;
+
typedef struct axis2_soap_fault_reason axis2_soap_fault_reason_t;
typedef struct axis2_soap_fault_detail axis2_soap_fault_detail_t;
typedef struct axis2_soap_fault_sub_code axis2_soap_fault_sub_code_t;
@@ -43,9 +44,8 @@
typedef struct axis2_soap_fault_role axis2_soap_fault_role_t;
typedef struct axis2_soap_fault_text axis2_soap_fault_text_t;
typedef struct axis2_soap_fault_value axis2_soap_fault_value_t;
-
-
-typedef struct axis2_soap_fault_ops axis2_soap_fault_ops_t;
+
+struct axis2_soap_body;
typedef enum axis2_soap_fault_types
{
@@ -58,7 +58,7 @@
AXIS2_SOAP_FAULT_ROLE,
AXIS2_SOAP_FAULT_TEXT,
AXIS2_SOAP_FAULT_VALUE
- };
+ }axis2_soap_fault_types_t;
/**
@@ -178,11 +178,11 @@
AXIS2_DECLARE(axis2_soap_fault_t *)
axis2_soap_fault_create_with_parent(axis2_env_t **env,
- axis2_soap_body_t *parent);
+ struct axis2_soap_body *parent);
AXIS2_DECLARE(axis2_soap_fault_t *)
axis2_soap_fault_create_with_exception(axis2_env_t **env,
- axis2_soap_body_t *parent,
+ struct axis2_soap_body *parent,
axis2_char_t* exception);
/******************** Macros **************************************************/
@@ -246,4 +246,3 @@
#endif /* AXIS2_SOAP_FAULT_H */
-
Modified: webservices/axis2/trunk/c/include/axis2_soap_header.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_soap_header.h?rev=359184&r1=359183&r2=359184&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_header.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_header.h Mon Dec 26 23:46:43 2005
@@ -28,8 +28,7 @@
#include <axis2_om_children_qname_iterator.h>
#include <axis2_om_children_with_specific_attribute_iterator.h>
#include <axis2_hash.h>
-#include <axis2_soap_envelope.h>
-#include <axis2_soap_body.h>
+#include <axis2_soap_header_block.h>
#ifdef __cplusplus
@@ -37,9 +36,10 @@
{
#endif
-typedef struct axis2_soap_header_block axis2_soap_header_block_t;
-
+typedef struct axis2_soap_header axis2_soap_header_t;
typedef struct axis2_soap_header_ops axis2_soap_header_ops_t;
+
+struct axis2_soap_envelope;
/**
@@ -149,7 +149,7 @@
AXIS2_DECLARE(axis2_soap_header_t *)
axis2_soap_header_create_with_parent(axis2_env_t **env,
- axis2_soap_envelope_t *envelope);
+ struct axis2_soap_envelope *envelope);
/******************** Macros **************************************************/
@@ -189,4 +189,4 @@
#endif
- #endif /* AXIS2_SOAP_HEADER_H */
\ No newline at end of file
+#endif /* AXIS2_SOAP_HEADER_H */
Modified: webservices/axis2/trunk/c/include/axis2_soap_header_block.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_soap_header_block.h?rev=359184&r1=359183&r2=359184&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_header_block.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_header_block.h Mon Dec 26 23:46:43 2005
@@ -26,15 +26,15 @@
#include <axis2_om_node.h>
#include <axis2_om_element.h>
#include <axis2_array_list.h>
-#include <axis2_soap_header.h>
#ifdef __cplusplus
extern "C"
{
#endif
+ typedef struct axis2_soap_header_block axis2_soap_header_block_t;
typedef struct axis2_soap_header_block_ops axis2_soap_header_block_ops_t;
-
+ struct axis2_soap_header;
/**
* @defgroup axis2_soap_header_block
@@ -150,18 +150,18 @@
axis2_soap_header_block_create_with_parent(axis2_env_t **env,
axis2_char_t *localname,
axis2_om_namespace_t *ns,
- axis2_soap_header_t *parent);
+ struct axis2_soap_header *parent);
AXIS2_DECLARE(axis2_soap_header_block_t *)
axis2_soap11_header_block_create_with_parent(axis2_env_t **env,
axis2_char_t *localname,
axis2_om_namespace_t *ns,
- axis2_soap_header_t *parent);
+ struct axis2_soap_header *parent);
AXIS2_DECLARE(axis2_soap_header_block_t *)
axis2_soap12_header_block_create_with_parent(axis2_env_t **env,
axis2_char_t *localname,
axis2_om_namespace_t *ns,
- axis2_soap_header_t *parent);
+ struct axis2_soap_header *parent);
/******************** Macros **************************************************/
/** free soap_header_block */
@@ -218,4 +218,4 @@
#endif
- #endif /* AXIS2_SOAP_HEADER_BLOCK_H */
\ No newline at end of file
+ #endif /* AXIS2_SOAP_HEADER_BLOCK_H */
Modified: webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am?rev=359184&r1=359183&r2=359184&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am Mon Dec 26 23:46:43 2005
@@ -11,7 +11,8 @@
axis2_soap_fault_value.c \
axis2_soap_header_block.c \
axis2_soap_header.c \
- axis2_soap_utils.c
+ axis2_soap_utils.c \
+ soap_body.c
libaxis2_soap_la_LIBADD =
INCLUDES = -I$(top_builddir)/include -I$(top_builddir)/modules/xml/parser -I$(top_builddir)/modules/util/src
Added: webservices/axis2/trunk/c/modules/xml/soap/src/soap_body.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/src/soap_body.c?rev=359184&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/src/soap_body.c (added)
+++ webservices/axis2/trunk/c/modules/xml/soap/src/soap_body.c Mon Dec 26 23:46:43 2005
@@ -0,0 +1,276 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+ #include <axis2_soap_envelope.h>
+ #include <axis2_soap_body.h>
+ #include <axis2_hash.h>
+ #include <axis2_soap.h>
+
+ /******************* impl struct *********************************************/
+
+ typedef struct axis2_soap_body_impl_t
+ {
+ axis2_soap_body_t soap_body;
+
+ axis2_om_node_t *base;
+
+ int soap_version;
+
+ axis2_bool_t has_fault;
+
+ axis2_soap_fault_t *soap_fault;
+
+ }axis2_soap_body_impl_t;
+
+ /****************** Macro ****************************************************/
+
+ #define AXIS2_INTF_TO_IMPL(body) ((axis2_soap_body_impl_t*)body)
+
+ /****************** Function prototypes **************************************/
+
+axis2_status_t AXIS2_CALL
+axis2_soap_body_free(axis2_soap_body_t *body,
+ axis2_env_t **env);
+axis2_bool_t AXIS2_CALL axis2_soap_body_get_has_fault(axis2_soap_body_t *body,
+ axis2_env_t **env);
+axis2_soap_fault_t* AXIS2_CALL axis2_soap_body_get_fault(axis2_soap_body_t *body,
+ axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_soap_body_add_fault(axis2_soap_body_t *body,
+ axis2_env_t **env,
+ axis2_soap_fault_t *soap_fault);
+axis2_om_node_t* AXIS2_CALL
+axis2_soap_body_get_base(axis2_soap_body_t *body,
+ axis2_env_t **env);
+int AXIS2_CALL
+axis2_soap_body_get_soap_version(axis2_soap_body_t *body,
+ axis2_env_t **env);
+axis2_status_t AXIS2_CALL
+axis2_soap_body_set_soap_version(axis2_soap_body_t *body,
+ axis2_env_t **env,
+ int soap_version);
+
+/*************** function implementations *************************************/
+
+axis2_soap_body_t* AXIS2_CALL
+axis2_soap_body_create(axis2_env_t **env, struct axis2_soap_envelope *envelope)
+{
+ axis2_soap_body_impl_t *body_impl = NULL;
+ axis2_om_element_t *ele = NULL;
+ axis2_om_node_t *parent = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+ body_impl = (axis2_soap_body_impl_t*)AXIS2_MALLOC(
+ (*env)->allocator,
+ sizeof(axis2_soap_body_impl_t));
+ if(!body_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ body_impl->soap_body.ops = NULL;
+ body_impl->base = NULL;
+ body_impl->soap_version = AXIS2_SOAP12;
+ body_impl->has_fault = AXIS2_FALSE;
+ body_impl->soap_fault = NULL;
+
+ /*get parent node from SOAP envelope */
+ if (envelope)
+ {
+ parent = AXIS2_SOAP_ENVELOPE_GET_BASE_NODE(envelope, env);
+ }
+
+ ele = axis2_om_element_create(env, parent, AXIS2_SOAP_BODY_LOCAL_NAME, NULL, &(body_impl->base));
+ if (!ele)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ axis2_soap_body_free(&(body_impl->soap_body), env);
+ return NULL;
+ }
+
+ body_impl->soap_body.ops = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_soap_body_ops_t) );
+ if (!body_impl->soap_body.ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ axis2_soap_body_free(&(body_impl->soap_body), env);
+ return NULL;
+ }
+
+ body_impl->soap_body.ops->free = axis2_soap_body_free;
+ body_impl->soap_body.ops->get_has_fault = axis2_soap_body_get_has_fault;
+ body_impl->soap_body.ops->get_fault = axis2_soap_body_get_fault;
+ body_impl->soap_body.ops->add_fault = axis2_soap_body_add_fault;
+ body_impl->soap_body.ops->get_base = axis2_soap_body_get_base;
+ body_impl->soap_body.ops->get_soap_version = axis2_soap_body_get_soap_version;
+ body_impl->soap_body.ops->set_soap_version = axis2_soap_body_set_soap_version;
+
+ return &(body_impl->soap_body);
+}
+
+axis2_status_t AXIS2_CALL
+axis2_soap_body_free(axis2_soap_body_t *body,
+ axis2_env_t **env)
+{
+ axis2_soap_body_impl_t *body_impl = NULL;
+ AXIS2_FUNC_PARAM_CHECK(body, env, AXIS2_FAILURE);
+ body_impl = AXIS2_INTF_TO_IMPL(body);
+
+ if(body->ops)
+ {
+ AXIS2_FREE((*env)->allocator, body->ops);
+ body->ops = NULL;
+ }
+
+ if(body_impl->base)
+ {
+ AXIS2_OM_NODE_FREE_TREE(body_impl->base, env);
+ body_impl->base = NULL;
+ }
+
+ AXIS2_FREE((*env)->allocator, body_impl);
+ body_impl = NULL;
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * Indicates whether a <code>SOAPFault</code> object exists in
+ * this <code>SOAPBody</code> object.
+ *
+ * @return <code>true</code> if a <code>SOAPFault</code> object exists in
+ * this <code>SOAPBody</code> object; <code>false</code>
+ * otherwise
+ */
+axis2_bool_t AXIS2_CALL axis2_soap_body_get_has_fault(axis2_soap_body_t *body,
+ axis2_env_t **env)
+{
+ axis2_soap_body_impl_t *body_impl = NULL;
+ AXIS2_FUNC_PARAM_CHECK(body, env, AXIS2_FAILURE);
+ body_impl = AXIS2_INTF_TO_IMPL(body);
+
+ return body_impl->has_fault;
+
+ /*if (has_fault) {
+ return true;
+ } else {
+ OMElement element = getFirstElement();
+ if (element != null
+ &&
+ SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(
+ element.getLocalName())
+ &&
+ (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
+ element.getNamespace().getName())
+ ||
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
+ element.getNamespace().getName()))) { //added this line
+ has_fault = true;
+ return true;
+ } else {
+ return false;
+ }
+ }*/
+}
+
+/**
+ * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object.
+ *
+ * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object
+ */
+axis2_soap_fault_t* AXIS2_CALL axis2_soap_body_get_fault(axis2_soap_body_t *body,
+ axis2_env_t **env)
+{
+ axis2_soap_body_impl_t *body_impl = NULL;
+ AXIS2_FUNC_PARAM_CHECK(body, env, NULL);
+ body_impl = AXIS2_INTF_TO_IMPL(body);
+
+ return body_impl->soap_fault;
+ /*
+ OMElement element = getFirstElement();
+ if (has_fault) {
+ return (SOAPFault) element;
+ } else if (element != null
+ &&
+ SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(
+ element.getLocalName())
+ &&
+ (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
+ element.getNamespace().getName())
+ ||
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
+ element.getNamespace().getName()))) { //added this line
+ has_fault = true;
+ return (SOAPFault) element;
+ } else {
+ return null;
+ }*/
+
+}
+
+/**
+ * @param soapFault
+ * @throws org.apache.axis2.om.OMException
+ *
+ * @throws OMException
+ */
+axis2_status_t AXIS2_CALL axis2_soap_body_add_fault(axis2_soap_body_t *body,
+ axis2_env_t **env,
+ axis2_soap_fault_t *soap_fault)
+{
+ axis2_soap_body_impl_t *body_impl = NULL;
+ AXIS2_FUNC_PARAM_CHECK(body, env, AXIS2_FAILURE);
+ body_impl = AXIS2_INTF_TO_IMPL(body);
+
+ if (body_impl->has_fault)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_ONLY_ONE_SOAP_FAULT_ALLOWED_IN_BODY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
+ if (soap_fault)
+ {
+ body_impl->soap_fault = soap_fault;
+ AXIS2_OM_NODE_ADD_CHILD(body_impl->base, env, AXIS2_SOAP_FAULT_GET_BASE_NODE(soap_fault, env));
+ body_impl->has_fault = AXIS2_TRUE;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_om_node_t* AXIS2_CALL
+axis2_soap_body_get_base(axis2_soap_body_t *body,
+ axis2_env_t **env)
+{
+ AXIS2_FUNC_PARAM_CHECK(body, env, AXIS2_FAILURE);
+ return AXIS2_INTF_TO_IMPL(body)->base;
+}
+
+int AXIS2_CALL
+axis2_soap_body_get_soap_version(axis2_soap_body_t *body,
+ axis2_env_t **env)
+{
+ AXIS2_FUNC_PARAM_CHECK(body, env, AXIS2_FAILURE);
+ return AXIS2_INTF_TO_IMPL(body)->soap_version;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_soap_body_set_soap_version(axis2_soap_body_t *body,
+ axis2_env_t **env,
+ int soap_version)
+{
+ AXIS2_FUNC_PARAM_CHECK(body, env, AXIS2_FAILURE);
+ AXIS2_INTF_TO_IMPL(body)->soap_version = soap_version;
+ return AXIS2_SUCCESS;
+}