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 adb_getMinOperationResponseTimeResponse_deserialize( adb_getMinOperationResponseTimeResponse_t* _getMinOperationResponseTimeResponse, 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, _getMinOperationResponseTimeResponse, 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 getMinOperationResponseTimeResponse : " "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, _getMinOperationResponseTimeResponse-> 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 getMinOperationResponseTimeResponse : " "Expected %s but returned %s", axutil_qname_to_string(_getMinOperationResponseTimeResponse-> 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_getMinOperationResponseTimeResponse_set_return(_getMinOperationResponseTimeResponse, 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_addr_in_extract_addr_params( const axutil_env_t * env, axiom_soap_header_t * soap_header, axis2_msg_info_headers_t ** msg_info_headers_p, axutil_array_list_t * addr_headers, const axis2_char_t * addr_ns_str, axis2_msg_ctx_t * msg_ctx) { axutil_hash_t *header_block_ht = NULL; axutil_hash_index_t *hash_index = NULL; axis2_msg_info_headers_t *msg_info_headers = *(msg_info_headers_p); axis2_status_t status = AXIS2_SUCCESS; axis2_bool_t to_found = AXIS2_FALSE; axis2_bool_t reply_to_found = AXIS2_FALSE; axis2_bool_t fault_to_found = AXIS2_FALSE; axis2_bool_t action_found = AXIS2_FALSE; axis2_bool_t msg_id_found = AXIS2_FALSE; AXIS2_PARAM_CHECK(env->error, soap_header, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, msg_info_headers_p, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, addr_headers, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, addr_ns_str, AXIS2_FAILURE); if(!msg_info_headers) { AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No messgae info header. Creating new"); msg_info_headers = axis2_msg_info_headers_create(env, NULL, NULL); if(!msg_info_headers) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MSG_INFO_HEADERS, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No message information headers available"); return AXIS2_FAILURE; } } header_block_ht = axiom_soap_header_get_all_header_blocks(soap_header, env); if(!header_block_ht) { return AXIS2_FAILURE; } /* Iterate thru header blocks */ for(hash_index = axutil_hash_first(header_block_ht, env); hash_index; hash_index = axutil_hash_next(env, hash_index)) { void *hb = NULL; axiom_soap_header_block_t *header_block = NULL; axiom_node_t *header_block_node = NULL; axiom_element_t *header_block_ele = NULL; axis2_char_t *ele_localname = NULL; axis2_endpoint_ref_t *epr = NULL; axis2_char_t *role = NULL; axutil_hash_this(hash_index, NULL, NULL, &hb); header_block = (axiom_soap_header_block_t *)hb; header_block_node = axiom_soap_header_block_get_base_node(header_block, env); header_block_ele = (axiom_element_t *)axiom_node_get_data_element(header_block_node, env); ele_localname = axiom_element_get_localname(header_block_ele, env); role = axiom_soap_header_block_get_role(header_block, env); if(role && !axutil_strcmp(role, AXIOM_SOAP12_SOAP_ROLE_NONE)) { /* Role is none, no need of processing */ continue; } if(!axutil_strcmp(ele_localname, AXIS2_WSA_TO)) { /* Here the addressing epr overidde what ever already there in the message context */ epr = axis2_endpoint_ref_create(env, axiom_element_get_text(header_block_ele, env, header_block_node)); if(AXIS2_TRUE == to_found) { /* Duplicate To */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_TO, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; continue; } axis2_msg_info_headers_set_to(msg_info_headers, env, epr); axis2_addr_in_extract_to_epr_ref_params(env, epr, soap_header, addr_ns_str); axiom_soap_header_block_set_processed(header_block, env); to_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_FROM)) { epr = axis2_msg_info_headers_get_from(msg_info_headers, env); if(!epr) { /* The address is not known now. Pass the empty string and fill this once the element under this is processed. */ epr = axis2_endpoint_ref_create(env, ""); axis2_msg_info_headers_set_from(msg_info_headers, env, epr); } axis2_addr_in_extract_epr_information(env, header_block, epr, addr_ns_str); axiom_soap_header_block_set_processed(header_block, env); } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_REPLY_TO)) { epr = axis2_msg_info_headers_get_reply_to(msg_info_headers, env); if(reply_to_found == AXIS2_TRUE) { /* Duplicate Reply To */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_REPLY_TO, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; continue; } if(!epr) { epr = axis2_endpoint_ref_create(env, ""); axis2_msg_info_headers_set_reply_to(msg_info_headers, env, epr); } axis2_addr_in_extract_epr_information(env, header_block, epr, addr_ns_str); axiom_soap_header_block_set_processed(header_block, env); reply_to_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_FAULT_TO)) { epr = axis2_msg_info_headers_get_fault_to(msg_info_headers, env); if(fault_to_found == AXIS2_TRUE) { /* Duplicate Fault To */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_FAULT_TO, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; axis2_msg_info_headers_set_fault_to(msg_info_headers, env, NULL); continue; } if(!epr) { epr = axis2_endpoint_ref_create(env, ""); axis2_msg_info_headers_set_fault_to(msg_info_headers, env, epr); } axis2_addr_in_extract_epr_information(env, header_block, epr, addr_ns_str); axiom_soap_header_block_set_processed(header_block, env); fault_to_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_MESSAGE_ID)) { axis2_char_t *text = NULL; if(msg_id_found == AXIS2_TRUE) { /* Duplicate Message ID */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_MESSAGE_ID, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; continue; } text = axiom_element_get_text(header_block_ele, env, header_block_node); axis2_msg_info_headers_set_in_message_id(msg_info_headers, env, text); axiom_soap_header_block_set_processed(header_block, env); msg_id_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_ACTION)) { axis2_char_t *text = NULL; if(action_found == AXIS2_TRUE) { /* Duplicate Action */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_ACTION, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; continue; } text = axiom_element_get_text(header_block_ele, env, header_block_node); axis2_msg_info_headers_set_action(msg_info_headers, env, text); axiom_soap_header_block_set_processed(header_block, env); action_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_RELATES_TO)) { axis2_char_t *address = NULL; axutil_qname_t *rqn = NULL; axiom_attribute_t *relationship_type = NULL; const axis2_char_t *relationship_type_value = NULL; axis2_relates_to_t *relates_to = NULL; rqn = axutil_qname_create(env, AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE, NULL, NULL); relationship_type = axiom_element_get_attribute(header_block_ele, env, rqn); if(!relationship_type) { if(!axutil_strcmp(AXIS2_WSA_NAMESPACE_SUBMISSION, addr_ns_str)) { relationship_type_value = AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE_SUBMISSION; } else { relationship_type_value = AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE; } } else { relationship_type_value = axiom_attribute_get_value(relationship_type, env); } address = axiom_element_get_text(header_block_ele, env, header_block_node); relates_to = axis2_relates_to_create(env, address, relationship_type_value); axis2_msg_info_headers_set_relates_to(msg_info_headers, env, relates_to); axiom_soap_header_block_set_processed(header_block, env); axutil_qname_free(rqn, env); } } /* If an action is not found, it's a false*/ if(action_found == AXIS2_FALSE) { axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_ACTION, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; } return status; }
axis2_status_t AXIS2_CALL adb_getModuleParametersResponse_deserialize_obj( adb_getModuleParametersResponse_t* _getModuleParametersResponse, 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, _getModuleParametersResponse, 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 getModuleParametersResponse : " "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, _getModuleParametersResponse-> 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 getModuleParametersResponse : " "Expected %s but returned %s", axutil_qname_to_string(_getModuleParametersResponse-> 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.module.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_getModuleParametersResponse_set_return(_getModuleParametersResponse, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL axis2_getQuoteRequest_deserialize( axis2_getQuoteRequest_t* getQuoteRequest, 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 getQuoteRequest" " %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, getQuoteRequest-> qname ) ) { first_node = axiom_node_get_first_child( parent, env); } else { first_node = parent; } /** * building symbol 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_getQuoteRequest_set_symbol( getQuoteRequest, 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; } return status; }
axis2_status_t AXIS2_CALL adb_getOperationStatistics_deserialize_obj( adb_getOperationStatistics_t* _getOperationStatistics, 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, _getOperationStatistics, 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 getOperationStatistics : " "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, _getOperationStatistics-> 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 getOperationStatistics : " "Expected %s but returned %s", axutil_qname_to_string(_getOperationStatistics-> 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_getOperationStatistics_set_serviceName(_getOperationStatistics, 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_getOperationStatistics_set_operationName(_getOperationStatistics, 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_X509IssuerSerialType_deserialize_obj( adb_X509IssuerSerialType_t* _X509IssuerSerialType, 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, _X509IssuerSerialType, 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 X509IssuerSerialType : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building X509IssuerName 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, "X509IssuerName", "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_X509IssuerSerialType_set_X509IssuerName(_X509IssuerSerialType, 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 X509IssuerName"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = adb_X509IssuerSerialType_set_X509IssuerName(_X509IssuerSerialType, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for X509IssuerName "); 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 X509IssuerName missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } /* * building X509SerialNumber 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, "X509SerialNumber", "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_X509IssuerSerialType_set_X509SerialNumber(_X509IssuerSerialType, env, atoi(text_value)); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element X509SerialNumber"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for X509SerialNumber "); 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 X509SerialNumber missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }