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 na...@apache.org on 2006/01/30 04:19:23 UTC
svn commit: r373421 - in /webservices/axis2/trunk/c: include/ modules/util/
modules/xml/om/ modules/xml/parser/libxml2/ modules/xml/soap/
Author: nandika
Date: Sun Jan 29 19:19:06 2006
New Revision: 373421
URL: http://svn.apache.org/viewcvs?rev=373421&view=rev
Log:
new function, documentation added
Modified:
webservices/axis2/trunk/c/include/axis2_allocator.h
webservices/axis2/trunk/c/include/axis2_soap_envelope.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/util/allocator.c
webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c
webservices/axis2/trunk/c/modules/xml/parser/libxml2/Makefile.am
webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c
webservices/axis2/trunk/c/modules/xml/soap/soap_body.c
webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c
webservices/axis2/trunk/c/modules/xml/soap/soap_fault_code.c
webservices/axis2/trunk/c/modules/xml/soap/soap_header.c
webservices/axis2/trunk/c/modules/xml/soap/soap_header_block.c
Modified: webservices/axis2/trunk/c/include/axis2_allocator.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_allocator.h?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_allocator.h (original)
+++ webservices/axis2/trunk/c/include/axis2_allocator.h Sun Jan 29 19:19:06 2006
@@ -73,6 +73,13 @@
*/
AXIS2_DECLARE(axis2_allocator_t *) axis2_allocator_init (axis2_allocator_t * allocator);
+ /**
+ * This function should be used to deallocate memory if the default allocator provided by
+ * axis2_allocator_init()
+ * @param allocator
+ */
+ AXIS2_DECLARE(axis2_status_t) axis2_allocator_free(axis2_allocator_t *allocator);
+
#define AXIS2_MALLOC(allocator, size) ((allocator)->malloc(size))
#define AXIS2_REALLOC(allocator, ptr, size) ((allocator)->realloc(ptr, size))
#define AXIS2_FREE(allocator, ptr) ((allocator)->free(ptr))
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=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_envelope.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_envelope.h Sun Jan 29 19:19:06 2006
@@ -53,108 +53,132 @@
AXIS2_DECLARE_DATA struct axis2_soap_envelope_ops
{
/**
- * Returns the <CODE>SOAPHeader</CODE> object for this <CODE>
- * SOAPEnvelope</CODE> object. <P> This SOAPHeader will just be a container
- * for all the headers in the <CODE>OMMessage</CODE> </P>
- *
- * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if there
- * is none
- * @throws org.apache.axis2.om.OMException
- * if there is a problem obtaining
- * the <CODE>SOAPHeader</CODE>
- * object
- * @throws OMException
+ * gets the soap header of this soap envelope
+ * @param envelope soap envelope
+ * @param env environment must not be null
+ * @return soap header null it no header is present
*/
struct axis2_soap_header* (AXIS2_CALL *get_header)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env);
/**
- * Convenience method to add a SOAP header to this envelope
- *
- * @param namespaceURI
- * @param name
- */
- /*
- struct axis2* (AXIS2_CALL *add_header)
- (axis2_soap_envelope_t *envelope,
- axis2_env_t **env,
- axis2_char_t *namespace_uri,
- axis2_char_t *name);
- */
- /**
- * Returns the <CODE>SOAPBody</CODE> object associated with this
- * <CODE>SOAPEnvelope</CODE> object. <P> This SOAPBody will just be a
- * container for all the BodyElements in the <CODE>OMMessage</CODE> </P>
- *
- * @return the <CODE>SOAPBody</CODE> object for this <CODE>
- * SOAPEnvelope</CODE> object or <CODE>null</CODE> if there is none
- * @throws org.apache.axis2.om.OMException
- * if there is a problem obtaining
- * the <CODE>SOAPBody</CODE> object
- * @throws OMException
+ * Returns the soap body associated with this soap envelope
+ * @param envelope soap_envelope
+ * @param env environment
+ * @return soap_body
*/
struct axis2_soap_body* (AXIS2_CALL *get_body)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env);
-
+ /**
+ * serialize function , serialize the soap envelope
+ * IF the soap version it set to soap11 the soap fault part is converted
+ * to soap11 fault even is the underlying soap fault is of soap12 type
+ * @param envelope soap envelope
+ * @param env environment must not be null
+ * @param om_output
+ * @param cache whether caching is enabled or not
+ * @return status code , AXIS2_SUCCESS if success ,
+ * AXIS2_FAILURE otherwise
+ */
axis2_status_t (AXIS2_CALL *serialize)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env,
axis2_om_output_t *om_output,
axis2_bool_t cache);
-
+ /**
+ * Free function, This function deallocate all the resources associated
+ * with the soap_envelope
+ * IT frees it's soap body and soap headers as well as the underlying
+ * om node tree by calling AXIS2_OM_NODE_FREE_TREE function
+ * @param envelope soap_envelope
+ * @param env environment
+ * @return status code AXIS2_SUCCESS on success , AXIS2_FAILURE otherwise
+ */
axis2_status_t (AXIS2_CALL *free)(axis2_soap_envelope_t *envelope,
axis2_env_t **env);
-
+ /**
+ * returns the om_node associated with this soap envelope
+ * @param envelope soap_envelope
+ * @param env environment
+ * @return axis2_om_node_t pointer
+ */
axis2_om_node_t* (AXIS2_CALL *get_base_node)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env);
-
+
+ /**
+ * This function is intended to be used by the soap builder
+ * associate an om_node with the soap_envelope
+ */
axis2_status_t (AXIS2_CALL *set_base_node)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env,
axis2_om_node_t *base_node);
-
+
+ /** returns the soap version of this soap envelope
+ * @param envelope soap_envelope
+ * @param env environment must not be null
+ * @return soap_version AXIS2_SOAP12 or AXIS2_SOAP11
+ */
int (AXIS2_CALL *get_soap_version)(axis2_soap_envelope_t *envelope,
axis2_env_t **env);
-
+
+ /**
+ * set soap version
+ */
axis2_status_t (AXIS2_CALL *set_soap_version)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env,
int soap_version);
-
+ /**
+ * set soap body. This is just a pointer assignment intended to be used
+ * by soap builder . Does not adjust the om tree accordingly
+ */
axis2_status_t (AXIS2_CALL *set_body)(axis2_soap_envelope_t *envelope,
axis2_env_t **env,
struct axis2_soap_body *body);
-
+ /**
+ * set soap header. This is just a pointer assignment intended to be used
+ * by soap builder . Does not adjust the om tree accordingly
+ */
axis2_status_t (AXIS2_CALL *set_header)(axis2_soap_envelope_t *envelope,
axis2_env_t **env,
struct axis2_soap_header *header);
-
+
+ /** return the soap envelope namespace
+ * @param envelope
+ * @param env
+ * @return axis2_om_namespace_t
+ */
axis2_om_namespace_t* (AXIS2_CALL *get_namespace)
(axis2_soap_envelope_t *envelope,
axis2_env_t **env);
+ /**
+ * Associate a soap builder with this soap envelope
+ * This function is intended to be used by builder
+ */
axis2_status_t (AXIS2_CALL *set_builder)(axis2_soap_envelope_t *envelope,
axis2_env_t **env,
struct axis2_soap_builder *builder);
};
- /**
- * \brief soap_envelope struct
- * represent a soap_envelope
- */
- struct axis2_soap_envelope
- {
- /** operation of axis2_soap_envelope struct */
- axis2_soap_envelope_ops_t *ops;
-
- };
-
- /**
- * creates a soap body struct
- * @param env Environment. MUST NOT be NULL
- */
+/**
+ * \brief soap_envelope struct
+ * represent a soap_envelope
+ */
+struct axis2_soap_envelope
+{
+ /** operation of axis2_soap_envelope struct */
+ axis2_soap_envelope_ops_t *ops;
+};
+
+ /**
+ * creates a soap envelope struct with empty values
+ * Indended to be uaed by soap_builder
+ * @param env Environment. MUST NOT be NULL
+ */
AXIS2_DECLARE(axis2_soap_envelope_t*)
axis2_soap_envelope_create(axis2_env_t **env, axis2_om_namespace_t *ns);
@@ -179,7 +203,9 @@
*/
#define AXIS2_SOAP_ENVELOPE_GET_BODY(envelope, env) \
((envelope)->ops->get_body(envelope, env))
-
+/**
+ * serialize soap envelope
+ */
#define AXIS2_SOAP_ENVELOPE_SERIALIZE(envelope, env, om_output, cache) \
((envelope)->ops->serialize(envelope, env, om_output, cache))
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=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_header.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_header.h Sun Jan 29 19:19:06 2006
@@ -92,11 +92,28 @@
(axis2_soap_header_t* header,
axis2_env_t **env,
axis2_char_t* param_role);
-
+ /**
+ * returns an arraylist of header_blocks which has a given namesapce uri
+ * @param header
+ * @param env environment must not be null
+ * @param ns_uri namespace uri
+ * @return pointer to axis2_array_list_t, or null if no header_blocks with
+ * given namespace uri exists
+ * The returned array_list must be freed by the user.
+ */
+ axis2_array_list_t* (AXIS2_CALL *get_header_block_with_namespace_uri)
+ (axis2_soap_header_t* header,
+ axis2_env_t **env,
+ axis2_char_t *ns_uri);
+ /**
+ *
+ */
axis2_om_children_qname_iterator_t* (AXIS2_CALL *examine_all_header_blocks)
(axis2_soap_header_t* header,
axis2_env_t **env);
-
+ /**
+ *
+ */
axis2_om_children_with_specific_attribute_iterator_t *
(AXIS2_CALL *extract_header_blocks)(axis2_soap_header_t *header,
axis2_env_t **env,
@@ -184,8 +201,8 @@
#define AXIS2_SOAP_HEADER_EXAMINE_ALL_HEADER_BLOCKS(header, env) \
((header)->ops->examine_all_header_blocks(header, env))
-#define AXIS2_SOAP_HEADER_EXTRACT_HEADER_BLOCKS(header, env) \
- ((header)->ops->extract_header_blocks(header, env))
+#define AXIS2_SOAP_HEADER_EXTRACT_HEADER_BLOCKS(header, env, role) \
+ ((header)->ops->extract_header_blocks(header, env, role))
#define AXIS2_SOAP_HEADER_SET_BASE_NODE(header, env, node) \
((header)->ops->set_base_node(header, env, node))
@@ -205,6 +222,8 @@
#define AXIS2_SOAP_HEADER_SET_BUILDER(header, env, builder) \
((header)->ops->set_builder(header, env, builder))
+#define AXIS2_SOAP_HEADER_GET_HEADER_BLOCK_WITH_NAMESPACE_URI(header, env, uri)\
+ ((header)->ops->get_header_block_with_namespace_uri(header, env, uri))
/** @} */
#ifdef __cplusplus
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=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_soap_header_block.h (original)
+++ webservices/axis2/trunk/c/include/axis2_soap_header_block.h Sun Jan 29 19:19:06 2006
@@ -125,8 +125,6 @@
(axis2_soap_header_block_t *header_block,
axis2_env_t **env,
int soap_version);
-
-
};
/**
Modified: webservices/axis2/trunk/c/modules/util/allocator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/allocator.c?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/allocator.c (original)
+++ webservices/axis2/trunk/c/modules/util/allocator.c Sun Jan 29 19:19:06 2006
@@ -15,6 +15,7 @@
*/
#include <axis2_allocator.h>
+#include <axis2.h>
#include <stdlib.h>
AXIS2_DECLARE(axis2_allocator_t *)
@@ -35,4 +36,12 @@
}
}
return NULL;
+}
+
+AXIS2_DECLARE(axis2_status_t)
+axis2_allocator_free(axis2_allocator_t *allocator)
+{
+ if(allocator)
+ free(allocator);
+ return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c Sun Jan 29 19:19:06 2006
@@ -72,8 +72,10 @@
axis2_bool_t detach)
{
axis2_om_children_with_specific_attribute_iterator_impl_t *iterator_impl = NULL;
- AXIS2_FUNC_PARAM_CHECK(current_child, env, NULL);
-
+
+ AXIS2_PARAM_CHECK((*env)->error, current_child, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, attr_qname, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, attr_value, NULL);
iterator_impl = (axis2_om_children_with_specific_attribute_iterator_impl_t *)
AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_om_children_with_specific_attribute_iterator_impl_t));
@@ -167,7 +169,6 @@
axis2_om_children_with_specific_attribute_iterator_impl_t *iterator_impl = NULL;
AXIS2_FUNC_PARAM_CHECK(iterator, env, AXIS2_FAILURE);
iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
-
if(!(iterator_impl->current_child))
{
return AXIS2_FALSE;
@@ -181,6 +182,9 @@
axis2_om_element_t *om_ele = NULL;
om_ele = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(
iterator_impl->current_child, env);
+ if(!om_ele)
+ printf(" om element null");
+ printf("\n localname %s", AXIS2_OM_ELEMENT_GET_LOCALNAME(om_ele, env));
om_attr = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(om_ele, env,
iterator_impl->attr_qname);
if(om_attr &&
@@ -205,9 +209,10 @@
iterator_impl->current_child =
AXIS2_OM_NODE_GET_NEXT_SIBLING(
iterator_impl->current_child, env);
- need_to_move_forward = iterator_impl->current_child != NULL;
+ need_to_move_forward = (iterator_impl->current_child != NULL);
}
- }
+
+ }
return matching_node_found;
}
Modified: webservices/axis2/trunk/c/modules/xml/parser/libxml2/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/libxml2/Makefile.am?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/libxml2/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/libxml2/Makefile.am Sun Jan 29 19:19:06 2006
@@ -1,7 +1,7 @@
lib_LTLIBRARIES = libaxis2_libxml2.la
AM_CPPFLAGS = $(CPPFLAGS)
-libaxis2_libxml2_la_SOURCES = axis2_libxml2_reader_wrapper.c \
- axis2_libxml2_writer_wrapper.c
+libaxis2_libxml2_la_SOURCES = libxml2_reader_wrapper.c \
+ libxml2_writer_wrapper.c
libaxis2_libxml2_la_LIBADD =
Modified: webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c Sun Jan 29 19:19:06 2006
@@ -178,7 +178,8 @@
soap_envelope = AXIS2_SOAP_BUILDER_GET_SOAP_ENVELOPE(builder_helper_impl->soap_builder, env);
soap_body = AXIS2_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
soap_fault = AXIS2_SOAP_BODY_GET_FAULT(soap_body, env);
-
+ if(!soap_fault)
+ printf("soap fault null");
if(element_level == 4)
{
if(AXIS2_STRCMP(AXIS2_SOAP12_SOAP_FAULT_CODE_LOCAL_NAME, ele_localname) == 0)
@@ -194,7 +195,7 @@
{
axis2_soap_fault_code_t* soap_fault_code = NULL;
soap_fault_code = axis2_soap_fault_code_create(env);
- AXIS2_SOAP_FAULT_CODE_SET_BASE_NODE(soap_fault, env, om_ele_node);
+ AXIS2_SOAP_FAULT_CODE_SET_BASE_NODE(soap_fault_code , env, om_ele_node);
AXIS2_SOAP_FAULT_CODE_SET_SOAP_VERSION(soap_fault_code, env, AXIS2_SOAP12);
AXIS2_SOAP_FAULT_CODE_SET_BUILDER(soap_fault_code, env,
Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_body.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_body.c?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_body.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_body.c Sun Jan 29 19:19:06 2006
@@ -276,7 +276,7 @@
axis2_soap_body_impl_t *body_impl = NULL;
AXIS2_FUNC_PARAM_CHECK(body, env, NULL);
body_impl = AXIS2_INTF_TO_IMPL(body);
- if(body_impl->has_fault)
+ if(body_impl->soap_fault)
{
return body_impl->soap_fault;
}
Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c Sun Jan 29 19:19:06 2006
@@ -134,7 +134,8 @@
envelope_impl->body = NULL;
envelope_impl->soap_builder = NULL;
- envelope_impl->soap_envelope.ops = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_soap_envelope_ops_t) );
+ envelope_impl->soap_envelope.ops = AXIS2_MALLOC( (*env)->allocator,
+ sizeof(axis2_soap_envelope_ops_t) );
if (!envelope_impl->soap_envelope.ops)
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -142,7 +143,8 @@
return NULL;
}
- envelope_impl->soap_envelope.ops->free = axis2_soap_envelope_free;
+ envelope_impl->soap_envelope.ops->free =
+ axis2_soap_envelope_free;
envelope_impl->soap_envelope.ops->get_base_node =
axis2_soap_envelope_get_base_node;
@@ -166,15 +168,16 @@
axis2_soap_envelope_get_namespace;
envelope_impl->soap_envelope.ops->set_builder =
axis2_soap_envelope_set_builder;
-
envelope_impl->soap_envelope.ops->serialize =
axis2_soap_envelope_serialize;
+
return &(envelope_impl->soap_envelope);
}
AXIS2_DECLARE(axis2_soap_envelope_t*)
-axis2_soap_envelope_create(axis2_env_t **env, axis2_om_namespace_t *ns)
+axis2_soap_envelope_create(axis2_env_t **env,
+ axis2_om_namespace_t *ns)
{
axis2_soap_envelope_impl_t *envelope_impl = NULL;
axis2_om_element_t *ele = NULL;
@@ -195,7 +198,9 @@
envelope_impl->body = NULL;
envelope_impl->soap_builder = NULL;
- ele = axis2_om_element_create(env, NULL, AXIS2_SOAP_ENVELOPE_LOCAL_NAME, ns, &(envelope_impl->om_ele_node));
+ ele = axis2_om_element_create(env, NULL,
+ AXIS2_SOAP_ENVELOPE_LOCAL_NAME, ns,
+ &(envelope_impl->om_ele_node));
if (!ele)
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -203,7 +208,8 @@
return NULL;
}
- envelope_impl->soap_envelope.ops = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_soap_envelope_ops_t) );
+ envelope_impl->soap_envelope.ops = AXIS2_MALLOC( (*env)->allocator,
+ sizeof(axis2_soap_envelope_ops_t) );
if (!envelope_impl->soap_envelope.ops)
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -311,19 +317,6 @@
return AXIS2_SUCCESS;
}
-/**
- * Returns the <CODE>SOAPHeader</CODE> object for this <CODE>
- * SOAPEnvelope</CODE> object. <P> This SOAPHeader will just be a container
- * for all the headers in the <CODE>OMMessage</CODE> </P>
- *
- * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if there
- * is none
- * @throws org.apache.axis2.om.OMException
- * if there is a problem obtaining
- * the <CODE>SOAPHeader</CODE>
- * object
- * @throws OMException
- */
axis2_soap_header_t* AXIS2_CALL
axis2_soap_envelope_get_header(axis2_soap_envelope_t *envelope,
axis2_env_t **env)
@@ -338,68 +331,17 @@
}
else if(envelope_impl->soap_builder)
{
- while(!(envelope_impl->header) && !AXIS2_OM_NODE_GET_BUILD_STATUS(envelope_impl->om_ele_node, env))
+ while(!(envelope_impl->header) && !AXIS2_OM_NODE_GET_BUILD_STATUS(
+ envelope_impl->om_ele_node, env))
{
status = AXIS2_SOAP_BUILDER_NEXT(envelope_impl->soap_builder, env);
if(status == AXIS2_FAILURE)
break;
}
}
- /*
- axis2_qname_t *header_qn = NULL;
- axis2_om_node_t *header_node = NULL;
- axis2_om_element_t *header_ele = NULL;
- axis2_om_element_t *envelope_ele = NULL;
-
- else
- {
- envelope_impl->header = axis2_soap_header_create(env);
- envelope_ele = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(
- envelope_impl->om_ele_node, env);
- header_qn = axis2_qname_create(env, AXIS2_SOAP_HEADER_LOCAL_NAME, NULL, NULL);
- if(!header_qn)
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return NULL;
- }
- header_ele = AXIS2_OM_ELEMENT_GET_FIRST_CHILD_WITH_QNAME(envelope_ele,
- env, header_qn, envelope_impl->om_ele_node, &header_node);
-
- AXIS2_SOAP_HEADER_SET_BASE_NODE(envelope_impl->header, env, header_node);
- if(envelope_impl->soap_version == AXIS2_SOAP11)
- {
- AXIS2_SOAP_HEADER_SET_SOAP_VERSION(envelope_impl->header, env, AXIS2_SOAP11);
- }
- else if(envelope_impl->soap_version == AXIS2_SOAP12)
- {
- AXIS2_SOAP_HEADER_SET_SOAP_VERSION(envelope_impl->header, env, AXIS2_SOAP11);
- }
- if(envelope_impl->header)
- return envelope_impl->header;
- }
-
- if(!(envelope_impl->header))
- {
- envelope_impl->header = axis2_soap_header_create_with_parent(env, envelope);
- if(envelope_impl->soap_version == AXIS2_SOAP12)
- {
- AXIS2_SOAP_HEADER_SET_SOAP_VERSION(envelope_impl->header, env, AXIS2_SOAP12);
- }
- else if(envelope_impl->soap_version == AXIS2_SOAP11)
- {
- AXIS2_SOAP_HEADER_SET_SOAP_VERSION(envelope_impl->header, env, AXIS2_SOAP12);
- }
- }
- */
return envelope_impl->header;
}
-/**
- * Convenience method to add a SOAP header to this envelope
- *
- * @param namespaceURI
- * @param name
- */
axis2_soap_header_block_t* AXIS2_CALL
axis2_soap_envelope_add_header(axis2_soap_envelope_t *envelope,
axis2_env_t **env,
@@ -421,18 +363,6 @@
return axis2_soap_header_block_create_with_parent(env, name, ns, envelope_impl->header);
}
-/**
- * Returns the <CODE>SOAPBody</CODE> object associated with this
- * <CODE>SOAPEnvelope</CODE> object. <P> This SOAPBody will just be a
- * container for all the BodyElements in the <CODE>OMMessage</CODE> </P>
- *
- * @return the <CODE>SOAPBody</CODE> object for this <CODE>
- * SOAPEnvelope</CODE> object or <CODE>null</CODE> if there is none
- * @throws org.apache.axis2.om.OMException
- * if there is a problem obtaining
- * the <CODE>SOAPBody</CODE> object
- * @throws OMException
- */
axis2_soap_body_t* AXIS2_CALL
axis2_soap_envelope_get_body(axis2_soap_envelope_t *envelope,
axis2_env_t **env)
@@ -453,62 +383,10 @@
status = AXIS2_SOAP_BUILDER_NEXT(envelope_impl->soap_builder, env);
if(status == AXIS2_FAILURE)
{
- break;
+ return NULL;
}
}
- if(envelope_impl->body)
- return envelope_impl->body;
- }
-
- /*
-
- axis2_om_element_t *envelope_ele = NULL;
- axis2_om_node_t *first_node = NULL;
- axis2_om_element_t *first_ele = NULL;
- axis2_om_node_t *next_node = NULL;
- axis2_om_element_t *next_ele = NULL;
- envelope_ele = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(
- envelope_impl->om_ele_node, env);
-
-
- first_ele = AXIS2_OM_ELEMENT_GET_FIRST_ELEMENT(envelope_ele,
- env, envelope_impl->om_ele_node, &first_node);
- if(first_ele)
- {
- if(AXIS2_STRCMP(AXIS2_SOAP_BODY_LOCAL_NAME,
- AXIS2_OM_ELEMENT_GET_LOCALNAME(first_ele, env)) == 0)
- {
- envelope_impl->body = axis2_soap_body_create(env);
- AXIS2_SOAP_BODY_SET_BASE_NODE(envelope_impl->body, env, first_node);
- AXIS2_SOAP_BODY_SET_SOAP_VERSION(envelope_impl->body, env, envelope_impl->soap_version);
- return envelope_impl->body;
- }
- else
- {
- next_node = AXIS2_OM_NODE_GET_NEXT_SIBLING( first_node, env);
-
- while(next_node && AXIS2_OM_NODE_GET_NODE_TYPE(next_node , env) != AXIS2_OM_ELEMENT)
- {
- next_node = AXIS2_OM_NODE_GET_NEXT_SIBLING(next_node , env);
- }
- next_ele = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(next_node, env);
-
- if(next_ele && AXIS2_STRCMP(AXIS2_SOAP_BODY_LOCAL_NAME,
- AXIS2_OM_ELEMENT_GET_LOCALNAME(next_ele, env)) == 0)
- {
- envelope_impl->body = axis2_soap_body_create(env);
- AXIS2_SOAP_BODY_SET_BASE_NODE(envelope_impl->body, env, next_node);
- AXIS2_SOAP_BODY_SET_SOAP_VERSION(envelope_impl->body, env, envelope_impl->soap_version);
- return envelope_impl->body;
- }
- else
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SOAP_ENVELOPE_MUST_HAVE_BODY_ELEMENT, AXIS2_FAILURE);
- return NULL;
- }
- }
}
- */
return envelope_impl->body;
}
@@ -521,15 +399,12 @@
axis2_soap_envelope_impl_t *envelope_impl = NULL;
AXIS2_FUNC_PARAM_CHECK(envelope, env, AXIS2_FAILURE);
envelope_impl = AXIS2_INTF_TO_IMPL(envelope);
-
- /* TODO
- if (!omOutput.isIgnoreXMLDeclaration()) {
- ax is2_char_t *charSetEncoding = omOutput.getCharSetEncoding();
- axis2_char_t *xmlVersion = omOutput.getXmlVersion();
- omOutput.getXmlStreamWriter().writeStartDocument(charSetEncoding == null ?
- OMConstants.DEFAULT_CHAR_SET_ENCODING : charSetEncoding,
- xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION : xmlVersion);
- }*/
+/*
+ if soap version is soap11 we modify the soap fault part.
+ This is done because the builder construct a soap12 fault all
+ the time. So when serializing if the soap version is soap11
+ we should convert it back to soap11 fault
+*/
if(envelope_impl->soap_version == AXIS2_SOAP11)
{
axis2_soap_body_t *soap_body = NULL;
@@ -616,6 +491,10 @@
}
}
}
+ /* write the xml version and encoding
+ These should be set so om output before calling the serialize function
+ Otherwise default values will be written
+ */
AXIS2_OM_OUTPUT_WRITE_XML_VERSION_ENCODING(om_output, env);
return AXIS2_OM_NODE_SERIALIZE(envelope_impl->om_ele_node, env, om_output);
}
@@ -635,7 +514,8 @@
}
else
{
- /* TODO set an error here as there can be only one body */
+ AXIS2_LOG_WRITE((*env)->log, " trying to set a soap bedy to envelope when a soap body alrady exists ", AXIS2_LOG_DEBUG);
+ return AXIS2_FAILURE;
}
return AXIS2_SUCCESS;
}
@@ -653,7 +533,8 @@
}
else
{
- /* TODO set an error here as there can be only one header */
+ AXIS2_LOG_WRITE((*env)->log, " trying to set a soap header to envelope when a soap header alrady exists ", AXIS2_LOG_DEBUG);
+ return AXIS2_FAILURE;
}
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_fault_code.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_fault_code.c?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_fault_code.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_fault_code.c Sun Jan 29 19:19:06 2006
@@ -403,8 +403,6 @@
return AXIS2_FAILURE;
}
fault_code_impl->om_ele_node = node;
- fault_code_impl->om_ele = (axis2_om_element_t *)
- AXIS2_OM_NODE_GET_DATA_ELEMENT(node, env);
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_header.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_header.c?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_header.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_header.c Sun Jan 29 19:19:06 2006
@@ -95,12 +95,18 @@
axis2_status_t AXIS2_CALL
axis2_soap_header_set_header_block(axis2_soap_header_t *header,
axis2_env_t **env,
- struct axis2_soap_header_block *header_block);
+ axis2_soap_header_block_t *header_block);
axis2_status_t AXIS2_CALL
axis2_soap_header_set_builder(axis2_soap_header_t *header,
axis2_env_t **env,
- struct axis2_soap_builder *builder);
+ axis2_soap_builder_t *builder);
+
+axis2_array_list_t* AXIS2_CALL
+axis2_soap_header_get_header_block_with_namespace_uri
+ (axis2_soap_header_t* header,
+ axis2_env_t **env,
+ axis2_char_t *ns_uri);
/*************** function implementations *************************************/
@@ -155,8 +161,9 @@
header_impl->soap_header.ops->set_header_block =
axis2_soap_header_set_header_block;
header_impl->soap_header.ops->set_builder =
- axis2_soap_header_set_builder;
-
+ axis2_soap_header_set_builder;
+ header_impl->soap_header.ops->get_header_block_with_namespace_uri =
+ axis2_soap_header_get_header_block_with_namespace_uri;
return &(header_impl->soap_header);
}
@@ -453,4 +460,57 @@
header_impl = AXIS2_INTF_TO_IMPL(header);
header_impl->soap_builder = builder;
return AXIS2_SUCCESS;
+}
+
+axis2_array_list_t* AXIS2_CALL
+axis2_soap_header_get_header_block_with_namespace_uri
+ (axis2_soap_header_t* header,
+ axis2_env_t **env,
+ axis2_char_t *ns_uri)
+{
+ axis2_soap_header_impl_t *header_impl = NULL;
+ axis2_array_list_t *header_block_list = NULL;
+ axis2_hash_index_t *hash_index = NULL;
+ axis2_soap_header_block_t *header_block = NULL;
+ axis2_om_node_t *header_block_om_node = NULL;
+ axis2_om_element_t *header_block_om_ele = NULL;
+ axis2_om_namespace_t *ns = NULL;
+ axis2_char_t *hb_namespace_uri = NULL;
+ int found = 0;
+ void *hb = NULL;
+ AXIS2_PARAM_CHECK((*env)->error, ns_uri, AXIS2_FAILURE);
+ header_impl = AXIS2_INTF_TO_IMPL(header);
+ header_block_list = axis2_array_list_create(env, 10);
+ for(hash_index = axis2_hash_first(header_impl->header_blocks, env);
+ hash_index; hash_index = axis2_hash_next( env, hash_index))
+ {
+ axis2_hash_this(hash_index, NULL, NULL, &hb);
+ header_block = (axis2_soap_header_block_t*)hb;
+ header_block_om_node = AXIS2_SOAP_HEADER_BLOCK_GET_BASE_NODE(header_block, env);
+ header_block_om_ele = (axis2_om_element_t *)
+ AXIS2_OM_NODE_GET_DATA_ELEMENT(header_block_om_node, env);
+ ns = AXIS2_OM_ELEMENT_GET_NAMESPACE(header_block_om_ele, env);
+ hb_namespace_uri = AXIS2_OM_NAMESPACE_GET_URI(ns, env);
+ if(AXIS2_STRCMP(hb_namespace_uri, ns_uri) == 0)
+ {
+ AXIS2_ARRAY_LIST_ADD(header_block_list, env, header_block);
+ found++;
+ }
+
+ hb = NULL;
+ header_block = NULL;
+ header_block_om_ele = NULL;
+ header_block_om_node = NULL;
+ ns = NULL;
+ hb_namespace_uri = NULL;
+ }
+ if(found > 0)
+ {
+ return header_block_list;
+ }
+ else
+ {
+ AXIS2_ARRAY_LIST_FREE(header_block_list, env);
+ }
+ return NULL;
}
Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_header_block.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_header_block.c?rev=373421&r1=373420&r2=373421&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_header_block.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_header_block.c Sun Jan 29 19:19:06 2006
@@ -25,18 +25,13 @@
typedef struct axis2_soap_header_block_impl_t
{
axis2_soap_header_block_t header_block;
-
+ /** om_element node corresponding to this headerblock */
axis2_om_node_t *om_ele_node;
-
- axis2_om_element_t *om_ele;
-
+ /** soap version */
int soap_version;
- axis2_soap_header_t *parent;
-
axis2_bool_t processed;
-
}axis2_soap_header_block_impl_t;
/***************** Macro ******************************************************/
@@ -141,9 +136,7 @@
}
header_block_impl->header_block.ops = NULL;
- header_block_impl->om_ele = NULL;
header_block_impl->om_ele_node = NULL;
- header_block_impl->parent = NULL;
header_block_impl->soap_version = AXIS2_SOAP_VERSION_NOT_SET;
header_block_impl->header_block.ops = (axis2_soap_header_block_ops_t *)AXIS2_MALLOC(
@@ -179,7 +172,8 @@
header_block_impl->header_block.ops->set_base_node =
axis2_soap_header_block_set_base_node;
header_block_impl->header_block.ops->get_base_node =
- axis2_soap_header_block_get_base_node;
+ axis2_soap_header_block_get_base_node;
+
return &(header_block_impl->header_block);
}
@@ -195,7 +189,7 @@
axis2_soap_header_block_t *header_block = NULL;
axis2_om_node_t *this_node = NULL;
axis2_om_node_t *parent_node = NULL;
-
+ axis2_om_element_t *om_ele = NULL;
AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK((*env)->error, localname, NULL);
@@ -205,11 +199,10 @@
parent_node = AXIS2_SOAP_HEADER_GET_BASE_NODE(header, env);
header_block_impl = AXIS2_INTF_TO_IMPL(header_block);
- header_block_impl->om_ele = axis2_om_element_create( env,
- parent_node, localname, ns , &this_node);
-
+ om_ele = axis2_om_element_create( env, parent_node, localname,
+ ns , &this_node);
+
header_block_impl->om_ele_node = this_node;
- header_block_impl->parent = header;
return &(header_block_impl->header_block);
}
@@ -406,6 +399,7 @@
axis2_om_attribute_t* om_attr = NULL;
axis2_qname_t *qn = NULL;
axis2_om_namespace_t *om_ns = NULL;
+ axis2_om_element_t *om_ele = NULL;
AXIS2_FUNC_PARAM_CHECK(header_block, env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, attr_name, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, soap_envelope_namespace_uri, AXIS2_FAILURE);
@@ -415,7 +409,9 @@
qn = axis2_qname_create(env, attr_name, soap_envelope_namespace_uri, NULL);
if(!qn)
return AXIS2_FAILURE;
- om_attr = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(header_block_impl->om_ele, env, qn);
+ om_ele = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(
+ header_block_impl->om_ele_node, env);
+ om_attr = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(om_ele, env, qn);
if(om_attr)
{
AXIS2_OM_ATTRIBUTE_SET_VALUE(om_attr, env, attr_value);
@@ -427,8 +423,8 @@
AXIS2_SOAP_DEFAULT_NAMESPACE_PREFIX);
om_attr = axis2_om_attribute_create(env, attr_name, attr_value, om_ns);
- AXIS2_OM_ELEMENT_ADD_ATTRIBUTE(header_block_impl->om_ele,
- env, om_attr, header_block_impl->om_ele_node);
+ AXIS2_OM_ELEMENT_ADD_ATTRIBUTE(om_ele, env, om_attr,
+ header_block_impl->om_ele_node);
}
AXIS2_QNAME_FREE(qn, env);
return AXIS2_SUCCESS;
@@ -445,6 +441,7 @@
axis2_om_attribute_t* om_attr = NULL;
axis2_char_t *attr_value = NULL;
axis2_qname_t *qn = NULL;
+ axis2_om_element_t *om_ele = NULL;
AXIS2_FUNC_PARAM_CHECK(header_block, env, NULL);
AXIS2_PARAM_CHECK((*env)->error, attr_name, NULL);
AXIS2_PARAM_CHECK((*env)->error, soap_envelope_namespace_uri, NULL);
@@ -453,7 +450,9 @@
qn = axis2_qname_create(env, attr_name, soap_envelope_namespace_uri, NULL);
if(!qn)
return NULL;
- om_attr = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(header_block_impl->om_ele, env, qn);
+ om_ele = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(
+ header_block_impl->om_ele_node, env);
+ om_attr = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(om_ele, env, qn);
if(om_attr)
attr_value = AXIS2_OM_ATTRIBUTE_GET_VALUE(om_attr, env);
AXIS2_QNAME_FREE(qn, env);
@@ -495,8 +494,6 @@
return AXIS2_FAILURE;
}
header_block_impl->om_ele_node = node;
- header_block_impl->om_ele = (axis2_om_element_t *)
- AXIS2_OM_NODE_GET_DATA_ELEMENT(node, env);
return AXIS2_SUCCESS;
}
@@ -558,4 +555,4 @@
return NULL;
axis2_soap_header_block_set_soap_version(header_block, env, AXIS2_SOAP12);
return header_block;
-}
+}