You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Samisa Abeysinghe <sa...@gmail.com> on 2006/03/23 17:04:35 UTC
Re:[Axis2] Patch - fix for axis2_soap_envelope_create_default_soap_fault_envelope
fn
There is a typo in this patch.
In the hader file in line
+ axis2_char_t *code_value, axis2_char_t *reason_text, int soap_version)
';' is missing.
Fixed it.
Also, the patch broke the soap test compilation. Fixed that as well.
Thanks for the patch anyway as it helped solve the problems.
Samisa...
Nabeel wrote:
> Attached a patch to fix a bug in the above mentioned function.
> Pls reveiw and apply.
>
> Note that the funciton signature changed from
>
>> axis2_soap_envelope_t *
>> axis2_soap_envelope_create_default_soap_fault_envelope(axis2_env_t **env,
>> int soap_version)
>
> to
>
>> axis2_soap_envelope_t *
>> axis2_soap_envelope_create_default_soap_fault_envelope(axis2_env_t **env,
>> axis2_char_t *code_value, axis2_char_t *reason_text, int
>> soap_version)
>
> to create the default fault node inside the body.
>
> -Nabeel
>
>------------------------------------------------------------------------
>
>Index: soap_envelope.c
>===================================================================
>--- soap_envelope.c (revision 387727)
>+++ soap_envelope.c (working copy)
>@@ -726,46 +726,56 @@
>
> AXIS2_DECLARE(axis2_soap_envelope_t *)
> axis2_soap_envelope_create_default_soap_fault_envelope(axis2_env_t **env,
>- int soap_version)
>+ axis2_char_t *code_value, axis2_char_t *reason_text, int soap_version)
> {
> axis2_soap_envelope_t *soap_env = NULL;
> axis2_soap_body_t *soap_body = NULL;
> axis2_om_namespace_t *om_ns = NULL;
> axis2_soap_envelope_impl_t *env_impl = NULL;
>+ axis2_soap_fault_t *fault = NULL;
>+ axis2_char_t *env_ns_uri = NULL;
> AXIS2_ENV_CHECK(env, NULL);
>- if(soap_version == AXIS2_SOAP11)
>- {
>- om_ns = axis2_om_namespace_create(env,
>- AXIS2_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI,
>- AXIS2_SOAP_DEFAULT_NAMESPACE_PREFIX);
>- if(!om_ns)
>- return NULL;
>- soap_env = axis2_soap_envelope_create(env, om_ns);
>- env_impl = AXIS2_INTF_TO_IMPL(soap_env);
>-
>- AXIS2_SOAP_ENVELOPE_SET_SOAP_VERSION(soap_env, env, AXIS2_SOAP11);
>- soap_body = axis2_soap_body_create_with_parent(env, soap_env);
>- env_impl->body = soap_body;
>- return soap_env;
>- }
>- else if(soap_version == AXIS2_SOAP12)
>- {
>- om_ns = axis2_om_namespace_create(env,
>- AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI,
>- AXIS2_SOAP_DEFAULT_NAMESPACE_PREFIX);
>- if(!om_ns)
>- return NULL;
>- soap_env = axis2_soap_envelope_create(env, om_ns);
>- env_impl = AXIS2_INTF_TO_IMPL(soap_env);
>-
>- AXIS2_SOAP_ENVELOPE_SET_SOAP_VERSION(soap_env, env, AXIS2_SOAP12);
>- soap_body = axis2_soap_body_create_with_parent(env, soap_env);
>- env_impl->body = soap_body;
>- return soap_env;
>- }
>- AXIS2_ERROR_SET((*env)->error,
>- AXIS2_ERROR_INVALID_SOAP_VERSION, AXIS2_FAILURE);
>- return NULL;
>+
>+ if (AXIS2_SOAP11 == soap_version)
>+ env_ns_uri = AXIS2_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI;
>+ else if (AXIS2_SOAP12 == soap_version)
>+ env_ns_uri = AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
>+ else
>+ {
>+ AXIS2_ERROR_SET((*env)->error,
>+ AXIS2_ERROR_INVALID_SOAP_VERSION, AXIS2_FAILURE);
>+ return NULL;
>+ }
>+ om_ns = axis2_om_namespace_create(env,
>+ AXIS2_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI,
>+ AXIS2_SOAP_DEFAULT_NAMESPACE_PREFIX);
>+ if(!om_ns)
>+ return NULL;
>+ soap_env = axis2_soap_envelope_create(env, om_ns);
>+ if (!soap_env)
>+ {
>+ AXIS2_OM_NAMESPACE_FREE(om_ns, env);
>+ return NULL;
>+ }
>+ env_impl = AXIS2_INTF_TO_IMPL(soap_env);
>+
>+ AXIS2_SOAP_ENVELOPE_SET_SOAP_VERSION(soap_env, env, soap_version);
>+ soap_body = axis2_soap_body_create_with_parent(env, soap_env);
>+ env_impl->body = soap_body;
>+ if (!soap_body)
>+ {
>+ AXIS2_SOAP_ENVELOPE_FREE(soap_env, env);
>+ return NULL;
>+ }
>+ fault = axis2_soap_fault_create_default_fault(env, soap_body,
>+ code_value, reason_text, soap_version);
>+ if (!fault)
>+ {
>+ AXIS2_SOAP_ENVELOPE_FREE(soap_env, env);
>+ return NULL;
>+ }
>+ return soap_env;
>+
> }
>
> static axis2_status_t
>Index: soap_header.c
>===================================================================
>--- soap_header.c (revision 387727)
>+++ soap_header.c (working copy)
>@@ -289,6 +289,8 @@
> axis2_soap_header_impl_t *header_impl = NULL;
> axis2_soap_header_block_t *header_block = NULL;
>
>+ axis2_om_namespace_t *cloned_ns = NULL;
>+
> axis2_om_node_t* header_block_node = NULL;
>
> AXIS2_ENV_CHECK(env, NULL);
>@@ -297,7 +299,11 @@
>
> header_impl = AXIS2_INTF_TO_IMPL(header);
>
>- header_block = axis2_soap_header_block_create_with_parent(env, localname, ns, header);
>+ cloned_ns = AXIS2_OM_NAMESPACE_CLONE(ns, env);
>+ if(!cloned_ns)
>+ return NULL;
>+
>+ header_block = axis2_soap_header_block_create_with_parent(env, localname,cloned_ns, header);
>
> if(!header_block)
> return NULL;
>@@ -307,7 +313,29 @@
>
> if(header_block_node)
> {
>+ axis2_om_element_t *hb_ele = NULL;
>+ axis2_char_t *uri = NULL;
>+ axis2_char_t *prefix = NULL;
>+
> axis2_om_node_set_build_status(header_block_node, env, AXIS2_TRUE);
>+
>+ hb_ele = (axis2_om_element_t *)
>+ AXIS2_OM_NODE_GET_DATA_ELEMENT(header_block_node, env);
>+ if(hb_ele)
>+ {
>+ axis2_om_namespace_t *dec_ns = NULL;
>+ uri = AXIS2_OM_NAMESPACE_GET_URI(cloned_ns, env);
>+ prefix = AXIS2_OM_NAMESPACE_GET_PREFIX(cloned_ns, env);
>+
>+ dec_ns = AXIS2_OM_ELEMENT_FIND_DECLARED_NAMESPACE(hb_ele, env, uri, prefix);
>+ if(!dec_ns)
>+ {
>+ /** this namespace it not in hb_ele list so free it */
>+ AXIS2_OM_NAMESPACE_FREE(cloned_ns, env);
>+ cloned_ns = NULL;
>+ }
>+
>+ }
> return header_block;
> }
> else
>
>Index: axis2_soap_envelope.h
>===================================================================
>--- axis2_soap_envelope.h (revision 388149)
>+++ axis2_soap_envelope.h (working copy)
>@@ -161,10 +161,11 @@
> AXIS2_DECLARE(axis2_soap_envelope_t *)
> axis2_soap_envelope_create_default_soap_envelope(axis2_env_t **env,
> int soap_version);
>-
>+
> AXIS2_DECLARE(axis2_soap_envelope_t *)
> axis2_soap_envelope_create_default_soap_fault_envelope(axis2_env_t **env,
>- int soap_version);
>+ axis2_char_t *code_value, axis2_char_t *reason_text, int soap_version)
>+
> /******************** Macros **************************************************/
>
> #define AXIS2_SOAP_ENVELOPE_GET_HEADER(envelope, env) \
>
>
>