/** * Checks whether given node is having same name and namespace as given * @param env Environment. Must not be null * @param node node to be checked for name and namespace * @param name local name to be checked against given node * @param ns namespace to be checked against given node. Can be null. If null, will be omitted * @return AXIS2_TRUE if given name/ns is same as in the node. AXIS2_FALSE otherwise. */ AXIS2_EXTERN axis2_bool_t AXIS2_CALL oxs_axiom_check_node_name( const axutil_env_t *env, axiom_node_t* node, axis2_char_t* name, axis2_char_t* ns) { axiom_element_t * ele = NULL; axis2_char_t* namestr = NULL; axis2_char_t* ns_str = NULL; axutil_qname_t* qname = NULL; ele = axiom_node_get_data_element(node, env); qname = axiom_element_get_qname(ele, env, node); namestr = axutil_qname_get_localpart(qname, env); if(axutil_strcmp(namestr, name)) { return AXIS2_FALSE; } if(ns) { ns_str = axutil_qname_get_uri(qname, env); if(axutil_strcmp(ns_str, ns)) { return AXIS2_FALSE; } } return AXIS2_TRUE; }
axis2_status_t AXIS2_CALL adb_TransportData_deserialize_obj( adb_TransportData_t* _TransportData, 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; void *element = NULL; 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, _TransportData, 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 TransportData : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building details 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, "details", "http://mgt.transport.carbon.wso2.org/xsd", NULL); if (adb_TransportDetails_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_TransportDetails"); status = adb_TransportDetails_deserialize((adb_TransportDetails_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element details"); } else { status = adb_TransportData_set_details(_TransportData, env, (adb_TransportDetails_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for details "); 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 summary 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, "summary", "http://mgt.transport.carbon.wso2.org/xsd", NULL); if (adb_TransportSummary_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_TransportSummary"); status = adb_TransportSummary_deserialize((adb_TransportSummary_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element summary"); } else { status = adb_TransportData_set_summary(_TransportData, env, (adb_TransportSummary_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for summary "); 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; }
axis2_status_t AXIS2_CALL adb_subscriberRequest_deserialize_obj( adb_subscriberRequest_t* _subscriberRequest, 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, _subscriberRequest, 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 subscriberRequest : " "NULL element 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, _subscriberRequest-> 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 subscriberRequest : " "Expected %s but returned %s", axutil_qname_to_string(_subscriberRequest-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building number 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, "number", NULL, NULL); if ( (current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("number", axiom_element_get_localname(current_element, env))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("number", axiom_element_get_localname(current_element, env)))) { is_early_node_valid = AXIS2_TRUE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = adb_subscriberRequest_set_number(_subscriberRequest, env, atoi(text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element number"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for number "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element number missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_getPermissionsResponse_deserialize_obj( adb_getPermissionsResponse_t* _getPermissionsResponse, 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; void *element = NULL; 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, _getPermissionsResponse, 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 getPermissionsResponse : " "NULL element 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, _getPermissionsResponse-> 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 getPermissionsResponse : " "Expected %s but returned %s", axutil_qname_to_string(_getPermissionsResponse-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building return 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, "return", "http://services.resource.ui.mgt.registry.carbon.wso2.org", NULL); if (adb_PermissionBean_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_PermissionBean"); status = adb_PermissionBean_deserialize((adb_PermissionBean_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element return"); } else { status = adb_getPermissionsResponse_set_return(_getPermissionsResponse, env, (adb_PermissionBean_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for return "); 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; }
axis2_status_t AXIS2_CALL adb_TransformTypeChoice_deserialize_obj( adb_TransformTypeChoice_t* _TransformTypeChoice, 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, _TransformTypeChoice, AXIS2_FAILURE); first_node = parent; /* * building extraElement element */ current_node = first_node; is_early_node_valid = AXIS2_FALSE; if ( (current_node )) { if( current_node ) { is_early_node_valid = AXIS2_TRUE; } text_value = NULL; /* just to avoid warning */ { 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 = adb_TransformTypeChoice_set_extraElement(_TransformTypeChoice, env, current_property_node); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for extraElement "); 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 XPath 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, "XPath", "http://www.w3.org/2000/09/xmldsig#", 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_TransformTypeChoice_set_XPath(_TransformTypeChoice, 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 XPath"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = adb_TransformTypeChoice_set_XPath(_TransformTypeChoice, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for XPath "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } *dp_parent = current_node; *dp_is_early_node_valid = is_early_node_valid; return status; }
axis2_status_t AXIS2_CALL adb_listExternalUsersResponse_deserialize_obj( adb_listExternalUsersResponse_t* _listExternalUsersResponse, 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; int i = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = 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, _listExternalUsersResponse, 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 listExternalUsersResponse : " "NULL element 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, _listExternalUsersResponse-> 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 listExternalUsersResponse : " "Expected %s but returned %s", axutil_qname_to_string(_listExternalUsersResponse-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building return array */ arr_list = axutil_array_list_create(env, 10); /* * building return element */ element_qname = axutil_qname_create(env, "return", "http://service.mgt.user.carbon.wso2.org", NULL); for (i = 0, sequence_broken = 0, current_node = first_node; !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); 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) { axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, text_value)); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for return "); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } i ++; current_node = axiom_node_get_next_sibling(current_node, env); } else { is_early_node_valid = AXIS2_FALSE; sequence_broken = 1; } } if (i < 0) { /* found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "return (@minOccurs = '0') only have %d elements", i); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } if(0 == axutil_array_list_size(arr_list,env)) { axutil_array_list_free(arr_list, env); } else { status = adb_listExternalUsersResponse_set_return(_listExternalUsersResponse, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_createReservationResponse_deserialize( adb_createReservationResponse_t* _createReservationResponse, 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; void *element = NULL; 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, _createReservationResponse, 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 createReservationResponse : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building ReservationStatus 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, "ReservationStatus", NULL, NULL); if (adb_ReservationStatus_is_particle() || (current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("ReservationStatus", axiom_element_get_localname(current_element, env))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("ReservationStatus", axiom_element_get_localname(current_element, env)))) { is_early_node_valid = AXIS2_TRUE; } element = (void*)adb_ReservationStatus_create(env); status = adb_ReservationStatus_deserialize((adb_ReservationStatus_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element ReservationStatus"); } else { status = adb_createReservationResponse_set_ReservationStatus(_createReservationResponse, env, (adb_ReservationStatus_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for ReservationStatus "); 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; }
axis2_status_t AXIS2_CALL adb_Exception_deserialize_obj( adb_Exception_t* _Exception, 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, _Exception, 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 Exception : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building Exception 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, "Exception", "http://services.resource.ui.mgt.registry.carbon.wso2.org", 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_Exception_set_Exception(_Exception, env, current_property_node); } else { status = adb_Exception_set_Exception(_Exception, env, NULL); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for Exception "); 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; }
axis2_status_t AXIS2_CALL adb_getReservationStatusesResponse_deserialize( adb_getReservationStatusesResponse_t* _getReservationStatusesResponse, 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; void *element = NULL; axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; int i = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = 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, _getReservationStatusesResponse, 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 getReservationStatusesResponse : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building reservationStatuses array */ arr_list = axutil_array_list_create(env, 10); /* * building reservationStatuses element */ element_qname = axutil_qname_create(env, "reservationStatuses", NULL, NULL); for (i = 0, sequence_broken = 0, current_node = first_node; !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); if (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("reservationStatuses", axiom_element_get_localname(current_element, env))) { is_early_node_valid = AXIS2_TRUE; element = (void*)adb_ReservationStatus_create(env); status = adb_ReservationStatus_deserialize((adb_ReservationStatus_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element reservationStatuses "); } else { axutil_array_list_add_at(arr_list, env, i, element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for reservationStatuses "); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } i ++; current_node = axiom_node_get_next_sibling(current_node, env); } else { is_early_node_valid = AXIS2_FALSE; sequence_broken = 1; } } if (i < 0) { /* found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "reservationStatuses (@minOccurs = '0') only have %d elements", i); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } if(0 == axutil_array_list_size(arr_list,env)) { axutil_array_list_free(arr_list, env); } else { status = adb_getReservationStatusesResponse_set_reservationStatuses(_getReservationStatusesResponse, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_KeyPairType_deserialize_obj( adb_KeyPairType_t* _KeyPairType, 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; void *element = NULL; 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, _KeyPairType, 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 KeyPairType : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building KeyInfo 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, "KeyInfo", "http://www.w3.org/2000/09/xmldsig#", NULL); if (adb_KeyInfoType_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_KeyInfoType"); status = adb_KeyInfoType_deserialize((adb_KeyInfoType_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element KeyInfo"); } else { status = adb_KeyPairType_set_KeyInfo(_KeyPairType, env, (adb_KeyInfoType_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for KeyInfo "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element KeyInfo missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } /* * building EncryptedKey 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, "EncryptedKey", "http://www.w3.org/2001/04/xmlenc#", NULL); if (adb_EncryptedKeyType_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_EncryptedKeyType"); status = adb_EncryptedKeyType_deserialize((adb_EncryptedKeyType_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element EncryptedKey"); } else { status = adb_KeyPairType_set_EncryptedKey(_KeyPairType, env, (adb_EncryptedKeyType_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for EncryptedKey "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element EncryptedKey missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_supportedContentFormats_type0_deserialize_obj( adb_supportedContentFormats_type0_t* _supportedContentFormats_type0, 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; int i = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = 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, _supportedContentFormats_type0, 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 supportedContentFormats_type0 : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building contentFormat array */ arr_list = axutil_array_list_create(env, 10); /* * building contentFormat element */ element_qname = axutil_qname_create(env, "contentFormat", "http://www.daisy.org/ns/daisy-online/", NULL); for (i = 0, sequence_broken = 0, current_node = first_node; !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); 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) { axutil_array_list_add_at(arr_list, env, i, axutil_strdup(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 contentFormat"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, "")); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for contentFormat "); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } i ++; current_node = axiom_node_get_next_sibling(current_node, env); } else { is_early_node_valid = AXIS2_FALSE; sequence_broken = 1; } } if (i < 0) { /* found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "contentFormat (@minOccurs = '0') only have %d elements", i); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } if(0 == axutil_array_list_size(arr_list,env)) { axutil_array_list_free(arr_list, env); } else { status = adb_supportedContentFormats_type0_set_contentFormat(_supportedContentFormats_type0, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_updateSystemLog_deserialize_obj( adb_updateSystemLog_t* _updateSystemLog, 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, _updateSystemLog, 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 updateSystemLog : " "NULL element 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, _updateSystemLog-> 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 updateSystemLog : " "Expected %s but returned %s", axutil_qname_to_string(_updateSystemLog-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building logLevel 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, "logLevel", "http://org.apache.axis2/xsd", 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_updateSystemLog_set_logLevel(_updateSystemLog, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for logLevel "); 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 logPattern 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, "logPattern", "http://org.apache.axis2/xsd", 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_updateSystemLog_set_logPattern(_updateSystemLog, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for logPattern "); 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 persist 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, "persist", "http://org.apache.axis2/xsd", 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) { if (!axutil_strcasecmp(text_value , "true")) { status = adb_updateSystemLog_set_persist(_updateSystemLog, env, AXIS2_TRUE); } else { status = adb_updateSystemLog_set_persist(_updateSystemLog, env, AXIS2_FALSE); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element persist"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for persist "); 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; }
axis2_status_t AXIS2_CALL adb_Metric_deserialize( adb_Metric_t* _Metric, 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, _Metric, 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 Metric : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building unit 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, "unit", "http://util.services.statistics.carbon.wso2.org/xsd", 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_Metric_set_unit(_Metric, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for unit "); 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 value 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, "value", "http://util.services.statistics.carbon.wso2.org/xsd", 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_Metric_set_value(_Metric, env, atof(text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element value"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for value "); 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; }
axis2_status_t AXIS2_CALL adb_DSAKeyValueTypeSequence_type1_deserialize_obj( adb_DSAKeyValueTypeSequence_type1_t* _DSAKeyValueTypeSequence_type1, 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; void *element = NULL; 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, _DSAKeyValueTypeSequence_type1, AXIS2_FAILURE); first_node = parent; /* * building Seed 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, "Seed", "http://www.w3.org/2000/09/xmldsig#", NULL); if (adb_CryptoBinary_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_CryptoBinary"); status = adb_CryptoBinary_deserialize((adb_CryptoBinary_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element Seed"); } else { status = adb_DSAKeyValueTypeSequence_type1_set_Seed(_DSAKeyValueTypeSequence_type1, env, (adb_CryptoBinary_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for Seed "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element Seed missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } /* * building PgenCounter 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, "PgenCounter", "http://www.w3.org/2000/09/xmldsig#", NULL); if (adb_CryptoBinary_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_CryptoBinary"); status = adb_CryptoBinary_deserialize((adb_CryptoBinary_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element PgenCounter"); } else { status = adb_DSAKeyValueTypeSequence_type1_set_PgenCounter(_DSAKeyValueTypeSequence_type1, env, (adb_CryptoBinary_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for PgenCounter "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element PgenCounter missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } *dp_parent = current_node; *dp_is_early_node_valid = is_early_node_valid; return status; }
axis2_status_t AXIS2_CALL adb_getMinServiceResponseTimeResponse_deserialize_obj( adb_getMinServiceResponseTimeResponse_t* _getMinServiceResponseTimeResponse, 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, _getMinServiceResponseTimeResponse, 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 getMinServiceResponseTimeResponse : " "NULL element 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, _getMinServiceResponseTimeResponse-> 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 getMinServiceResponseTimeResponse : " "Expected %s but returned %s", axutil_qname_to_string(_getMinServiceResponseTimeResponse-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building return 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, "return", "http://org.apache.axis2/xsd", 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_getMinServiceResponseTimeResponse_set_return(_getMinServiceResponseTimeResponse, env, axutil_strtol(text_value, (char**)NULL, 0)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element return"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for return "); 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; }
axis2_status_t AXIS2_CALL adb_ProductCompleteType_deserialize( adb_ProductCompleteType_t* _ProductCompleteType, 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; 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, _ProductCompleteType, 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 ProductCompleteType : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building productCategory 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, "productCategory", "http://server.ips.com", 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_ProductCompleteType_set_productCategory(_ProductCompleteType, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for productCategory "); 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 productName 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, "productName", "http://server.ips.com", 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_ProductCompleteType_set_productName(_ProductCompleteType, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for productName "); 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; }
axis2_status_t AXIS2_CALL adb_OperationMetaDataWrapper_deserialize_obj( adb_OperationMetaDataWrapper_t* _OperationMetaDataWrapper, 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; void *element = NULL; const axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; int i = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = 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, _OperationMetaDataWrapper, 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 OperationMetaDataWrapper : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building controlOperations array */ arr_list = axutil_array_list_create(env, 10); /* * building controlOperations element */ element_qname = axutil_qname_create(env, "controlOperations", "http://mgt.operation.carbon.wso2.org/xsd", NULL); for (i = 0, sequence_broken = 0, current_node = first_node; !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); if (adb_OperationMetaData_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_OperationMetaData"); status = adb_OperationMetaData_deserialize((adb_OperationMetaData_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element controlOperations "); } else { axutil_array_list_add_at(arr_list, env, i, element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for controlOperations "); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } i ++; current_node = axiom_node_get_next_sibling(current_node, env); } else { is_early_node_valid = AXIS2_FALSE; sequence_broken = 1; } } if (i < 0) { /* found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "controlOperations (@minOccurs = '0') only have %d elements", i); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } if(0 == axutil_array_list_size(arr_list,env)) { axutil_array_list_free(arr_list, env); } else { status = adb_OperationMetaDataWrapper_set_controlOperations(_OperationMetaDataWrapper, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } /* * building publishedOperations array */ arr_list = axutil_array_list_create(env, 10); /* * building publishedOperations element */ element_qname = axutil_qname_create(env, "publishedOperations", "http://mgt.operation.carbon.wso2.org/xsd", NULL); for (i = 0, sequence_broken = 0, current_node = (is_early_node_valid?axiom_node_get_next_sibling(current_node, env):current_node); !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); if (adb_OperationMetaData_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_OperationMetaData"); status = adb_OperationMetaData_deserialize((adb_OperationMetaData_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element publishedOperations "); } else { axutil_array_list_add_at(arr_list, env, i, element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for publishedOperations "); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } i ++; current_node = axiom_node_get_next_sibling(current_node, env); } else { is_early_node_valid = AXIS2_FALSE; sequence_broken = 1; } } if (i < 0) { /* found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "publishedOperations (@minOccurs = '0') only have %d elements", i); if(element_qname) { axutil_qname_free(element_qname, env); } if(arr_list) { axutil_array_list_free(arr_list, env); } return AXIS2_FAILURE; } if(0 == axutil_array_list_size(arr_list,env)) { axutil_array_list_free(arr_list, env); } else { status = adb_OperationMetaDataWrapper_set_publishedOperations(_OperationMetaDataWrapper, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL axis2_PortFolio_deserialize( axis2_PortFolio_t* PortFolio, const axutil_env_t *env, axiom_node_t* parent) { axis2_status_t status = AXIS2_SUCCESS; axiom_namespace_t *ns1 = NULL; int i = 0; int element_found = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = NULL; void *element = NULL; /*axis2_char_t* text_value = NULL;*/ axutil_qname_t *qname = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); ns1 = axiom_namespace_create (env, "http://www.wso2.org/types", "ns1"); if ( NULL == parent ) { /** This should be checked above */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL elemenet for PortFolio" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } first_node = parent; /** * building portFolioItem array */ arr_list = axutil_array_list_create( env, 10); /** * building portFolioItem element */ element_qname = axutil_qname_create( env, "portFolioItem", "",""); for ( i = 0, sequence_broken = 0, tmp_node = current_node = first_node; current_node != NULL; current_node = axiom_node_get_next_sibling( current_node, env)) { current_element = axiom_node_get_data_element( current_node, env); qname = axiom_element_get_qname( current_element, env, current_node); if ( axutil_qname_equals( element_qname, env, qname) ) { if( sequence_broken) { /** found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "elements found out of order for arrayportFolioItem missing" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } tmp_node = current_node; /** always update the current node */ element_found = 1; element = (void*)axis2_PortFolioItem_create( env); status = axis2_PortFolioItem_deserialize( ( axis2_PortFolioItem_t*)element, env, axiom_node_get_first_child(current_node, env)==NULL?current_node:axiom_node_get_first_child(current_node, env)); if( AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element portFolioItem " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } axutil_array_list_add_at( arr_list, env, i, element); if( AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for portFolioItem " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } i ++; } else { sequence_broken = 1; } } current_node = tmp_node; status = axis2_PortFolio_set_portFolioItem( PortFolio, env, arr_list); return status; }
axis2_status_t AXIS2_CALL axis2_sellRequest_ex_deserialize( axis2_sellRequest_ex_t* sellRequest_ex, const axutil_env_t *env, axiom_node_t* parent) { axis2_status_t status = AXIS2_SUCCESS; axiom_namespace_t *ns1 = NULL; axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; axiom_node_t *first_node = NULL; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); ns1 = axiom_namespace_create (env, "http://www.wso2.org/types", "ns1"); if ( NULL == parent ) { /** This should be checked above */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL elemenet for sellRequest_ex" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } current_element = axiom_node_get_data_element( parent, env); qname = axiom_element_get_qname( current_element, env, parent); if ( axutil_qname_equals( qname, env, sellRequest_ex-> qname ) ) { first_node = axiom_node_get_first_child( parent, env); } else { first_node = parent; } /** * building userid element */ current_node = first_node; if ( current_node != NULL) { current_element = axiom_node_get_data_element( current_node, env); text_value = axiom_element_get_text(current_element, env, current_node ); status = axis2_sellRequest_ex_set_userid( sellRequest_ex, env, text_value); if( AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for userid " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } } else { /** this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element userid missing" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } /** * building symbol element */ /** * because elements are ordered this works fine */ if( current_node != NULL) { current_node = axiom_node_get_next_sibling( current_node, env); } if ( current_node != NULL) { current_element = axiom_node_get_data_element( current_node, env); text_value = axiom_element_get_text(current_element, env, current_node ); status = axis2_sellRequest_ex_set_symbol( sellRequest_ex, env, text_value); if( AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for symbol " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } } else { /** this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element symbol missing" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } /** * building qty element */ /** * because elements are ordered this works fine */ if( current_node != NULL) { current_node = axiom_node_get_next_sibling( current_node, env); } if ( current_node != NULL) { current_element = axiom_node_get_data_element( current_node, env); text_value = axiom_element_get_text(current_element, env, current_node ); status = axis2_sellRequest_ex_set_qty( sellRequest_ex, env, atoi( text_value)); if( AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for qty " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } } else { /** this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element qty missing" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } return status; }
axis2_status_t AXIS2_CALL adb_SnakeException0_deserialize( adb_SnakeException0_t* _SnakeException0, 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; void *element = NULL; 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, _SnakeException0, 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 SnakeException : " "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, _SnakeException0-> qname)) { first_node = parent; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for SnakeException : " "Expected %s but returned %s", axutil_qname_to_string(_SnakeException0-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building SnakeException 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, "SnakeException", "http://esb.bod.services.hdviper.i2cat.net/", NULL); if (adb_SnakeException_is_particle() || (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; } element = (void*)adb_SnakeException_create(env); status = adb_SnakeException_deserialize((adb_SnakeException_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element SnakeException"); } else { status = adb_SnakeException0_set_SnakeException(_SnakeException0, env, (adb_SnakeException_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for SnakeException "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element SnakeException missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_source_deserialize_obj( adb_source_t* _source, 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, _source, 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 source : " "NULL element 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, _source-> qname)) { first_node = parent; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for source : " "Expected %s but returned %s", axutil_qname_to_string(_source-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building source element */ current_node = first_node; is_early_node_valid = AXIS2_FALSE; if ( (current_node )) { if( current_node ) { is_early_node_valid = AXIS2_TRUE; } text_value = NULL; /* just to avoid warning */ { 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 = adb_source_set_source(_source, env, current_property_node); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for source "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element source missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL axis2_buyResponse_deserialize( axis2_buyResponse_t* buyResponse, const axutil_env_t *env, axiom_node_t* parent) { axis2_status_t status = AXIS2_SUCCESS; axiom_namespace_t *ns1 = NULL; void *element = NULL; /*axis2_char_t* text_value = NULL;*/ axutil_qname_t *qname = NULL; axiom_node_t *first_node = NULL; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); ns1 = axiom_namespace_create (env, "http://www.wso2.org/types", "ns1"); if ( NULL == parent ) { /** This should be checked above */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL elemenet for buyResponse" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } current_element = axiom_node_get_data_element( parent, env); qname = axiom_element_get_qname( current_element, env, parent); if ( axutil_qname_equals( qname, env, buyResponse-> qname ) ) { first_node = axiom_node_get_first_child( parent, env); } else { first_node = parent; } /** * building trade_status element */ current_node = first_node; if ( current_node != NULL) { current_element = axiom_node_get_data_element( current_node, env); element = (void*)axis2_TradeStatus_create( env); status = axis2_TradeStatus_deserialize( ( axis2_TradeStatus_t*)element, env, axiom_node_get_first_child(current_node, env)==NULL?current_node:axiom_node_get_first_child(current_node, env)); if( AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element trade_status " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } status = axis2_buyResponse_set_trade_status( buyResponse, env, ( axis2_TradeStatus_t*)element); if( AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for trade_status " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } } else { /** this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element trade_status missing" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return AXIS2_FAILURE; } return status; }
axis2_status_t AXIS2_CALL adb_CipherReference_deserialize_obj( adb_CipherReference_t* _CipherReference, 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; void *element = NULL; 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, _CipherReference, 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 CipherReference : " "NULL element 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, _CipherReference-> qname)) { first_node = parent; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for CipherReference : " "Expected %s but returned %s", axutil_qname_to_string(_CipherReference-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building CipherReference 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, "CipherReference", "http://www.w3.org/2001/04/xmlenc#", NULL); if (adb_CipherReferenceType_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_CipherReferenceType"); status = adb_CipherReferenceType_deserialize((adb_CipherReferenceType_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element CipherReference"); } else { status = adb_CipherReference_set_CipherReference(_CipherReference, env, (adb_CipherReferenceType_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for CipherReference "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element CipherReference missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_service_type0_deserialize_obj( adb_service_type0_t* _service_type0, 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; axiom_attribute_t *parent_attri = NULL; axiom_element_t *parent_element = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; void *element = NULL; 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, _service_type0, 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 service_type0 : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env); attribute_hash = axiom_element_get_all_attributes(parent_element, env); /* * building label 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, "label", "http://www.daisy.org/ns/daisy-online/", NULL); if (adb_label_type0_is_particle() || (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; } element = (void*)axis2_extension_mapper_create_from_node(env, ¤t_node, "adb_label_type0"); status = adb_label_type0_deserialize((adb_label_type0_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element label"); } else { status = adb_service_type0_set_label(_service_type0, env, (adb_label_type0_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for label "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } parent_attri = NULL; 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(!strcmp((axis2_char_t*)key, "id")) { parent_attri = (axiom_attribute_t*)val; AXIS2_FREE(env->allocator, hi); break; } } } if(parent_attri) { attrib_text = axiom_attribute_get_value(parent_attri, env); } else { /* this is hoping that attribute is stored in "id", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "id"); } if(attrib_text != NULL) { adb_service_type0_set_id(_service_type0, env, attrib_text); } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "required attribute id missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
static axis2_status_t AXIS2_CALL rp_signed_encrypted_parts_builder_set_properties( axiom_node_t *node, axiom_element_t *element, axis2_char_t *local_name, rp_signed_encrypted_parts_t * signed_encrypted_parts, const axutil_env_t *env) { axis2_char_t *ns = NULL; axutil_qname_t *node_qname = NULL; node_qname = axiom_element_get_qname(element, env, node); if(!node_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get qname from element %s.", local_name); return AXIS2_FAILURE; } ns = axutil_qname_get_uri(node_qname, env); if(!ns) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get namespace from element %s.", local_name); return AXIS2_FAILURE; } /* process assertions common for WS-SecPolicy 1.1 and 1.2 */ if(!(axutil_strcmp(ns, RP_SP_NS_11) && axutil_strcmp(ns, RP_SP_NS_12))) { /* this assertion is in WS-SecurityPolicy namespace */ if(!strcmp(local_name, RP_BODY)) { rp_signed_encrypted_parts_set_body(signed_encrypted_parts, env, AXIS2_TRUE); return AXIS2_SUCCESS; } else if(!strcmp(local_name, RP_HEADER)) { rp_header_t *header = NULL; header = rp_signed_encrypted_parts_builder_build_header(element, env); if(!header) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Failed to process Header Assertion."); return AXIS2_FAILURE; } return rp_signed_encrypted_parts_add_header(signed_encrypted_parts, env, header); } } /* process assertions specific to WS-SecPolicy 1.2 */ if(!axutil_strcmp(ns, RP_SP_NS_12)) { if(!strcmp(local_name, RP_ATTACHMENTS)) { rp_signed_encrypted_parts_set_attachments(signed_encrypted_parts, env, AXIS2_TRUE); return AXIS2_SUCCESS; } } /* either namespace or assertion is not understood */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Unknown Assertion %s with namespace %s", local_name, ns); return AXIS2_FAILURE; }
axis2_status_t axis2_addr_in_extract_epr_information( const axutil_env_t * env, axiom_soap_header_block_t * soap_header_block, axis2_endpoint_ref_t * endpoint_ref, const axis2_char_t * addr_ns_str) { axutil_qname_t *epr_addr_qn = NULL; axutil_qname_t *epr_ref_qn = NULL; axutil_qname_t *wsa_meta_qn = NULL; axiom_node_t *header_block_node = NULL; axiom_element_t *header_block_ele = NULL; axiom_child_element_iterator_t *child_ele_iter = NULL; AXIS2_PARAM_CHECK(env->error, soap_header_block, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, endpoint_ref, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, addr_ns_str, AXIS2_FAILURE); header_block_node = axiom_soap_header_block_get_base_node(soap_header_block, env); header_block_ele = (axiom_element_t *) axiom_node_get_data_element(header_block_node, env); child_ele_iter = axiom_element_get_child_elements(header_block_ele, env, header_block_node); if (!child_ele_iter) { return AXIS2_FAILURE; } epr_addr_qn = axutil_qname_create(env, EPR_ADDRESS, addr_ns_str, NULL); epr_ref_qn = axutil_qname_create(env, EPR_REFERENCE_PARAMETERS, addr_ns_str, NULL); wsa_meta_qn = axutil_qname_create(env, AXIS2_WSA_METADATA, addr_ns_str, NULL); while (AXIOM_CHILD_ELEMENT_ITERATOR_HAS_NEXT(child_ele_iter, env)) { axiom_node_t *child_node = NULL; axiom_element_t *child_ele = NULL; axutil_qname_t *child_qn = NULL; child_node = AXIOM_CHILD_ELEMENT_ITERATOR_NEXT(child_ele_iter, env); child_ele = (axiom_element_t *) axiom_node_get_data_element(child_node, env); child_qn = axiom_element_get_qname(child_ele, env, child_node); if (axis2_addr_in_check_element(env, epr_addr_qn, child_qn)) { axis2_endpoint_ref_set_address(endpoint_ref, env, axiom_element_get_text(child_ele, env, child_node)); } else if (axis2_addr_in_check_element(env, epr_ref_qn, child_qn)) { axiom_child_element_iterator_t *ref_param_iter = NULL; ref_param_iter = axiom_element_get_child_elements(child_ele, env, child_node); if (ref_param_iter) { while (AXIOM_CHILD_ELEMENT_ITERATOR_HAS_NEXT (ref_param_iter, env)) { axiom_node_t *om_node = NULL; axiom_element_t *om_ele = NULL; om_node = AXIOM_CHILD_ELEMENT_ITERATOR_NEXT(ref_param_iter, env); om_ele = (axiom_element_t *) axiom_node_get_data_element(om_node, env); axis2_endpoint_ref_add_ref_param(endpoint_ref, env, om_node); } } } else if (axis2_addr_in_check_element(env, wsa_meta_qn, child_qn)) { /* FIXME : Can we remove this?*/ } } axutil_qname_free(epr_addr_qn, env); axutil_qname_free(epr_ref_qn, env); axutil_qname_free(wsa_meta_qn, env); return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL prf_logOnResponseType_deserialize_obj( prf_logOnResponseType_t* _logOnResponseType, 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, _logOnResponseType, 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 logOnResponseType : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building logOnResult 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, "logOnResult", "http://www.pratsam.org/ns/profile/", 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) { if (!axutil_strcasecmp(text_value , "true")) { status = prf_logOnResponseType_set_logOnResult(_logOnResponseType, env, AXIS2_TRUE); } else { status = prf_logOnResponseType_set_logOnResult(_logOnResponseType, env, AXIS2_FALSE); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element logOnResult"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for logOnResult "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element logOnResult missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_SnakeException_deserialize( adb_SnakeException_t* _SnakeException, 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; 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, _SnakeException, 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 SnakeException : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building message 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, "message", NULL, NULL); if ( (current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("message", axiom_element_get_localname(current_element, env))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("message", axiom_element_get_localname(current_element, env)))) { is_early_node_valid = AXIS2_TRUE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = adb_SnakeException_set_message(_SnakeException, 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 message"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = adb_SnakeException_set_message(_SnakeException, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for message "); 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; }
axis2_status_t AXIS2_CALL adb_getOperationRequestCount_deserialize_obj( adb_getOperationRequestCount_t* _getOperationRequestCount, 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, _getOperationRequestCount, 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 getOperationRequestCount : " "NULL element 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, _getOperationRequestCount-> 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 getOperationRequestCount : " "Expected %s but returned %s", axutil_qname_to_string(_getOperationRequestCount-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building serviceName 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, "serviceName", "http://org.apache.axis2/xsd", 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_getOperationRequestCount_set_serviceName(_getOperationRequestCount, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for serviceName "); 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 operationName 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, "operationName", "http://org.apache.axis2/xsd", 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_getOperationRequestCount_set_operationName(_getOperationRequestCount, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for operationName "); 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; }
axis2_status_t AXIS2_CALL adb_ProductComplete_deserialize( adb_ProductComplete_t* _ProductComplete, 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; void *element = NULL; 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, _ProductComplete, 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 ProductComplete : " "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, _ProductComplete-> 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 ProductComplete : " "Expected %s but returned %s", axutil_qname_to_string(_ProductComplete-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building productInfo 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, "productInfo", "http://webser.com", NULL); if (adb_ProductCompleteType_is_particle() || (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; } element = (void*)adb_ProductCompleteType_create(env); status = adb_ProductCompleteType_deserialize((adb_ProductCompleteType_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_FALSE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element productInfo"); } else { status = adb_ProductComplete_set_productInfo(_ProductComplete, env, (adb_ProductCompleteType_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for productInfo "); 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; }