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_setServicePolicy_deserialize_obj( adb_setServicePolicy_t* _setServicePolicy, 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, _setServicePolicy, 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 setServicePolicy : " "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, _setServicePolicy-> 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 setServicePolicy : " "Expected %s but returned %s", axutil_qname_to_string(_setServicePolicy-> 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_setServicePolicy_set_serviceName(_setServicePolicy, 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 policyString 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, "policyString", "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_setServicePolicy_set_policyString(_setServicePolicy, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for policyString "); 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_EXTERN axis2_char_t * AXIS2_CALL savan_client_get_status( savan_client_t *client, const axutil_env_t *env, axis2_svc_client_t *svc_client) { axis2_options_t *wsa_options = NULL; const axis2_char_t *old_action = NULL; axutil_qname_t *qname = NULL; axiom_namespace_t *ns = NULL; axiom_node_t *reply = NULL; axiom_node_t *status_node = NULL; axiom_node_t *expires_node = NULL; axiom_element_t *status_elem = NULL; axiom_element_t *expires_elem = NULL; axis2_char_t *expires = NULL; axis2_char_t *status_elem_localname = NULL; AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_client_get_status"); /* Set wsa action as GetStatus. remember the old action */ wsa_options = (axis2_options_t*)axis2_svc_client_get_options(svc_client, env); old_action = axis2_options_get_action(wsa_options, env); axis2_options_set_action(wsa_options, env, SAVAN_ACTIONS_GET_STATUS); /* Create the body of the GetStatus request */ ns = axiom_namespace_create (env, EVENTING_NAMESPACE, EVENTING_NS_PREFIX); status_elem = axiom_element_create(env, NULL, ELEM_NAME_GETSTATUS, ns, &status_node); savan_client_add_sub_id_to_soap_header(client, env, svc_client); /* Send the GetStatus request and wait for the response */ reply = axis2_svc_client_send_receive(svc_client, env, status_node); /* Reset the old action */ axis2_options_set_action(wsa_options, env, old_action); if (!reply) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to send get status " "request. Error: %d Reason: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return NULL; } status_elem = (axiom_element_t*)axiom_node_get_data_element(reply, env); /* Check whether we have received a GetStatusResponse */ status_elem_localname = axiom_element_get_localname(status_elem, env); if (axutil_strcmp(ELEM_NAME_GETSTATUS_RESPONSE, status_elem_localname)) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to retrieve GetStatusResponse"\ "element. Error: %d Reason: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return NULL; } /* Now read Expires sub element */ qname = axutil_qname_create(env, ELEM_NAME_EXPIRES, EVENTING_NAMESPACE, NULL); expires_elem = axiom_element_get_first_child_with_qname(status_elem, env, qname, reply, &expires_node); axutil_qname_free(qname, env); if(!expires_node) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to retrieve Expires"\ "element. Error: %d Reason: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return NULL; } expires_elem = (axiom_element_t *) axiom_node_get_data_element(expires_node, env); expires = axiom_element_get_text(expires_elem, env, expires_node); AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_client_get_status"); return expires; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_svc_grp_builder_populate_svc_grp( axis2_svc_grp_builder_t * svc_grp_builder, const axutil_env_t * env, axis2_svc_grp_t * svc_grp) { axiom_children_qname_iterator_t *itr = NULL; axiom_children_qname_iterator_t *module_ref_itr = NULL; axiom_children_qname_iterator_t *svc_itr = NULL; axutil_qname_t *qparamst = NULL; axutil_qname_t *qmodulest = NULL; axutil_qname_t *qsvc_element = NULL; axiom_element_t *svc_grp_element = NULL; axis2_status_t status = AXIS2_FAILURE; axis2_conf_t *parent = NULL; /* Processing service level paramters */ svc_grp_element = axiom_node_get_data_element(svc_grp_builder->svc_grp, env); qparamst = axutil_qname_create(env, AXIS2_PARAMETERST, NULL, NULL); itr = axiom_element_get_children_with_qname(svc_grp_element, env, qparamst, svc_grp_builder->svc_grp); if(qparamst) { axutil_qname_free(qparamst, env); qparamst = NULL; } parent = axis2_svc_grp_get_parent(svc_grp, env); status = axis2_desc_builder_process_params(svc_grp_builder->desc_builder, env, itr, axis2_svc_grp_get_param_container(svc_grp, env), axis2_conf_get_param_container(parent, env)); /* Processing service modules required to be engaged globally */ qmodulest = axutil_qname_create(env, AXIS2_MODULEST, NULL, NULL); module_ref_itr = axiom_element_get_children_with_qname(svc_grp_element, env, qmodulest, svc_grp_builder-> svc_grp); if(qmodulest) { axutil_qname_free(qmodulest, env); qmodulest = NULL; } axis2_svc_grp_builder_process_module_refs(svc_grp_builder, env, module_ref_itr, svc_grp); qsvc_element = axutil_qname_create(env, AXIS2_SVC_ELEMENT, NULL, NULL); svc_itr = axiom_element_get_children_with_qname(svc_grp_element, env, qsvc_element, svc_grp_builder->svc_grp); if(qsvc_element) { axutil_qname_free(qsvc_element, env); qsvc_element = NULL; } while(axiom_children_qname_iterator_has_next(svc_itr, env)) { axiom_node_t *svc_node = NULL; axiom_element_t *svc_element = NULL; axiom_attribute_t *svc_name_att = NULL; axis2_char_t *svc_name = NULL; axutil_qname_t *qattname = NULL; svc_node = (axiom_node_t *)axiom_children_qname_iterator_next(svc_itr, env); svc_element = axiom_node_get_data_element(svc_node, env); qattname = axutil_qname_create(env, AXIS2_ATTNAME, NULL, NULL); svc_name_att = axiom_element_get_attribute(svc_element, env, qattname); if(qattname) { axutil_qname_free(qattname, env); qattname = NULL; } svc_name = axiom_attribute_get_value(svc_name_att, env); if(!svc_name) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_NAME_ERROR, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service name attribute has no value"); return AXIS2_FAILURE; } else { axis2_svc_t *axis_svc = NULL; axis2_arch_file_data_t *file_data = NULL; axutil_array_list_t *deployable_svcs = NULL; axis2_svc_builder_t *svc_builder = NULL; file_data = axis2_dep_engine_get_current_file_item(axis2_desc_builder_get_dep_engine( svc_grp_builder->desc_builder, env), env); axis_svc = axis2_arch_file_data_get_svc(file_data, env, svc_name); if(!axis_svc) { axutil_qname_t *qsvc_name = NULL; qsvc_name = axutil_qname_create(env, svc_name, NULL, NULL); axis_svc = axis2_svc_create_with_qname(env, qsvc_name); axutil_qname_free(qsvc_name, env); axis2_arch_file_data_add_svc(file_data, env, axis_svc); } /* Adding service to the deployable services list */ deployable_svcs = axis2_arch_file_data_get_deployable_svcs(file_data, env); axutil_array_list_add(deployable_svcs, env, axis_svc); axis2_svc_set_parent(axis_svc, env, svc_grp); svc_builder = axis2_svc_builder_create_with_dep_engine_and_svc(env, axis2_desc_builder_get_dep_engine(svc_grp_builder-> desc_builder, env), axis_svc); status = axis2_svc_builder_populate_svc(svc_builder, env, svc_node); axis2_svc_builder_free(svc_builder, env); } } return status; }
/** * This function is invoked in RM 1.1 where client explicitly send the * terminate sequence message */ static axis2_status_t AXIS2_CALL sandesha2_terminate_seq_msg_processor_process_out_msg( sandesha2_msg_processor_t *msg_processor, const axutil_env_t *env, sandesha2_msg_ctx_t *rm_msg_ctx) { axis2_msg_ctx_t *msg_ctx = NULL; axis2_conf_ctx_t *conf_ctx = NULL; sandesha2_storage_mgr_t *storage_mgr = NULL; sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL; sandesha2_create_seq_mgr_t *create_seq_mgr = NULL; sandesha2_sender_mgr_t *sender_mgr = NULL; axis2_char_t *to_address = NULL; axis2_char_t *seq_key = NULL; axis2_char_t *int_seq_id = NULL; axis2_char_t *out_seq_id = NULL; axutil_property_t *property = NULL; axis2_char_t *terminated = NULL; axis2_op_t *old_op = NULL; axis2_op_t *out_in_op = NULL; axutil_qname_t *qname = NULL; sandesha2_terminate_seq_t *term_seq_part = NULL; axis2_char_t *rm_version = NULL; axis2_char_t *transport_to = NULL; sandesha2_seq_property_bean_t *term_added = NULL; axis2_char_t *temp_action = NULL; axutil_string_t *soap_action = NULL; axis2_char_t *dbname = NULL; AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE); AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Entry:sandesha2_terminate_seq_msg_processor_process_out_msg."); msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env); conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env); dbname = sandesha2_util_get_dbname(env, conf_ctx); storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname); if(!storage_mgr) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Could not create storage manager."); AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_COULD_NOT_CREATE_STORAGE_MANAGER, AXIS2_FAILURE); return AXIS2_FAILURE; } seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname); create_seq_mgr = sandesha2_permanent_create_seq_mgr_create(env, dbname); sender_mgr = sandesha2_permanent_sender_mgr_create(env, dbname); to_address = (axis2_char_t*)axis2_endpoint_ref_get_address(axis2_msg_ctx_get_to(msg_ctx, env), env); property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY); if(property) { seq_key = axutil_property_get_value(property, env); } int_seq_id = sandesha2_utils_get_client_internal_sequence_id(env, to_address, seq_key); out_seq_id = sandesha2_utils_get_seq_property(env, int_seq_id, SANDESHA2_SEQUENCE_PROPERTY_OUTGOING_SEQUENCE_ID, seq_prop_mgr); if(!out_seq_id) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]seq_id was not found. Cannot send the terminate message"); AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID, AXIS2_FAILURE); if(seq_prop_mgr) { sandesha2_seq_property_mgr_free(seq_prop_mgr, env); } if(create_seq_mgr) { sandesha2_create_seq_mgr_free(create_seq_mgr, env); } if(sender_mgr) { sandesha2_sender_mgr_free(sender_mgr, env); } if(storage_mgr) { sandesha2_storage_mgr_free(storage_mgr, env); } return AXIS2_FAILURE; } terminated = sandesha2_utils_get_seq_property(env, int_seq_id, SANDESHA2_SEQ_PROP_TERMINATE_ADDED, seq_prop_mgr); old_op = axis2_msg_ctx_get_op(msg_ctx, env); qname = axutil_qname_create(env, "temp", NULL, NULL); out_in_op = axis2_op_create_with_qname(env, qname); if(qname) { axutil_qname_free(qname, env); } axis2_op_set_msg_exchange_pattern(out_in_op, env, AXIS2_MEP_URI_OUT_IN); axis2_op_set_in_flow(out_in_op, env, axis2_op_get_in_flow(old_op, env)); if(terminated && !axutil_strcmp(terminated, AXIS2_VALUE_TRUE)) { AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Terminate was added previously"); if(terminated) { AXIS2_FREE(env->allocator, terminated); } if(out_seq_id) { AXIS2_FREE(env->allocator, out_seq_id); } if(seq_prop_mgr) { sandesha2_seq_property_mgr_free(seq_prop_mgr, env); } if(create_seq_mgr) { sandesha2_create_seq_mgr_free(create_seq_mgr, env); } if(sender_mgr) { sandesha2_sender_mgr_free(sender_mgr, env); } if(storage_mgr) { sandesha2_storage_mgr_free(storage_mgr, env); } return AXIS2_SUCCESS; } if(terminated) { AXIS2_FREE(env->allocator, terminated); } term_seq_part = sandesha2_msg_ctx_get_terminate_seq(rm_msg_ctx, env); sandesha2_identifier_set_identifier(sandesha2_terminate_seq_get_identifier(term_seq_part, env), env, out_seq_id); sandesha2_msg_ctx_set_flow(rm_msg_ctx, env, AXIS2_OUT_FLOW); property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE); axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE, property); axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env, to_address)); rm_version = sandesha2_utils_get_rm_version(env, msg_ctx); if(!rm_version) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cant find the rm_version of the given message"); if(out_seq_id) { AXIS2_FREE(env->allocator, out_seq_id); } if(seq_prop_mgr) { sandesha2_seq_property_mgr_free(seq_prop_mgr, env); } if(create_seq_mgr) { sandesha2_create_seq_mgr_free(create_seq_mgr, env); } if(sender_mgr) { sandesha2_sender_mgr_free(sender_mgr, env); } if(storage_mgr) { sandesha2_storage_mgr_free(storage_mgr, env); } return AXIS2_FAILURE; } axis2_msg_ctx_set_wsa_action(msg_ctx, env, sandesha2_spec_specific_consts_get_terminate_seq_action(env, rm_version)); temp_action = sandesha2_spec_specific_consts_get_terminate_seq_soap_action(env, rm_version); soap_action = axutil_string_create(env, temp_action); axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action); transport_to = sandesha2_utils_get_seq_property(env, int_seq_id, SANDESHA2_SEQ_PROP_TRANSPORT_TO, seq_prop_mgr); if(transport_to) { axis2_msg_ctx_set_transport_url(msg_ctx, env, transport_to); AXIS2_FREE(env->allocator, transport_to); } if(!sandesha2_util_is_ack_already_piggybacked(env, rm_msg_ctx)) { sandesha2_ack_mgr_piggyback_acks_if_present(env, out_seq_id, rm_msg_ctx, storage_mgr, seq_prop_mgr, sender_mgr); } term_added = sandesha2_seq_property_bean_create(env); sandesha2_seq_property_bean_set_name(term_added, env, SANDESHA2_SEQ_PROP_TERMINATE_ADDED); sandesha2_seq_property_bean_set_seq_id(term_added, env, int_seq_id); if(out_seq_id) { AXIS2_FREE(env->allocator, out_seq_id); } sandesha2_seq_property_bean_set_value(term_added, env, AXIS2_VALUE_TRUE); sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, term_added); if(seq_prop_mgr) { sandesha2_seq_property_mgr_free(seq_prop_mgr, env); } if(create_seq_mgr) { sandesha2_create_seq_mgr_free(create_seq_mgr, env); } if(sender_mgr) { sandesha2_sender_mgr_free(sender_mgr, env); } if(storage_mgr) { sandesha2_storage_mgr_free(storage_mgr, env); } AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Exit:sandesha2_terminate_seq_msg_processor_process_out_msg"); return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL adb_TagCount_deserialize_obj( adb_TagCount_t* _TagCount, 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, _TagCount, 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 TagCount : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building key 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, "key", "http://common.registry.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_TagCount_set_key(_TagCount, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for key "); 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://common.registry.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_TagCount_set_value(_TagCount, env, axutil_strtol(text_value, (char**)NULL, 0)); } 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_Signature_deserialize_obj( adb_Signature_t* _Signature, 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, _Signature, 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 Signature : " "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, _Signature-> qname)) { first_node = parent; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for Signature : " "Expected %s but returned %s", axutil_qname_to_string(_Signature-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building Signature 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, "Signature", "http://www.w3.org/2000/09/xmldsig#", NULL); if (adb_SignatureType_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_SignatureType"); status = adb_SignatureType_deserialize((adb_SignatureType_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 Signature"); } else { status = adb_Signature_set_Signature(_Signature, env, (adb_SignatureType_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for Signature "); 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 Signature missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
static axis2_status_t AXIS2_CALL axis2_rm_assertion_builder_populate_for_10( const axutil_env_t *env, axis2_rm_assertion_t *rm_assertion, axiom_node_t *rm_assertion_node, axiom_element_t *rm_assertion_element) { axiom_children_iterator_t *children_iter = NULL; axis2_status_t status = AXIS2_FAILURE; /* In rm 1.0 it is just child elements which inside * rm_assertion contains all the properties. */ status = axis2_rm_assertion_set_spec_version(rm_assertion, env, RM_SPEC_VERSION_1_0); children_iter = axiom_element_get_children(rm_assertion_element, env, rm_assertion_node); if(children_iter) { while(axiom_children_iterator_has_next(children_iter, env)) { axiom_node_t *node = NULL; axiom_element_t *ele = NULL; axis2_char_t *local_name = NULL; node = axiom_children_iterator_next(children_iter, env); if(node) { if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT) { ele = (axiom_element_t *)axiom_node_get_data_element(node, env); if(ele) { axutil_qname_t *node_qname = NULL; axis2_char_t *ns = NULL; node_qname = axiom_element_get_qname(ele, env, node); if(!node) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get qname from element"); 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."); return AXIS2_FAILURE; } if(axutil_strcmp(ns, AXIS2_RM_POLICY_10_NS)) { continue; } local_name = axiom_element_get_localname(ele, env); if(local_name) { if(!axutil_strcmp(local_name, AXIS2_RM_INACTIVITY_TIMEOUT)) { axis2_char_t *inactivity_timeout = NULL; axutil_qname_t *qname = NULL; qname = axutil_qname_create(env, "Milliseconds", NULL, NULL); inactivity_timeout = axiom_element_get_attribute_value(ele, env, qname); if(qname) { axutil_qname_free(qname, env); qname = NULL; } status = axis2_rm_assertion_set_inactivity_timeout(rm_assertion, env, inactivity_timeout); } else if(!axutil_strcmp(local_name, AXIS2_RM_BASE_RETRANSMISSION_INTERVAL)) { axis2_char_t *rti = NULL; axutil_qname_t *qname = NULL; qname = axutil_qname_create(env, "Milliseconds", NULL, NULL); rti = axiom_element_get_attribute_value(ele, env, qname); if(qname) { axutil_qname_free(qname, env); qname = NULL; } status = axis2_rm_assertion_set_retrans_interval(rm_assertion, env, rti); } else if(!axutil_strcmp(local_name, AXIS2_RM_EXPONENTIAL_BACK_OFF)) { status = axis2_rm_assertion_set_is_exp_backoff(rm_assertion, env, AXIS2_TRUE); } else if(!axutil_strcmp(local_name, AXIS2_RM_ACKNOWLEDGEMENT_INTERVAL)) { axis2_char_t *ack_interval = NULL; axutil_qname_t *qname = NULL; qname = axutil_qname_create(env, "Milliseconds", NULL, NULL); ack_interval = axiom_element_get_attribute_value(ele, env, qname); if(qname) { axutil_qname_free(qname, env); qname = NULL; } status = axis2_rm_assertion_set_ack_interval(rm_assertion, env, ack_interval); } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Unknown Assertion %s ", local_name); return AXIS2_FAILURE; } } } } } } } return status; }
axis2_status_t AXIS2_CALL adb_listGloballyEngagedModulesResponse_deserialize_obj( adb_listGloballyEngagedModulesResponse_t* _listGloballyEngagedModulesResponse, 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, _listGloballyEngagedModulesResponse, 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 listGloballyEngagedModulesResponse : " "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, _listGloballyEngagedModulesResponse-> 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 listGloballyEngagedModulesResponse : " "Expected %s but returned %s", axutil_qname_to_string(_listGloballyEngagedModulesResponse-> 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 (adb_ModuleMetaData_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_ModuleMetaData"); status = adb_ModuleMetaData_deserialize((adb_ModuleMetaData_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 return "); } 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 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_listGloballyEngagedModulesResponse_set_return(_listGloballyEngagedModulesResponse, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_supportedContentProtectionFormats_type0_deserialize_obj( adb_supportedContentProtectionFormats_type0_t* _supportedContentProtectionFormats_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; 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, _supportedContentProtectionFormats_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 supportedContentProtectionFormats_type0 : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building protectionFormat array */ arr_list = axutil_array_list_create(env, 10); /* * building protectionFormat element */ element_qname = axutil_qname_create(env, "protectionFormat", "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 (adb_protectionFormat_type1_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_protectionFormat_type1"); status = adb_protectionFormat_type1_deserialize((adb_protectionFormat_type1_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 protectionFormat "); } 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 protectionFormat "); 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, "protectionFormat (@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_supportedContentProtectionFormats_type0_set_protectionFormat(_supportedContentProtectionFormats_type0, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_createReservation_deserialize( adb_createReservation_t* _createReservation, 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, _createReservation, 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 createReservation : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building sessionId 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, "sessionId", NULL, NULL); if ( (current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("sessionId", axiom_element_get_localname(current_element, env))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("sessionId", 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_createReservation_set_sessionId(_createReservation, 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 sessionId"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = adb_createReservation_set_sessionId(_createReservation, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for sessionId "); 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 bandwidthRequest 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, "bandwidthRequest", NULL, NULL); if (adb_bandwidthRequest_is_particle() || (current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("bandwidthRequest", axiom_element_get_localname(current_element, env))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("bandwidthRequest", axiom_element_get_localname(current_element, env)))) { is_early_node_valid = AXIS2_TRUE; } element = (void*)adb_bandwidthRequest_create(env); status = adb_bandwidthRequest_deserialize((adb_bandwidthRequest_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 bandwidthRequest"); } else { status = adb_createReservation_set_bandwidthRequest(_createReservation, env, (adb_bandwidthRequest_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for bandwidthRequest "); 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 bidirectional 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, "bidirectional", NULL, NULL); if ( (current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("bidirectional", axiom_element_get_localname(current_element, env))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname) || !axutil_strcmp("bidirectional", 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) { if (!axutil_strcasecmp(text_value , "true")) { status = adb_createReservation_set_bidirectional(_createReservation, env, AXIS2_TRUE); } else { status = adb_createReservation_set_bidirectional(_createReservation, env, AXIS2_FALSE); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element bidirectional"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for bidirectional "); 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 bidirectional missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
AXIS2_EXTERN axutil_qname_t *AXIS2_CALL axutil_qname_create( const axutil_env_t *env, const axis2_char_t *localpart, const axis2_char_t *namespace_uri, const axis2_char_t *prefix) { axutil_qname_t *qname = NULL; AXIS2_ENV_CHECK(env, NULL); /* localpart can't be null */ if(!localpart) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL parameter was passed when a non NULL parameter was expected"); return NULL; } qname = (axutil_qname_t *)AXIS2_MALLOC(env->allocator, sizeof(axutil_qname_t)); if(!qname) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); return NULL; } /* set properties */ qname->localpart = NULL; qname->qname_string = NULL; qname->prefix = NULL; qname->namespace_uri = NULL; qname->ref = 1; qname->localpart = (axis2_char_t *)axutil_strdup(env, localpart); if(!(qname->localpart)) { AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_NO_MEMORY); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_FAILURE); axutil_qname_free(qname, env); return NULL; } if(prefix) { qname->prefix = (axis2_char_t *)axutil_strdup(env, prefix); } if(prefix && !(qname->prefix)) { AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_NO_MEMORY); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_FAILURE); axutil_qname_free(qname, env); return NULL; } if(namespace_uri) { qname->namespace_uri = (axis2_char_t *)axutil_strdup(env, namespace_uri); } if(namespace_uri && !(qname->namespace_uri)) { AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_NO_MEMORY); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory"); AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_FAILURE); axutil_qname_free(qname, env); return NULL; } return qname; }
axis2_status_t AXIS2_CALL adb_configureServiceGroupMTOMResponse_deserialize_obj( adb_configureServiceGroupMTOMResponse_t* _configureServiceGroupMTOMResponse, 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, _configureServiceGroupMTOMResponse, 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 configureServiceGroupMTOMResponse : " "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, _configureServiceGroupMTOMResponse-> 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 configureServiceGroupMTOMResponse : " "Expected %s but returned %s", axutil_qname_to_string(_configureServiceGroupMTOMResponse-> 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 (adb_ServiceGroupMetaData_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_ServiceGroupMetaData"); status = adb_ServiceGroupMetaData_deserialize((adb_ServiceGroupMetaData_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_configureServiceGroupMTOMResponse_set_return(_configureServiceGroupMTOMResponse, env, (adb_ServiceGroupMetaData_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_addr_in_extract_to_epr_ref_params( const axutil_env_t * env, axis2_endpoint_ref_t * to_epr, axiom_soap_header_t * soap_header, const axis2_char_t * addr_ns_str) { axutil_hash_t *header_blocks_ht = NULL; axutil_hash_index_t *hash_index = NULL; axutil_qname_t *is_ref_qn = NULL; AXIS2_PARAM_CHECK(env->error, to_epr, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, soap_header, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, addr_ns_str, AXIS2_FAILURE); header_blocks_ht = axiom_soap_header_get_all_header_blocks(soap_header, env); if(!header_blocks_ht) { return AXIS2_FAILURE; } is_ref_qn = axutil_qname_create(env, "IsReferenceParameter", addr_ns_str, NULL); if(!is_ref_qn) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create qname for %s", addr_ns_str); return AXIS2_FAILURE; } for(hash_index = axutil_hash_first(header_blocks_ht, env); hash_index; hash_index = axutil_hash_next(env, hash_index)) { axiom_element_t *header_block_ele = NULL; axiom_node_t *header_block_node = NULL; axiom_soap_header_block_t *header_block = NULL; void *hb = NULL; axiom_attribute_t *is_ref_param_attr = NULL; axis2_char_t *attr_value = NULL; axutil_hash_this(hash_index, NULL, NULL, &hb); if(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); is_ref_param_attr = axiom_element_get_attribute(header_block_ele, env, is_ref_qn); if(is_ref_param_attr) { attr_value = axiom_attribute_get_localname(is_ref_param_attr, env); if(!axutil_strcmp("true", attr_value)) { axis2_endpoint_ref_add_ref_param(to_epr, env, header_block_node); } } } } axutil_qname_free(is_ref_qn, env); return AXIS2_SUCCESS; }
AXIS2_EXTERN void AXIS2_CALL axis2_svc_free( axis2_svc_t * svc, const axutil_env_t * env) { if (svc->impl_class) { AXIS2_SVC_SKELETON_FREE((axis2_svc_skeleton_t *) svc->impl_class, env); } if (svc->param_container) { axutil_param_container_free(svc->param_container, env); } if (svc->flow_container) { axis2_flow_container_free(svc->flow_container, env); } if (svc->filename) { AXIS2_FREE(env->allocator, svc->filename); svc->filename = NULL; } if (svc->svc_desc) { AXIS2_FREE(env->allocator, svc->svc_desc); svc->svc_desc = NULL; } svc->parent = NULL; if (svc->module_list) { int i = 0; int size = 0; size = axutil_array_list_size(svc->module_list, env); for (i = 0; i < size; i++) { axutil_qname_t *qname = NULL; qname = axutil_array_list_get(svc->module_list, env, i); if (qname) { axutil_qname_free(qname, env); } } axutil_array_list_free(svc->module_list, env); } if (svc->schema_list) { axutil_array_list_free(svc->schema_list, env); } if (svc->engaged_module_list) { axutil_array_list_free(svc->engaged_module_list, env); } if (svc->axis_svc_name) { AXIS2_FREE(env->allocator, svc->axis_svc_name); svc->axis_svc_name = NULL; } if (svc->op_alias_map) { axutil_hash_index_t *hi = NULL; void *val = NULL; for (hi = axutil_hash_first(svc->op_alias_map, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); if (val) { if (axis2_op_is_from_module((axis2_op_t *) val, env) == AXIS2_FALSE) { axis2_op_free((axis2_op_t *) val, env); } val = NULL; } } axutil_hash_free(svc->op_alias_map, env); } if (svc->op_action_map) { axutil_hash_index_t *hi = NULL; const void *key = NULL; for (hi = axutil_hash_first(svc->op_action_map, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, NULL); if (key) { AXIS2_FREE(env->allocator, (axis2_char_t *) key); key = NULL; } } axutil_hash_free(svc->op_action_map, env); } if (svc->op_rest_map) { axis2_core_utils_free_rest_map(env, svc->op_rest_map); } if (svc->schema_target_ns_prefix) { AXIS2_FREE(env->allocator, svc->schema_target_ns_prefix); svc->schema_target_ns_prefix = NULL; } if (svc->target_ns) { AXIS2_FREE(env->allocator, svc->target_ns); svc->target_ns = NULL; } if (svc->wsdl_path) { AXIS2_FREE(env->allocator, svc->wsdl_path); svc->wsdl_path = NULL; } if (svc->folder_path) { AXIS2_FREE(env->allocator, svc->folder_path); svc->folder_path = NULL; } if (svc->target_ns_prefix) { AXIS2_FREE(env->allocator, svc->target_ns_prefix); svc->target_ns_prefix = NULL; } if (svc->qname) { axutil_qname_free(svc->qname, env); } if (svc->style) { AXIS2_FREE(env->allocator, svc->style); } if (svc->base) { axis2_desc_free(svc->base, env); } if (svc->mutex) { axutil_thread_mutex_destroy(svc->mutex); } if (svc) { AXIS2_FREE(env->allocator, svc); svc = NULL; } return; }
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_ReferenceListChoiceE3_deserialize_obj( adb_ReferenceListChoiceE3_t* _ReferenceListChoiceE3, 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, _ReferenceListChoiceE3, AXIS2_FAILURE); first_node = parent; /* * building DataReference 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, "DataReference", "http://www.w3.org/2001/04/xmlenc#", NULL); if (adb_ReferenceTypeE2_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_ReferenceTypeE2"); status = adb_ReferenceTypeE2_deserialize((adb_ReferenceTypeE2_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_TRUE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element DataReference"); } else { status = adb_ReferenceListChoiceE3_set_DataReference(_ReferenceListChoiceE3, env, (adb_ReferenceTypeE2_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for DataReference "); 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 KeyReference 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, "KeyReference", "http://www.w3.org/2001/04/xmlenc#", NULL); if (adb_ReferenceTypeE2_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_ReferenceTypeE2"); status = adb_ReferenceTypeE2_deserialize((adb_ReferenceTypeE2_t*)element, env, ¤t_node, &is_early_node_valid, AXIS2_TRUE); if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element KeyReference"); } else { status = adb_ReferenceListChoiceE3_set_KeyReference(_ReferenceListChoiceE3, env, (adb_ReferenceTypeE2_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for KeyReference "); 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_lastmark_type0_deserialize_obj( adb_lastmark_type0_t* _lastmark_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; 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, _lastmark_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 lastmark_type0 : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building bookmarkContent 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, "bookmarkContent", "http://www.daisy.org/z3986/2005/bookmark/", NULL); if (adb_bookmarkContent_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_bookmarkContent"); status = adb_bookmarkContent_deserialize((adb_bookmarkContent_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 bookmarkContent"); } else { status = adb_lastmark_type0_set_bookmarkContent(_lastmark_type0, env, (adb_bookmarkContent_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for bookmarkContent "); 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 bookmarkContent missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL rp_username_token_builder_build( const axutil_env_t *env, axiom_node_t *node, axiom_element_t *element) { rp_username_token_t *username_token = NULL; neethi_policy_t *policy = NULL; axiom_node_t *child_node = NULL; axiom_element_t *child_element = NULL; axutil_array_list_t *alternatives = NULL; neethi_operator_t *component = NULL; neethi_all_t *all = NULL; axis2_char_t *inclusion_value = NULL; axutil_qname_t *qname = NULL; neethi_assertion_t *assertion = NULL; neethi_policy_t *normalized_policy = NULL; username_token = rp_username_token_create(env); qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX); inclusion_value = axiom_element_get_attribute_value(element, env, qname); axutil_qname_free(qname, env); qname = NULL; if(!inclusion_value) { /* we can try whether WS-SP1.2 specific inclusion value */ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX); inclusion_value = axiom_element_get_attribute_value(element, env, qname); axutil_qname_free(qname, env); qname = NULL; } rp_username_token_set_inclusion(username_token, env, inclusion_value); child_node = axiom_node_get_first_element(node, env); if (!child_node) { assertion = neethi_assertion_create(env); neethi_assertion_set_value(assertion, env, username_token, ASSERTION_TYPE_USERNAME_TOKEN); return assertion; } if (axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT) { child_element = (axiom_element_t *) axiom_node_get_data_element(child_node, env); if (child_element) { policy = neethi_engine_get_policy(env, child_node, child_element); if (!policy) { return NULL; } normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); neethi_policy_free(policy, env); policy = NULL; alternatives = neethi_policy_get_alternatives(normalized_policy, env); component = (neethi_operator_t *) axutil_array_list_get(alternatives, env, 0); all = (neethi_all_t *) neethi_operator_get_value(component, env); username_token_process_alternatives(env, all, username_token); assertion = neethi_assertion_create_with_args( env,(AXIS2_FREE_VOID_ARG)rp_username_token_free, username_token, ASSERTION_TYPE_USERNAME_TOKEN); neethi_policy_free(normalized_policy, env); normalized_policy = NULL; return assertion; } else return NULL; } else return NULL; }
WSF_WSDL_EXTERN axis2_bool_t WSF_WSDL_CALL wsdl_util_forward_type_from_type_map( const axutil_env_t* env, axiom_node_t* type_map, axis2_char_t* type1, axis2_char_t* type2) { axiom_element_t* type_map_element = NULL, *forward_element = NULL; axiom_node_t* forward_node = NULL; axutil_qname_t *qname = NULL; axis2_bool_t type_found = AXIS2_FALSE; type_map_element = (axiom_element_t*)axiom_node_get_data_element(type_map, env); if (type_map_element) { qname = axutil_qname_create(env, WSDL_TYPEMAP_FORWARD, NULL, NULL); forward_element = axiom_element_get_first_child_with_qname(type_map_element, env, qname, type_map, &forward_node); axutil_qname_free(qname, env); if (forward_element) { axiom_children_qname_iterator_t* parse_iter = NULL; qname = axutil_qname_create(env, type1, NULL, NULL); parse_iter = axiom_element_get_children_with_qname(forward_element, env, qname, forward_node); while (axiom_children_qname_iterator_has_next(parse_iter, env) == AXIS2_TRUE) { axiom_node_t* type_node = NULL; axiom_element_t* type_element = NULL; axis2_char_t* text = NULL; type_node = (axiom_node_t*)axiom_children_qname_iterator_next(parse_iter, env); type_element = (axiom_element_t*)axiom_node_get_data_element(type_node, env); text = axiom_element_get_text(type_element, env, type_node); if (text) { if (!axutil_strcmp(text, type2)) { type_found = AXIS2_TRUE; break; } } else { AXIS2_LOG_ERROR_MSG(env->log, "Badly formatted type map"); } } axutil_qname_free(qname, env); if (!type_found) { AXIS2_LOG_DEBUG_MSG(env->log, "Requested type is not found in the type map"); } } } return type_found; }
axis2_status_t AXIS2_CALL adb_contentItem_type0_deserialize_obj( adb_contentItem_type0_t* _contentItem_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, _contentItem_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 contentItem_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_contentItem_type0_set_label(_contentItem_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; } } 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 label missing"); 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_contentItem_type0_set_id(_contentItem_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; } 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, "lastModifiedDate")) { 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 "lastModifiedDate", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "lastModifiedDate"); } if(attrib_text != NULL) { element = (void*)axutil_date_time_create(env); axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env, attrib_text); adb_contentItem_type0_set_lastModifiedDate(_contentItem_type0, env, (axutil_date_time_t*)element); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL trust_rst_populate_rst( trust_rst_t *rst, const axutil_env_t *env, axiom_node_t *rst_node) { axiom_element_t *rst_ele = NULL; axutil_qname_t *attr_ctx_qname = NULL; axis2_char_t *attr_ctx = NULL; axiom_node_t *token_type_node = NULL; axiom_element_t *token_type_ele = NULL; axutil_qname_t *token_type_qname = NULL; axis2_char_t *token_type = NULL; axiom_element_t *req_type_ele = NULL; axiom_node_t *req_type_node = NULL; axutil_qname_t *req_type_qname = NULL; axis2_char_t *req_type = NULL; axutil_qname_t *applies_to_qname = NULL; /*AppliesTo*/ axiom_node_t *applies_to_node = NULL; axiom_element_t *applies_to_ele = NULL; axutil_qname_t *applies_to_epr_qname = NULL; /*EPR*/ axiom_node_t *applies_to_epr_node = NULL; axiom_element_t *applies_to_epr_ele = NULL; axutil_qname_t *applies_to_addr_qname = NULL; /*Addr*/ axiom_node_t *applies_to_addr_node = NULL; axiom_element_t *applies_to_addr_ele = NULL; trust_claims_t *claims = NULL; axiom_node_t *claims_node = NULL; axiom_element_t *claims_ele = NULL; axutil_qname_t *claims_qname = NULL; trust_entropy_t *entropy = NULL; axiom_node_t *entropy_node = NULL; axiom_element_t *entropy_ele = NULL; axutil_qname_t *entropy_qname = NULL; axiom_node_t *lifetime_node = NULL; axiom_element_t *lifetime_ele = NULL; axutil_qname_t *lifetime_qname = NULL; axiom_node_t *key_type_node = NULL; axiom_element_t *key_type_ele = NULL; axutil_qname_t *key_type_qname = NULL; axis2_char_t *key_type = NULL; axiom_node_t *key_size_node = NULL; axiom_element_t *key_size_ele = NULL; axutil_qname_t *key_size_qname = NULL; axis2_char_t *key_size = NULL; axiom_node_t *authnetication_type_node = NULL; axiom_element_t *authnetication_type_ele = NULL; axutil_qname_t *authnetication_type_qname = NULL; axis2_char_t *authnetication_type = NULL; axiom_node_t *signature_algo_node = NULL; axiom_element_t *signature_algo_ele = NULL; axutil_qname_t *signature_algo_qname = NULL; axis2_char_t *signature_algo = NULL; axiom_node_t *encryption_algo_node = NULL; axiom_element_t *encryption_algo_ele = NULL; axutil_qname_t *encryption_algo_qname = NULL; axis2_char_t *encryption_algo = NULL; axiom_node_t *canonocalization_algo_node = NULL; axiom_element_t *canonocalization_algo_ele = NULL; axutil_qname_t *canonocalization_algo_qname = NULL; axis2_char_t *canonocalization_algo = NULL; axiom_node_t *computedkey_algo_node = NULL; axiom_element_t *computedkey_algo_ele = NULL; axutil_qname_t *computedkey_algo_qname = NULL; axis2_char_t *computedkey_algo = NULL; axiom_node_t *desired_encryption_node = NULL; axiom_element_t *desired_encryption_ele = NULL; axutil_qname_t *desired_encryption_qname = NULL; axiom_node_t *desired_encryption_key_node = NULL; /*This can be either Key or STR*/ axiom_element_t *desired_encryption_key_ele = NULL; axiom_node_t *proof_encryption_node = NULL; axiom_element_t *proof_encryption_ele = NULL; axutil_qname_t *proof_encryption_qname = NULL; axiom_node_t *proof_encryption_key_node = NULL; /*This can be either Key or STR*/ axiom_element_t *proof_encryption_key_ele = NULL; axiom_node_t *use_key_node = NULL; axiom_element_t *use_key_ele = NULL; axutil_qname_t *use_key_qname = NULL; axiom_node_t *usekey_key_node = NULL; /*This can be either Key or STR*/ axiom_element_t *usekey_key_ele = NULL; axiom_node_t *sign_with_node = NULL; axiom_element_t *sign_with_ele = NULL; axutil_qname_t *sign_with_qname = NULL; axis2_char_t *sign_with = NULL; axiom_node_t *encrypt_with_node = NULL; axiom_element_t *encrypt_with_ele = NULL; axutil_qname_t *encrypt_with_qname = NULL; axis2_char_t *encrypt_with = NULL; if(NULL == rst_node || NULL == rst) { return AXIS2_FAILURE; } rst_ele = (axiom_element_t*)axiom_node_get_data_element(rst_node, env); if(NULL == rst_ele) { return AXIS2_FAILURE; } /*@Context*/ attr_ctx_qname = axutil_qname_create(env, TRUST_RST_CONTEXT, rst->wst_ns_uri, TRUST_WST); if (!attr_ctx_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Context Attribute Qname creation failed."); return AXIS2_FAILURE; } attr_ctx = axiom_element_get_attribute_value(rst_ele, env, attr_ctx_qname); if (attr_ctx) { rst->attr_context = attr_ctx; } axutil_qname_free(attr_ctx_qname, env); /*TokenType*/ token_type_qname = axutil_qname_create(env, TRUST_TOKEN_TYPE, rst->wst_ns_uri, TRUST_WST); if (!token_type_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] TokenType Qname creation failed."); return AXIS2_FAILURE; } token_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, token_type_qname, rst_node, &token_type_node); if (token_type_ele) { token_type = axiom_element_get_text(token_type_ele, env, token_type_node); if(token_type) { rst->token_type = token_type; } } axutil_qname_free(token_type_qname, env); /* RequestType */ req_type_qname = axutil_qname_create(env, TRUST_REQUEST_TYPE, rst->wst_ns_uri, TRUST_WST); if (!req_type_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] RequestType Qname creation failed."); return AXIS2_FAILURE; } req_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, req_type_qname, rst_node, &req_type_node); if(req_type_ele) { req_type = axiom_element_get_text(req_type_ele, env, req_type_node); if(req_type) { rst->request_type = req_type; } } axutil_qname_free(req_type_qname, env); /* AppliesTo */ applies_to_qname = axutil_qname_create(env, TRUST_APPLIES_TO, TRUST_WSP_XMLNS, TRUST_WSP); applies_to_epr_qname = axutil_qname_create(env, TRUST_EPR, TRUST_WSA_XMLNS, TRUST_WSA); applies_to_addr_qname = axutil_qname_create(env, TRUST_EPR_ADDRESS, TRUST_WSA_XMLNS, TRUST_WSA); if (!applies_to_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Appliesto Qname creation failed."); return AXIS2_FAILURE; } applies_to_ele = axiom_element_get_first_child_with_qname(rst_ele, env, applies_to_qname, rst_node, &applies_to_node); if(applies_to_ele) { applies_to_epr_ele = axiom_element_get_first_child_with_qname(applies_to_ele, env, applies_to_epr_qname, applies_to_node, &applies_to_epr_node); if(applies_to_epr_ele) { applies_to_addr_ele = axiom_element_get_first_child_with_qname(applies_to_epr_ele, env, applies_to_addr_qname, applies_to_epr_node, &applies_to_addr_node); if(applies_to_addr_ele) { rst->applies_to_addr = axiom_element_get_text(applies_to_addr_ele, env, applies_to_addr_node); } } } axutil_qname_free(applies_to_qname, env); axutil_qname_free(applies_to_epr_qname, env); axutil_qname_free(applies_to_addr_qname, env); /* Claims */ claims_qname = axutil_qname_create(env, TRUST_CLAIMS, rst->wst_ns_uri, TRUST_WST); if (!claims_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Claims Qname creation failed."); return AXIS2_FAILURE; } claims_ele = axiom_element_get_first_child_with_qname(rst_ele, env, claims_qname, rst_node, &claims_node); if (claims_ele) { claims = trust_claims_create(env); if(AXIS2_SUCCESS == trust_claims_deserialize(claims, env, claims_node)) { rst->claims = claims; } } axutil_qname_free(claims_qname, env); /*Entropy */ entropy_qname = axutil_qname_create(env, TRUST_ENTROPY, rst->wst_ns_uri, TRUST_WST); if (!entropy_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Entropy Qname creation failed."); return AXIS2_FAILURE; } entropy_ele = axiom_element_get_first_child_with_qname(rst_ele, env, entropy_qname, rst_node, &entropy_node); if(entropy_ele) { entropy = trust_entropy_create(env); trust_entropy_set_ns_uri(entropy, env, rst->wst_ns_uri); if(AXIS2_SUCCESS == trust_entropy_deserialize(entropy, env, entropy_node)) { rst->entropy = entropy; } } axutil_qname_free(entropy_qname, env); /*LifeTime*/ lifetime_qname = axutil_qname_create(env, TRUST_LIFE_TIME, rst->wst_ns_uri, TRUST_WST); if(!lifetime_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] LifeTime Qname creation failed."); return AXIS2_FAILURE; } lifetime_ele = axiom_element_get_first_child_with_qname(rst_ele, env, lifetime_qname, rst_node, &lifetime_node); if(lifetime_ele) { if(AXIS2_SUCCESS == trust_life_time_deserialize(rst->life_time, env, lifetime_node)) { rst->life_time = NULL; } } axutil_qname_free(lifetime_qname, env); /*Key and Encryption Requirements*/ /* KeyType */ key_type_qname = axutil_qname_create(env, TRUST_KEY_TYPE, rst->wst_ns_uri, TRUST_WST); if(!key_type_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] KeyType Qname creation failed."); return AXIS2_FAILURE; } key_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, key_type_qname, rst_node, &key_type_node); if(key_type_ele) { key_type = axiom_element_get_text(key_type_ele, env, key_type_node); if(key_type) { rst->key_type = key_type; } } axutil_qname_free(key_type_qname, env); /* KeySize */ key_size_qname = axutil_qname_create(env, TRUST_KEY_SIZE, rst->wst_ns_uri, TRUST_WST); key_size_ele = axiom_element_get_first_child_with_qname(rst_ele, env, key_size_qname, rst_node, &key_size_node); if(key_size_ele) { key_size = axiom_element_get_text(key_size_ele, env, key_size_node); if(key_size) { rst->key_size = atoi(key_size); } } axutil_qname_free(key_size_qname, env); /*AuthenticationType*/ authnetication_type_qname = axutil_qname_create(env, TRUST_AUTHENTICATION_TYPE, rst->wst_ns_uri, TRUST_WST); authnetication_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, authnetication_type_qname, rst_node, &authnetication_type_node); if(authnetication_type_ele) { authnetication_type = axiom_element_get_text(authnetication_type_ele, env, authnetication_type_node); if(authnetication_type) { rst->authentication_type = authnetication_type; } } axutil_qname_free(authnetication_type_qname, env); /*SignatureAlgorithm*/ signature_algo_qname = axutil_qname_create(env, TRUST_SIGNATURE_ALGO, rst->wst_ns_uri, TRUST_WST); signature_algo_ele = axiom_element_get_first_child_with_qname(rst_ele, env, signature_algo_qname, rst_node, &signature_algo_node); if(signature_algo_ele) { signature_algo = axiom_element_get_text(signature_algo_ele, env, signature_algo_node); if(signature_algo) { rst->signature_algo = signature_algo; } } axutil_qname_free(signature_algo_qname, env); /*EncryptionAlgorithm*/ encryption_algo_qname = axutil_qname_create(env, TRUST_ENCRYPTION_ALGO, rst->wst_ns_uri, TRUST_WST); encryption_algo_ele = axiom_element_get_first_child_with_qname(rst_ele, env, encryption_algo_qname, rst_node, &encryption_algo_node); if(encryption_algo_ele) { encryption_algo = axiom_element_get_text(encryption_algo_ele, env, encryption_algo_node); if(encryption_algo) { rst->encryption_algo = encryption_algo; } } axutil_qname_free(encryption_algo_qname, env); /*CanonicalizationAlgorithm*/ canonocalization_algo_qname = axutil_qname_create(env, TRUST_CANONICAL_ALGO, rst->wst_ns_uri, TRUST_WST); canonocalization_algo_ele = axiom_element_get_first_child_with_qname(rst_ele, env, canonocalization_algo_qname, rst_node, &canonocalization_algo_node); if(canonocalization_algo_ele) { canonocalization_algo = axiom_element_get_text(canonocalization_algo_ele, env, canonocalization_algo_node); if(canonocalization_algo) { rst->canonicalization_algo = canonocalization_algo; } } axutil_qname_free(canonocalization_algo_qname, env); /*ComputedKeyAlgorithm*/ computedkey_algo_qname = axutil_qname_create(env, TRUST_COMPUTED_KEY_ALGO, rst->wst_ns_uri, TRUST_WST); computedkey_algo_ele = axiom_element_get_first_child_with_qname(rst_ele, env, computedkey_algo_qname, rst_node, &computedkey_algo_node); if(computedkey_algo_ele) { computedkey_algo = axiom_element_get_text(computedkey_algo_ele, env, computedkey_algo_node); if(computedkey_algo) { rst->computed_key_algo = computedkey_algo; } } axutil_qname_free(computedkey_algo_qname, env); /*(Desired)Encryption */ desired_encryption_qname = axutil_qname_create(env, TRUST_DESIRED_ENCRYPTION, rst->wst_ns_uri, TRUST_WST); if (!desired_encryption_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Encryption Qname creation failed."); return AXIS2_FAILURE; } desired_encryption_ele = axiom_element_get_first_child_with_qname(rst_ele, env, desired_encryption_qname, rst_node, &desired_encryption_node); if(desired_encryption_ele) { desired_encryption_key_ele = axiom_element_get_first_element(desired_encryption_ele, env, desired_encryption_node, &desired_encryption_key_node); rst->desired_encryption = desired_encryption_key_node; } axutil_qname_free(desired_encryption_qname, env); /*ProofEncryption*/ proof_encryption_qname = axutil_qname_create(env, TRUST_PROOF_ENCRYPTION, rst->wst_ns_uri, TRUST_WST); if (!proof_encryption_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] ProofEncryption Qname creation failed."); return AXIS2_FAILURE; } proof_encryption_ele = axiom_element_get_first_child_with_qname(rst_ele, env, proof_encryption_qname, rst_node, &proof_encryption_node); if(proof_encryption_ele) { proof_encryption_key_ele = axiom_element_get_first_element(proof_encryption_ele, env, proof_encryption_node, &proof_encryption_key_node); rst->proof_encryption = proof_encryption_key_node; } axutil_qname_free(proof_encryption_qname, env); /*UseKey*/ use_key_qname = axutil_qname_create(env, TRUST_USE_KEY, rst->wst_ns_uri, TRUST_WST); if(!use_key_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] UseKey Qname creation failed."); return AXIS2_FAILURE; } use_key_ele = axiom_element_get_first_child_with_qname(rst_ele, env, use_key_qname, rst_node, &use_key_node); if(use_key_ele) { usekey_key_ele = axiom_element_get_first_element(use_key_ele, env, use_key_node, &usekey_key_node); rst->usekey = usekey_key_node; } axutil_qname_free(use_key_qname, env); /*SignWith*/ sign_with_qname = axutil_qname_create(env, TRUST_SIGN_WITH, rst->wst_ns_uri, TRUST_WST); sign_with_ele = axiom_element_get_first_child_with_qname(rst_ele, env, sign_with_qname, rst_node, &sign_with_node); if(sign_with_ele) { sign_with = axiom_element_get_text(sign_with_ele, env, sign_with_node); if(sign_with) { rst->sign_with = sign_with; } } axutil_qname_free(sign_with_qname, env); /*EncryptWith*/ encrypt_with_qname = axutil_qname_create(env, TRUST_ENCRYPT_WITH, rst->wst_ns_uri, TRUST_WST); if(!encrypt_with_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] EncryptWith Qname creation failed."); return AXIS2_FAILURE; } encrypt_with_ele = axiom_element_get_first_child_with_qname(rst_ele, env, encrypt_with_qname, rst_node, &encrypt_with_node); if(encrypt_with_ele) { encrypt_with = axiom_element_get_text(encrypt_with_ele, env, encrypt_with_node); if(encrypt_with) { rst->encrypt_with = encrypt_with; } } axutil_qname_free(encrypt_with_qname, env); return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL adb_deleteUserFromInternalStore_deserialize_obj( adb_deleteUserFromInternalStore_t* _deleteUserFromInternalStore, 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, _deleteUserFromInternalStore, 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 deleteUserFromInternalStore : " "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, _deleteUserFromInternalStore-> 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 deleteUserFromInternalStore : " "Expected %s but returned %s", axutil_qname_to_string(_deleteUserFromInternalStore-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building userName 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, "userName", "http://service.mgt.user.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 = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { status = adb_deleteUserFromInternalStore_set_userName(_deleteUserFromInternalStore, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for userName "); 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_creator_deserialize_obj( adb_creator_t* _creator, 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, _creator, 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 creator : " "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, _creator-> qname)) { first_node = parent; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for creator : " "Expected %s but returned %s", axutil_qname_to_string(_creator-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building creator 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_creator_set_creator(_creator, env, current_property_node); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for creator "); 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 creator missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_getMaxOperationResponseTimeResponse_deserialize( adb_getMaxOperationResponseTimeResponse_t* _getMaxOperationResponseTimeResponse, 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, _getMaxOperationResponseTimeResponse, 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 getMaxOperationResponseTimeResponse : " "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, _getMaxOperationResponseTimeResponse-> 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 getMaxOperationResponseTimeResponse : " "Expected %s but returned %s", axutil_qname_to_string(_getMaxOperationResponseTimeResponse-> 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_getMaxOperationResponseTimeResponse_set_return(_getMaxOperationResponseTimeResponse, 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; }
void test_endpoint_deserialize(char *content) { axutil_qname_t *qname = NULL; axiom_node_t *subs_node = NULL; axiom_element_t *subs_element = NULL; axiom_node_t *endpoint_node = NULL; axiom_element_t *endpoint_element = NULL; axiom_node_t *address_node = NULL; axiom_element_t *address_element = NULL; axis2_char_t *address = NULL; const axutil_env_t *env = NULL; axis2_char_t *nsurl = "http://ws.apache.org/ns/synapse"; env = axutil_env_create_all("test.log", AXIS2_LOG_LEVEL_TRACE); subs_node = axiom_node_create_from_buffer(env, content); subs_element = axiom_node_get_data_element(subs_node, env); if(!subs_element) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_OM_ELEMENT_EXPECTED, AXIS2_FAILURE); return; } qname = axutil_qname_create(env, "endpoint", nsurl, NULL); if(!qname) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return; } endpoint_element = axiom_element_get_first_child_with_qname(subs_element, env, qname, subs_node, &endpoint_node); if(qname) { axutil_qname_free(qname, env); } qname = axutil_qname_create(env, "address", nsurl, NULL); if(!qname) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return; } address_element = axiom_element_get_first_child_with_qname(endpoint_element, env, qname, endpoint_node, &address_node); if(qname) { axutil_qname_free(qname, env); } address = axiom_element_get_attribute_value_by_name(address_element, env, "url"); if(!address) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_OM_ELEMENT_INVALID_STATE, AXIS2_FAILURE); return; } printf("\naddress:%s\n\n", address); }
AXIS2_EXTERN axis2_char_t *AXIS2_CALL savan_client_renew( savan_client_t *client, const axutil_env_t *env, axis2_svc_client_t *svc_client, axutil_hash_t *options) { axis2_options_t *wsa_options = NULL; const axis2_char_t *old_action = NULL; axiom_namespace_t *ns = NULL; axiom_node_t *reply = NULL; axiom_node_t *renew_node = NULL; axiom_node_t *expires_node = NULL; axiom_element_t *renew_elem = NULL; axiom_element_t *expires_elem = NULL; axis2_char_t *expires = NULL; axis2_char_t *renew_elem_localname = NULL; axutil_qname_t *qname = NULL; AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_client_renew"); /* Set wsa action as Renew. remember the old action */ wsa_options = (axis2_options_t*)axis2_svc_client_get_options(svc_client, env); old_action = axis2_options_get_action(wsa_options, env); axis2_options_set_action(wsa_options, env, SAVAN_ACTIONS_RENEW); /* Create the body of the Renew request */ ns = axiom_namespace_create (env, EVENTING_NAMESPACE, EVENTING_NS_PREFIX); renew_elem = axiom_element_create(env, NULL, ELEM_NAME_RENEW, ns, &renew_node); /* Extract the values from the options map */ expires = axutil_hash_get(options, SAVAN_OP_KEY_EXPIRES, AXIS2_HASH_KEY_STRING); if(expires) { /* Expires element */ expires_elem = axiom_element_create(env, renew_node, ELEM_NAME_EXPIRES, ns, &expires_node); axiom_element_set_text(expires_elem, env, expires, expires_node); } savan_client_add_sub_id_to_soap_header(client, env, svc_client); /* send the Renew request and wait for the response */ reply = axis2_svc_client_send_receive(svc_client, env, renew_node); /* reset the old action */ axis2_options_set_action(wsa_options, env, old_action); if (!reply) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to send renew request. Error: %d Reason: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return NULL; } renew_elem = (axiom_element_t*)axiom_node_get_data_element(reply, env); /* Check whether we have received a RenewResponse */ renew_elem_localname = axiom_element_get_localname(renew_elem, env); if (axutil_strcmp(ELEM_NAME_RENEW_RESPONSE, renew_elem_localname)) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to retrieve RenewResponse"\ "element. Error: %d Reason: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return NULL; } /* Get Expires element from RenewResponse element */ qname = axutil_qname_create(env, ELEM_NAME_EXPIRES, EVENTING_NAMESPACE, NULL); expires_elem = axiom_element_get_first_child_with_qname(renew_elem, env, qname, reply, &expires_node); axutil_qname_free(qname, env); if(!expires_node) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to retrieve Expires"\ "element. Error: %d Reason: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return NULL; } expires = axiom_element_get_text(expires_elem, env, expires_node); AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_client_renew"); return expires; }
axis2_status_t AXIS2_CALL adb_metadataChoice_type1_deserialize_obj( adb_metadataChoice_type1_t* _metadataChoice_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; 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, _metadataChoice_type1, 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_metadataChoice_type1_set_extraElement(_metadataChoice_type1, 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; } *dp_parent = current_node; *dp_is_early_node_valid = is_early_node_valid; return status; }
axis2_status_t AXIS2_CALL prf_getAttributeResponseType_deserialize_obj( prf_getAttributeResponseType_t* _getAttributeResponseType, 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, _getAttributeResponseType, 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 getAttributeResponseType : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building getAttributeResult 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, "getAttributeResult", "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) { status = prf_getAttributeResponseType_set_getAttributeResult(_getAttributeResponseType, 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 getAttributeResult"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = prf_getAttributeResponseType_set_getAttributeResult(_getAttributeResponseType, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for getAttributeResult "); 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 getAttributeResult missing"); 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; }