Hi Dimuthu,
Dimuthu Gamage schrieb:
> Can you check the deserialization code for the pData in adb_SetSymbol?
> It should be
> {
> axiom_node_t
> *current_property_node = current_node;
> current_node =
> axiom_node_get_next_sibling(current_node, env);
>
> axiom_node_detach(current_property_node, env);
> status = <xsl:value-of
> select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
> select="$name"/>, env,
>
> current_property_node);
> }
No, it is not. It already shows the code you posted below.
> If it is the following one, you should be trying without the the anyType.
>
>
> if(axiom_node_get_first_child(current_node, env))
> {
> axiom_node_t
> *current_property_node = axiom_node_get_first_child(current_node, env);
>
> axiom_node_detach(current_property_node, env);
> status = <xsl:value-of
> select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
> select="$name"/>, env,
>
> current_property_node);
> }
> else
> {
> status = <xsl:value-of
> select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
> select="$name"/>, env,
>
> NULL);
The full deserialize code is shown below. BTW., I am using WSDL2C from
axis2c 1.6.0
axis2_status_t AXIS2_CALL
adb_SetSymbol_deserialize(
adb_SetSymbol_t* _SetSymbol,
const axutil_env_t *env,
axiom_node_t **dp_parent,
axis2_bool_t *dp_is_early_node_valid,
axis2_bool_t dont_care_minoccurs)
{
axiom_node_t *parent = *dp_parent;
axis2_status_t status = AXIS2_SUCCESS;
const axis2_char_t* text_value = NULL;
axutil_qname_t *qname = NULL;
axutil_qname_t *element_qname = NULL;
axiom_node_t *first_node = NULL;
axis2_bool_t is_early_node_valid = AXIS2_TRUE;
axiom_node_t *current_node = NULL;
axiom_element_t *current_element = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, _SetSymbol, AXIS2_FAILURE);
while(parent && axiom_node_get_node_type(parent, env) !=
AXIOM_ELEMENT)
{
parent = axiom_node_get_next_sibling(parent, env);
}
if (NULL == parent)
{
/* This should be checked before everything */
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"Failed in building adb object for SetSymbol : "
"NULL elemenet can not be passed to
deserialize");
return AXIS2_FAILURE;
}
current_element = (axiom_element_t
*)axiom_node_get_data_element(parent, env);
qname = axiom_element_get_qname(current_element,
env, parent);
if (axutil_qname_equals(qname, env, _SetSymbol-> qname))
{
first_node =
axiom_node_get_first_child(parent, env);
}
else
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"Failed in building adb object for
SetSymbol : "
"Expected %s but returned %s",
axutil_qname_to_string(_SetSymbol-> qname,
env),
axutil_qname_to_string(qname, env));
return AXIS2_FAILURE;
}
/*
* building pName element
*/
current_node = first_node;
is_early_node_valid = AXIS2_FALSE;
while(current_node &&
axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
{
current_node =
axiom_node_get_next_sibling(current_node, env);
}
if(current_node != NULL)
{
current_element =
(axiom_element_t *)axiom_node_get_data_element(current_node, env);
qname =
axiom_element_get_qname(current_element, env, current_node);
}
element_qname =
axutil_qname_create(env, "pName",
"http://www.statconn.com/StatConnector", NULL);
if (
(current_node && current_element &&
(axutil_qname_equals(element_qname, env, qname))))
{
if( current_node && current_element &&
(axutil_qname_equals(element_qname, env, qname)))
{
is_early_node_valid = AXIS2_TRUE;
}
text_value =
axiom_element_get_text(current_element, env, current_node);
if(text_value != NULL)
{
status =
adb_SetSymbol_set_pName(_SetSymbol, env,
text_value);
}
else
{
/*
* axis2_qname_t *qname = NULL;
* axiom_attribute_t
*the_attri = NULL;
*
* qname =
axutil_qname_create(env, "nil",
"http://www.w3.org/2001/XMLSchema-instance", "xsi");
* the_attri =
axiom_element_get_attribute(current_element, env, qname);
*/
/* currently thereis a bug
in the axiom_element_get_attribute, so we have to go to this bad method */
axiom_attribute_t *the_attri
= NULL;
axis2_char_t *attrib_text =
NULL;
axutil_hash_t
*attribute_hash = NULL;
attribute_hash =
axiom_element_get_all_attributes(current_element, env);
attrib_text = NULL;
if(attribute_hash)
{
axutil_hash_index_t *hi;
void *val;
const void *key;
for (hi =
axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi))
{
axutil_hash_this(hi, &key, NULL, &val);
if(strstr((axis2_char_t*)key,
"nil|http://www.w3.org/2001/XMLSchema-instance"))
{
the_attri =
(axiom_attribute_t*)val;
break;
}
}
}
if(the_attri)
{
attrib_text =
axiom_attribute_get_value(the_attri, env);
}
else
{
/* this is hoping that
attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this
happnes when name is in default namespace */
attrib_text =
axiom_element_get_attribute_value_by_name(current_element, env, "nil");
}
if(attrib_text && 0 ==
axutil_strcmp(attrib_text, "1"))
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non
nillable element pName");
status = AXIS2_FAILURE;
}
else
{
/* after all, we found
this is a empty string */
status =
adb_SetSymbol_set_pName(_SetSymbol, env,
"");
}
}
if(AXIS2_FAILURE == status)
{
AXIS2_LOG_ERROR(env->log,
AXIS2_LOG_SI, "failed in setting the value for pName ");
if(element_qname)
{
axutil_qname_free(element_qname, env);
}
return AXIS2_FAILURE;
}
}
if(element_qname)
{
axutil_qname_free(element_qname, env);
element_qname = NULL;
}
/*
* building pData element
*/
/*
* because elements are ordered this
works fine
*/
if(current_node != NULL &&
is_early_node_valid)
{
current_node =
axiom_node_get_next_sibling(current_node, env);
while(current_node &&
axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
{
current_node =
axiom_node_get_next_sibling(current_node, env);
}
if(current_node != NULL)
{
current_element =
(axiom_element_t *)axiom_node_get_data_element(current_node, env);
qname =
axiom_element_get_qname(current_element, env, current_node);
}
}
is_early_node_valid = AXIS2_FALSE;
element_qname =
axutil_qname_create(env, "pData",
"http://www.statconn.com/StatConnector", NULL);
if (
(current_node && current_element &&
(axutil_qname_equals(element_qname, env, qname))))
{
if( current_node && current_element &&
(axutil_qname_equals(element_qname, env, qname)))
{
is_early_node_valid = AXIS2_TRUE;
}
text_value = NULL; /* just to
avoid warning */
if(axiom_node_get_first_child(current_node, env))
{
axiom_node_t
*current_property_node = axiom_node_get_first_child(current_node, env);
axiom_node_detach(current_property_node, env);
status =
adb_SetSymbol_set_pData(_SetSymbol, env,
current_property_node);
}
else
{
status =
adb_SetSymbol_set_pData(_SetSymbol, env,
NULL);
}
if(AXIS2_FAILURE == status)
{
AXIS2_LOG_ERROR(env->log,
AXIS2_LOG_SI, "failed in setting the value for pData ");
if(element_qname)
{
axutil_qname_free(element_qname, env);
}
return AXIS2_FAILURE;
}
}
if(element_qname)
{
axutil_qname_free(element_qname, env);
element_qname = NULL;
}
return status;
}
Best,
Thomas
