static void ngx_lua_xml_parse_children(lua_State *l, axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_elem) { int n; char *uri, *prefix, *name, *text, *value; axiom_node_t *node; axutil_hash_t *attrs; axiom_element_t *elem; ngx_lua_thread_t *thr; axiom_attribute_t *attr; axiom_namespace_t *ns; axutil_hash_index_t *hi; axiom_child_element_iterator_t *it; thr = ngx_lua_thread(l); ngx_log_debug0(NGX_LOG_DEBUG_CORE, thr->log, 0, "lua xml parse children"); it = axiom_element_get_child_elements(parent_elem, env, parent); if (it == NULL) { return; } n = 1; do { node = axiom_child_element_iterator_next(it, env); elem = axiom_node_get_data_element(node, env); name = axiom_element_get_localname(elem, env); lua_createtable(l, 2, 4); lua_pushstring(l, name); lua_setfield(l, -2, "name"); ns = axiom_element_get_namespace(elem, env, node); if (ns != NULL) { uri = axiom_namespace_get_uri(ns, env); if (uri != NULL) { lua_pushstring(l, uri); lua_setfield(l, -2, "uri"); } prefix = axiom_namespace_get_prefix(ns, env); if (prefix != NULL) { lua_pushstring(l, prefix); lua_setfield(l, -2, "prefix"); } } attrs = axiom_element_get_all_attributes(elem, env); if (attrs != NULL) { lua_newtable(l); hi = axutil_hash_first(attrs, env); do { if (hi == NULL) { break; } axutil_hash_this(hi, NULL, NULL, (void **) &attr); name = axiom_attribute_get_localname(attr, env); value = axiom_attribute_get_value(attr, env); lua_pushstring(l, value); lua_setfield(l, -2, name); hi = axutil_hash_next(env, hi); } while (1); lua_setfield(l, -2, "attributes"); } text = axiom_element_get_text(elem, env, node); if (text != NULL) { lua_pushstring(l, text); lua_setfield(l, -2, "text"); } else { lua_newtable(l); ngx_lua_xml_parse_children(l, env, node, elem); lua_setfield(l, -2, "children"); } lua_setfield(l, -2, name); lua_getfield(l, -1, name); lua_rawseti(l, -2, n++); } while (axiom_child_element_iterator_has_next(it, env) == AXIS2_TRUE); }
/* This is the function where threads start running */ void *AXIS2_THREAD_FUNC axis2_udp_receiver_thread_worker_func( axutil_thread_t * thd, void *data) { const axutil_env_t *env = NULL; axis2_status_t status = AXIS2_FAILURE; axis2_conf_t *conf = NULL; axis2_svc_t *svc = NULL; axis2_udp_recv_thd_args_t *args = NULL; axis2_udp_response_t response; axutil_hash_index_t *hi = NULL; axutil_hash_t *ori_all_svcs = NULL, *all_svcs = NULL; void *val = NULL; args = (axis2_udp_recv_thd_args_t *) data; env = (axutil_env_t *) args->env; conf = axis2_conf_ctx_get_conf(args->conf_ctx, env); /* Get all the service discriptions */ ori_all_svcs = axis2_conf_get_all_svcs(conf, env); if (!ori_all_svcs) { return NULL; } all_svcs = axutil_hash_copy(ori_all_svcs, env); if (args->is_multicast) { /* If multicast we go through every service and try to figure out weather they are accepting multicast messages. If a service accepts a multicast message we send the request to that service bypassing the normal dispatchers. Dispatchers cannot be used since no dispatching information is found in the multicast messages */ for (hi = axutil_hash_first(all_svcs, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); svc = (axis2_svc_t *) val; if (svc) { axutil_param_t *param = NULL; axis2_char_t *param_val = NULL; /* Get the Multicast accept parameter from the services.xml */ param = axis2_svc_get_param(svc, env, AXIS2_UDP_MULTICAST_ACCEPT); if (!param) { continue; } /* check weather this service accepts multicast requests */ param_val = axutil_param_get_value(param, env); if (!param_val || !axutil_strcmp(param_val, "false") || axutil_strcmp(param_val, "true")) { continue; } response.buf_size = 0; response.buff = NULL; /* set the service to the request. This will bypass the dispatches */ args->request.svc = svc; /* Process the request */ status = axis2_udp_receiver_process_request(args->env, args->conf_ctx, &args->request, &response); if (status == AXIS2_FAILURE) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error processing the request."); return NULL; } /* If we have a response send it */ if (response.buff) { status = axutil_network_handler_send_dgram(env, args->send_socket, response.buff, &response.buf_size, args->req_addr, args->req_port, NULL); if (status == AXIS2_FAILURE) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error sending the response."); return NULL; } } } } } else { axis2_ctx_t *ctx = NULL; axutil_property_t *prop = NULL; axis2_udp_backchannel_info_t *binfo = NULL; ctx = axis2_conf_ctx_get_base(args->conf_ctx, env); prop = axis2_ctx_get_property(ctx, env, AXIS2_UDP_BACKCHANNEL_INFO); if (prop) { binfo = axutil_property_get_value(prop, env); } /* Unicast case. In this case message contains dispatching information. * So we send the request in the normal way */ response.buf_size = 0; response.buff = NULL; if (binfo) { args->request.svc = binfo->svc; args->request.op = binfo->op; } /* Process the request */ status = axis2_udp_receiver_process_request(args->env, args->conf_ctx, &args->request, &response); if (status == AXIS2_FAILURE) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error processing the request."); return NULL; } /* If we have a response send it */ if (response.buff) { status = axutil_network_handler_send_dgram(env, args->send_socket, response.buff, &response.buf_size, args->req_addr, args->req_port, NULL); if (status == AXIS2_FAILURE) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error sending the response."); return NULL; } } } return NULL; }
axis2_status_t AXIS2_CALL adb_item_deserialize_obj( adb_item_t* _item, 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, _item, 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 item : " "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, _item-> qname)) { first_node = parent; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for item : " "Expected %s but returned %s", axutil_qname_to_string(_item-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building item 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, "item", "http://www.daisy.org/ns/daisy-online/", 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_item_set_item(_item, 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 item"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = adb_item_set_item(_item, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for item "); 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 item 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_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; }
axiom_node_t* AXIS2_CALL adb_UserNotRegisteredException1_serialize( adb_UserNotRegisteredException1_t* _UserNotRegisteredException1, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t *current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t text_value_1[64]; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _UserNotRegisteredException1, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://esb.callbackservice.services.hdviper.psnc.pl/", "n"); axutil_hash_set(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "UserNotRegisteredException", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://esb.callbackservice.services.hdviper.psnc.pl/", p_prefix)); } if (!_UserNotRegisteredException1->is_valid_UserNotRegisteredException) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property UserNotRegisteredException"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("UserNotRegisteredException"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("UserNotRegisteredException"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing UserNotRegisteredException element */ sprintf(start_input_str, "<%s%sUserNotRegisteredException", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sUserNotRegisteredException>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); adb_UserNotRegisteredException_serialize(_UserNotRegisteredException1->property_UserNotRegisteredException, env, current_node, parent_element, adb_UserNotRegisteredException_is_particle() || AXIS2_TRUE, namespaces, next_ns_index); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axis2_status_t AXIS2_CALL adb_additionalTransferProtocols_type0_deserialize_obj( adb_additionalTransferProtocols_type0_t* _additionalTransferProtocols_type0, const axutil_env_t *env, axiom_node_t **dp_parent, axis2_bool_t *dp_is_early_node_valid, axis2_bool_t dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; axis2_status_t status = AXIS2_SUCCESS; const axis2_char_t* text_value = NULL; axutil_qname_t *qname = NULL; int i = 0; axutil_array_list_t *arr_list = NULL; int sequence_broken = 0; axiom_node_t *tmp_node = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; axis2_bool_t is_early_node_valid = AXIS2_TRUE; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, _additionalTransferProtocols_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 additionalTransferProtocols_type0 : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building protocol array */ arr_list = axutil_array_list_create(env, 10); /* * building protocol element */ element_qname = axutil_qname_create(env, "protocol", "http://www.daisy.org/ns/daisy-online/", NULL); for (i = 0, sequence_broken = 0, current_node = first_node; !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, env); is_early_node_valid = AXIS2_FALSE; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env); qname = axiom_element_get_qname(current_element, env, current_node); if ( (current_node && current_element && (axutil_qname_equals(element_qname, env, qname)))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname))) { is_early_node_valid = AXIS2_TRUE; } text_value = axiom_element_get_text(current_element, env, current_node); if(text_value != NULL) { axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, text_value)); } else { /* * axis2_qname_t *qname = NULL; * axiom_attribute_t *the_attri = NULL; * * qname = axutil_qname_create(env, "nil", "http://www.w3.org/2001/XMLSchema-instance", "xsi"); * the_attri = axiom_element_get_attribute(current_element, env, qname); */ /* currently thereis a bug in the axiom_element_get_attribute, so we have to go to this bad method */ axiom_attribute_t *the_attri = NULL; axis2_char_t *attrib_text = NULL; axutil_hash_t *attribute_hash = NULL; attribute_hash = axiom_element_get_all_attributes(current_element, env); attrib_text = NULL; if(attribute_hash) { axutil_hash_index_t *hi; void *val; const void *key; for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, &val); if(strstr((axis2_char_t*)key, "nil|http://www.w3.org/2001/XMLSchema-instance")) { the_attri = (axiom_attribute_t*)val; break; } } } if(the_attri) { attrib_text = axiom_attribute_get_value(the_attri, env); } else { /* this is hoping that attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(current_element, env, "nil"); } if(attrib_text && 0 == axutil_strcmp(attrib_text, "1")) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element protocol"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, "")); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for protocol "); 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 < 1) { /* found element out of order */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "protocol (@minOccurs = '1') 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_additionalTransferProtocols_type0_set_protocol(_additionalTransferProtocols_type0, env, arr_list); } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
AXIS2_EXTERN axis2_op_t *AXIS2_CALL axis2_svc_get_op_with_qname( const axis2_svc_t * svc, const axutil_env_t * env, const axutil_qname_t * op_qname) { axis2_op_t *op = NULL; axis2_char_t *nc_name = NULL; axis2_char_t *nc_tmp = NULL; /* This is just for the sake of comparison, * and must not be used to change the passed value */ axis2_bool_t is_matched = AXIS2_FALSE; AXIS2_PARAM_CHECK(env->error, op_qname, NULL); nc_name = axutil_qname_get_localpart(op_qname, env); nc_tmp = nc_name; op = axutil_hash_get(svc->op_alias_map, nc_tmp, AXIS2_HASH_KEY_STRING); if (op) { return op; } op = axutil_hash_get(svc->op_action_map, nc_tmp, AXIS2_HASH_KEY_STRING); if (op) { return op; } if (*nc_tmp && 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); nc_tmp = nc_name; if (key) { axis2_char_t *search = NULL; axis2_bool_t match_start = AXIS2_TRUE; axis2_char_t *search_tmp = NULL; search = (axis2_char_t *)key; if (!axutil_strchr(search, '*')) { if (axutil_strstr(nc_tmp, search)) { axis2_char_t *comp_tmp = NULL; comp_tmp = axutil_strstr(nc_tmp, search); if (strlen(comp_tmp) == strlen (search)) { nc_tmp = (axis2_char_t *)key; is_matched = AXIS2_TRUE; break; } } continue; } if (search[0] == '*') { search++; if (!*search) { nc_tmp = (axis2_char_t *)key; is_matched = AXIS2_TRUE; break; } else if (axutil_strchr(search, '*')) { continue; } match_start = AXIS2_FALSE; } while (search && *search) { int length = 0; axis2_char_t *loc_tmp = NULL; if (search_tmp) { AXIS2_FREE(env->allocator, search_tmp); search_tmp = NULL; } loc_tmp = axutil_strchr(search, '*'); if (loc_tmp && *loc_tmp) { if (!loc_tmp[1]) { is_matched = AXIS2_TRUE; break; } length = (int)(loc_tmp - search); /* We are sure that the difference lies within the int range */ search_tmp = (axis2_char_t *) (AXIS2_MALLOC (env->allocator, sizeof (axis2_char_t) * (length + 1))); strncpy(search_tmp, search, length); search_tmp[length] = '\0'; } else if (axutil_strstr(nc_tmp, search)) { axis2_char_t *comp_tmp = NULL; comp_tmp = axutil_strstr(nc_tmp, search); if (strlen(comp_tmp) == strlen (search)) { nc_tmp = (axis2_char_t *)key; is_matched = AXIS2_TRUE; break; } break; } else { break; } if (search_tmp && axutil_strstr(nc_tmp, search_tmp)) { if (match_start && !(axutil_strncmp(nc_tmp, search, length) == 0)) { break; } else if (!match_start) { match_start = AXIS2_TRUE; } } else { break; } search += axutil_strlen(search_tmp) + 1; nc_tmp = axutil_strstr(nc_tmp, search_tmp) + axutil_strlen(search_tmp); } if (search_tmp) { AXIS2_FREE(env->allocator, search_tmp); search_tmp = NULL; } if (is_matched || !*search) { nc_tmp = (axis2_char_t *)key; is_matched = AXIS2_TRUE; break; } } } } if (!is_matched) { nc_tmp = nc_name; } op = axutil_hash_get(svc->op_alias_map, nc_tmp, AXIS2_HASH_KEY_STRING); if (op) { return op; } return (axis2_op_t *)axutil_hash_get(svc->op_action_map, nc_tmp, AXIS2_HASH_KEY_STRING); }
axis2_status_t axis2_engine_check_must_understand_headers( const axutil_env_t * env, axis2_msg_ctx_t * msg_ctx) { axiom_soap_envelope_t *soap_envelope = NULL; axiom_soap_header_t *soap_header = NULL; axutil_hash_t *header_block_ht = NULL; axutil_hash_index_t *hash_index = NULL; AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE); soap_envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env); if(!soap_envelope) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Soap envelope not found in message context"); return AXIS2_FAILURE; } soap_header = axiom_soap_envelope_get_header(soap_envelope, env); if(!soap_header) return AXIS2_SUCCESS; header_block_ht = axiom_soap_header_get_all_header_blocks(soap_header, env); if(!header_block_ht) return AXIS2_SUCCESS; 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; axis2_char_t *role = NULL; axutil_hash_this(hash_index, NULL, NULL, &hb); header_block = (axiom_soap_header_block_t *)hb; if(header_block) { if(axiom_soap_header_block_is_processed(header_block, env) || !axiom_soap_header_block_get_must_understand(header_block, env)) { continue; } /* If this header block is not targeted to me then its not my problem. Currently this code only supports the "next" role; we need to fix this to allow the engine/service to be in one or more additional roles and then to check that any headers targeted for that role too have been dealt with. */ role = axiom_soap_header_block_get_role(header_block, env); if(axis2_msg_ctx_get_is_soap_11(msg_ctx, env) != AXIS2_TRUE) { /* SOAP 1.2 */ if(!role || axutil_strcmp(role, AXIOM_SOAP12_SOAP_ROLE_NEXT) != 0) { axiom_soap_envelope_t *temp_env = axiom_soap_envelope_create_default_soap_fault_envelope(env, "soapenv:MustUnderstand", "Header not understood", AXIOM_SOAP12, NULL, NULL); axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, temp_env); axis2_msg_ctx_set_wsa_action(msg_ctx, env, "http://www.w3.org/2005/08/addressing/fault"); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Must understand soap fault occured"); return AXIS2_FAILURE; } } else { /* SOAP 1.1 */ if(!role || axutil_strcmp(role, AXIOM_SOAP11_SOAP_ACTOR_NEXT) != 0) { axiom_soap_envelope_t *temp_env = axiom_soap_envelope_create_default_soap_fault_envelope(env, "soapenv:MustUnderstand", "Header not understood", AXIOM_SOAP11, NULL, NULL); axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, temp_env); axis2_msg_ctx_set_wsa_action(msg_ctx, env, "http://www.w3.org/2005/08/addressing/fault"); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Must understand soap fault occured"); return AXIS2_FAILURE; } } } } return AXIS2_SUCCESS; }
/** * Here we extract all operations defined in module.xml and built execution * chains for them by calling axis2_phase_resolver_build_execution_chains_for_module_op() * function. Within that function handlers of the modules defined for that * operation are added to module operation chains appropriately. */ AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_svc_add_module_ops( axis2_svc_t * svc, const axutil_env_t * env, axis2_module_desc_t * module_desc, axis2_conf_t * conf) { axutil_hash_t *map = NULL; axutil_hash_index_t *index = NULL; axis2_phase_resolver_t *phase_resolver = NULL; axis2_op_t *op_desc = NULL; axis2_status_t status = AXIS2_FAILURE; const axis2_char_t *svcname = NULL; axis2_char_t *modname = NULL; axis2_char_t *opname = NULL; AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Entry:axis2_svc_add_module_ops"); AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, conf, AXIS2_FAILURE); svcname = axis2_svc_get_name(svc, env); modname = axutil_qname_get_localpart(axis2_module_desc_get_qname(module_desc, env), env); map = axis2_module_desc_get_all_ops(module_desc, env); phase_resolver = axis2_phase_resolver_create_with_config_and_svc(env, conf, svc); if (!phase_resolver) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Creating phase resolver failed for service %s", svcname); return AXIS2_FAILURE; } for (index = axutil_hash_first(map, env); index; index = axutil_hash_next(env, index)) { void *v = NULL; axutil_hash_this(index, NULL, NULL, &v); op_desc = (axis2_op_t *) v; opname = axutil_qname_get_localpart(axis2_op_get_qname(op_desc, env), env); status = axis2_phase_resolver_build_execution_chains_for_module_op(phase_resolver, env, op_desc); if (AXIS2_SUCCESS != status) { if (phase_resolver) { axis2_phase_resolver_free(phase_resolver, env); } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Builidng module operation %s failed for module %s", opname, modname); return status; } status = axis2_svc_add_op(svc, env, op_desc); if (AXIS2_SUCCESS != status) { if (phase_resolver) { axis2_phase_resolver_free(phase_resolver, env); } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Adding operation %s to service %s failed", opname, svcname); return status; } } if (phase_resolver) { axis2_phase_resolver_free(phase_resolver, env); } AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:axis2_svc_add_module_ops"); 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; }
axiom_node_t * return_policy_element( axis2_char_t * name, const axutil_env_t * env, axis2_char_t * wsdl_name) { axiom_element_t *ele1 = NULL, *ele2 = NULL; axiom_document_t *document = NULL; axiom_node_t *node1 = NULL, *node2 = NULL, *policy_node = NULL; axiom_namespace_t *ns = NULL; axiom_xml_reader_t *reader = NULL; axiom_stax_builder_t *builder = NULL; char *buffer = NULL; axiom_attribute_t *attr = NULL; axis2_char_t *value = NULL; axis2_char_t *val = NULL; axutil_hash_t *attr_hash = NULL; axis2_char_t *xml_output = NULL; axutil_hash_index_t *hi; /* f = fopen(wsdl_name, "r"); if (!f) return NULL; reader = axiom_xml_reader_create_for_io(env, read_input, NULL , NULL, NULL); */ reader = axiom_xml_reader_create_for_file(env, wsdl_name, NULL); if (!reader) { printf("ERROR CREATING PULLPARSER"); return NULL; } builder = axiom_stax_builder_create(env, reader); if (!builder) { printf("ERROR CREATING PULL PARSER"); return NULL; } document = axiom_stax_builder_get_document(builder, env); if (!document) return NULL; node1 = axiom_document_get_root_element(document, env); if (!node1) { printf(" root element null "); axiom_stax_builder_free(builder, env); return NULL; } do { node2 = axiom_document_build_next(document, env); if (!node2) break; if (axiom_node_get_node_type(node2, env) == AXIOM_ELEMENT) { ele2 = (axiom_element_t *) axiom_node_get_data_element(node2, env); attr_hash = axiom_element_get_all_attributes(ele2, env); if (attr_hash) { hi = axutil_hash_first(attr_hash, env); axutil_hash_this(hi, NULL, NULL, &attr); if (axutil_strcmp(axiom_attribute_get_value(attr, env), name) == 0) { policy_node = node2; } } } } while (node2); return policy_node; }
axis2_status_t AXIS2_CALL adb_IssuerType_deserialize_obj( adb_IssuerType_t* _IssuerType, 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; status = AXIS2_FAILURE; if(parent) { axis2_char_t *attrib_text = NULL; attrib_text = axiom_element_get_attribute_value_by_name(axiom_node_get_data_element(parent, env), env, "nil"); if (attrib_text != NULL && !axutil_strcasecmp(attrib_text, "true")) { /* but the wsdl says that, this is non nillable */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element IssuerType"); status = AXIS2_FAILURE; } else { axiom_node_t *text_node = NULL; axiom_text_t *text_element = NULL; text_node = axiom_node_get_first_child(parent, env); if (text_node && axiom_node_get_node_type(text_node, env) == AXIOM_TEXT) text_element = (axiom_text_t*)axiom_node_get_data_element(text_node, env); text_value = ""; if(text_element && axiom_text_get_value(text_element, env)) { text_value = (axis2_char_t*)axiom_text_get_value(text_element, env); } status = adb_IssuerType_deserialize_from_string(_IssuerType, env, text_value, parent); } } parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env); attribute_hash = axiom_element_get_all_attributes(parent_element, env); 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, "uid")) { 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 "uid", this happnes when name is in default namespace */ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "uid"); } if(attrib_text != NULL) { element = (void*)adb_IdString_create(env); adb_IdString_deserialize_from_string((adb_IdString_t*)element, env, attrib_text, parent); adb_IssuerType_set_uid(_IssuerType, env, (adb_IdString_t*)element); } 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 axis2_status_t AXIS2_CALL remote_registry_rest_client_free( remote_registry_rest_client_t *rest_client, const axutil_env_t *env) { if(rest_client->conf) { remote_registry_conf_free(rest_client->conf, env); rest_client->conf = NULL; } if(rest_client->last_response_content_type) { AXIS2_FREE(env->allocator, rest_client->last_response_content_type); rest_client->last_response_content_type = NULL; } if(rest_client->cached_entries) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(rest_client->cached_entries, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); AXIS2_FREE(env->allocator, val); } axutil_hash_free(rest_client->cached_entries, env); } /* freeing the keys, and the value are just numbers */ if(rest_client->cached_entries_len) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(rest_client->cached_entries_len, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); } axutil_hash_free(rest_client->cached_entries_len, env); } /* freeing the keys, and the value are also should be freed*/ if(rest_client->etags) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(rest_client->etags, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); AXIS2_FREE(env->allocator, val); } axutil_hash_free(rest_client->etags, env); } if(rest_client->cached_order) { int i; void *cached_url; for(i = 0; i < axutil_array_list_size(rest_client->cached_order, env); i ++) { cached_url = axutil_array_list_get(rest_client->cached_order, env, i); AXIS2_FREE(env->allocator, cached_url); } axutil_array_list_free(rest_client->cached_order, env); } if(rest_client->reverse_cached_order) { axutil_hash_index_t *hi; void *val; void *key; int sum = 0; for (hi = axutil_hash_first(rest_client->reverse_cached_order, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, (const void**)&key, NULL, &val); AXIS2_FREE(env->allocator, key); } axutil_hash_free(rest_client->reverse_cached_order, env); } /* we are keeping the cached entries key to the cached_entries_len * so no need to re free */ axutil_hash_free(rest_client->cached_entries_len, env); AXIS2_FREE(env->allocator, rest_client); return AXIS2_SUCCESS; }
AXIS2_EXTERN void AXIS2_CALL axis2_conf_ctx_free( axis2_conf_ctx_t * conf_ctx, const axutil_env_t * env) { if(conf_ctx->base) { axis2_ctx_free(conf_ctx->base, env); } if(conf_ctx->op_ctx_map) { axutil_hash_index_t *hi = NULL; void *val = NULL; for(hi = axutil_hash_first(conf_ctx->op_ctx_map, env); hi; hi = axutil_hash_next(env, hi)) { axis2_op_ctx_t *op_ctx = NULL; axutil_hash_this(hi, NULL, NULL, &val); op_ctx = (axis2_op_ctx_t *)val; if(op_ctx) axis2_op_ctx_free(op_ctx, env); val = NULL; op_ctx = NULL; } axutil_hash_free(conf_ctx->op_ctx_map, env); } if(conf_ctx->svc_ctx_map) { axutil_hash_index_t *hi = NULL; void *val = NULL; for(hi = axutil_hash_first(conf_ctx->svc_ctx_map, env); hi; hi = axutil_hash_next(env, hi)) { axis2_svc_ctx_t *svc_ctx = NULL; axutil_hash_this(hi, NULL, NULL, &val); svc_ctx = (axis2_svc_ctx_t *)val; if(svc_ctx) axis2_svc_ctx_free(svc_ctx, env); val = NULL; svc_ctx = NULL; } axutil_hash_free(conf_ctx->svc_ctx_map, env); } if(conf_ctx->svc_grp_ctx_map) { axutil_hash_index_t *hi = NULL; void *val = NULL; for(hi = axutil_hash_first(conf_ctx->svc_grp_ctx_map, env); hi; hi = axutil_hash_next(env, hi)) { axis2_svc_grp_ctx_t *svc_grp_ctx = NULL; axutil_hash_this(hi, NULL, NULL, &val); svc_grp_ctx = (axis2_svc_grp_ctx_t *)val; if(svc_grp_ctx) axis2_svc_grp_ctx_free(svc_grp_ctx, env); val = NULL; svc_grp_ctx = NULL; } axutil_hash_free(conf_ctx->svc_grp_ctx_map, env); } if(conf_ctx->conf) { axis2_conf_free(conf_ctx->conf, env); } if(conf_ctx->mutex) { axutil_thread_mutex_destroy(conf_ctx->mutex); } if(conf_ctx->root_dir) { AXIS2_FREE(env->allocator, conf_ctx->root_dir); } AXIS2_FREE(env->allocator, conf_ctx); }
axiom_node_t* AXIS2_CALL adb_listPublishedOperationsResponse_serialize_obj( adb_listPublishedOperationsResponse_t* _listPublishedOperationsResponse, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; int i = 0; int count = 0; void *element = NULL; axis2_char_t text_value_1[ADB_DEFAULT_DIGIT_LIMIT]; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _listPublishedOperationsResponse, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://org.apache.axis2/xsd", "n"); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "listPublishedOperationsResponse", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://org.apache.axis2/xsd", p_prefix)); } if (!_listPublishedOperationsResponse->is_valid_return) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("return"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("return"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * Parsing return array */ if (_listPublishedOperationsResponse->property_return != NULL) { sprintf(start_input_str, "<%s%sreturn", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sreturn>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); count = axutil_array_list_size(_listPublishedOperationsResponse->property_return, env); for(i = 0; i < count; i ++) { element = axutil_array_list_get(_listPublishedOperationsResponse->property_return, env, i); if(NULL == element) { continue; } /* * parsing return element */ if(!adb_OperationMetaData_is_particle()) { axutil_stream_write(stream, env, start_input_str, start_input_str_len); } adb_OperationMetaData_serialize((adb_OperationMetaData_t*)element, env, current_node, parent_element, adb_OperationMetaData_is_particle() || AXIS2_FALSE, namespaces, next_ns_index); if(!adb_OperationMetaData_is_particle()) { axutil_stream_write(stream, env, end_input_str, end_input_str_len); } } } AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axiom_node_t* AXIS2_CALL prf_queryPackageListResponse_serialize_obj( prf_queryPackageListResponse_t* _queryPackageListResponse, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axis2_char_t* xsi_prefix = NULL; axiom_namespace_t* xsi_ns = NULL; axiom_attribute_t* xsi_type_attri = NULL; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t text_value_1[PRF_DEFAULT_DIGIT_LIMIT]; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _queryPackageListResponse, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://www.pratsam.org/ns/profile/", "n"); axutil_hash_set(namespaces, "http://www.pratsam.org/ns/profile/", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "queryPackageListResponse", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.pratsam.org/ns/profile/", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * PRF_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://www.pratsam.org/ns/profile/", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://www.pratsam.org/ns/profile/", p_prefix)); } if (!_queryPackageListResponse->is_valid_queryPackageListResponse) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property queryPackageListResponse"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("queryPackageListResponse"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("queryPackageListResponse"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing queryPackageListResponse element */ sprintf(start_input_str, "<%s%squeryPackageListResponse", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%squeryPackageListResponse>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); prf_queryPackageListResponseType_serialize(_queryPackageListResponse->property_queryPackageListResponse, env, current_node, parent_element, prf_queryPackageListResponseType_is_particle() || AXIS2_TRUE, namespaces, next_ns_index); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axis2_status_t AXIS2_CALL adb_choice_type0_deserialize_obj( adb_choice_type0_t* _choice_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, _choice_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 choice_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_choice_type0_set_label(_choice_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_choice_type0_set_id(_choice_type0, env, attrib_text); } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, env); } /* this is not a nillable element*/ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "required attribute id missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL axiom_soap_header_get_header_blocks_with_namespace_uri( axiom_soap_header_t * soap_header, const axutil_env_t * env, const axis2_char_t * ns_uri) { axutil_array_list_t *header_block_list = NULL; axutil_hash_index_t *hash_index = NULL; axiom_soap_header_block_t *header_block = NULL; axiom_node_t *header_block_om_node = NULL; axiom_element_t *header_block_om_ele = NULL; axiom_namespace_t *ns = NULL; axis2_char_t *hb_namespace_uri = NULL; int found = 0; void *hb = NULL; AXIS2_PARAM_CHECK(env->error, ns_uri, NULL); if(!(soap_header->header_blocks)) { return NULL; } header_block_list = axutil_array_list_create(env, 10); if(!header_block_list) { return NULL; } for(hash_index = axutil_hash_first(soap_header->header_blocks, env); hash_index; hash_index = axutil_hash_next(env, hash_index)) { axutil_hash_this(hash_index, NULL, NULL, &hb); if(hb) { header_block = (axiom_soap_header_block_t *)hb; header_block_om_node = axiom_soap_header_block_get_base_node(header_block, env); if(header_block_om_node) { header_block_om_ele = (axiom_element_t *)axiom_node_get_data_element( header_block_om_node, env); if(header_block_om_ele) { ns = axiom_element_get_namespace(header_block_om_ele, env, header_block_om_node); if(ns) { hb_namespace_uri = axiom_namespace_get_uri(ns, env); if(axutil_strcmp(hb_namespace_uri, ns_uri) == 0) { axutil_array_list_add(header_block_list, env, header_block); found++; } } } } hb = NULL; header_block = NULL; header_block_om_ele = NULL; header_block_om_node = NULL; ns = NULL; hb_namespace_uri = NULL; } } if(found > 0) { return header_block_list; } else { axutil_array_list_free(header_block_list, env); } return NULL; }
axiom_node_t* AXIS2_CALL adb_testConnectionResponse_serialize_obj( adb_testConnectionResponse_t* _testConnectionResponse, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t text_value_1[ADB_DEFAULT_DIGIT_LIMIT]; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _testConnectionResponse, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://service.mgt.user.carbon.wso2.org", "n"); axutil_hash_set(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "testConnectionResponse", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://service.mgt.user.carbon.wso2.org", p_prefix)); } if (!_testConnectionResponse->is_valid_return) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("return"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("return"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing return element */ sprintf(start_input_str, "<%s%sreturn>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sreturn>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); strcpy(text_value_1, (_testConnectionResponse->property_return)?"true":"false"); axutil_stream_write(stream, env, start_input_str, start_input_str_len); axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1)); axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axiom_soap_header_remove_header_block( axiom_soap_header_t * soap_header, const axutil_env_t * env, axutil_qname_t * qname) { axis2_char_t *qn_localname = NULL; axis2_char_t *qname_ns = NULL; axis2_char_t *qname_prefix = NULL; axutil_hash_index_t *hi = NULL; AXIS2_PARAM_CHECK(env->error, qname, AXIS2_FAILURE); qn_localname = axutil_qname_get_localpart(qname, env); qname_ns = axutil_qname_get_uri(qname, env); qname_prefix = axutil_qname_get_prefix(qname, env); if(!soap_header->header_blocks) { return AXIS2_FAILURE; } for(hi = axutil_hash_first(soap_header->header_blocks, env); hi; hi = axutil_hash_next(env, hi)) { const void *key = NULL; void *val = NULL; axutil_hash_this(hi, &key, NULL, &val); if(val) { axiom_soap_header_block_t *header_block = NULL; axiom_element_t *ele = NULL; axiom_node_t *node = NULL; header_block = (axiom_soap_header_block_t *)val; node = axiom_soap_header_block_get_base_node(header_block, env); if(node) { axutil_qname_t *element_qname = NULL; ele = (axiom_element_t *)axiom_node_get_data_element(node, env); element_qname = axiom_element_get_qname(ele, env, node); if(axiom_soap_header_qname_matches(env, element_qname, qname) == AXIS2_TRUE) { axiom_node_detach(node, env); /* axiom_node_free_tree(node, env); */ axutil_hash_set(soap_header->header_blocks, key, AXIS2_HASH_KEY_STRING, NULL); axiom_soap_header_block_free(header_block, env); axiom_node_free_tree(node, env); break; } } } } if(hi) { AXIS2_FREE(env->allocator, hi); } return AXIS2_SUCCESS; }
axiom_node_t* AXIS2_CALL adb_getServiceSpecificOutParameters_serialize_obj( adb_getServiceSpecificOutParameters_t* _getServiceSpecificOutParameters, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t *text_value_1; axis2_char_t *text_value_1_temp; axis2_char_t *text_value_2; axis2_char_t *text_value_2_temp; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _getServiceSpecificOutParameters, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://org.apache.axis2/xsd", "n"); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "getServiceSpecificOutParameters", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://org.apache.axis2/xsd", p_prefix)); } if (!_getServiceSpecificOutParameters->is_valid_transport) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("transport"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("transport"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing transport element */ sprintf(start_input_str, "<%s%stransport>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%stransport>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_1 = _getServiceSpecificOutParameters->property_transport; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE); if (text_value_1_temp) { axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp)); AXIS2_FREE(env->allocator, text_value_1_temp); } else { axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://org.apache.axis2/xsd", p_prefix)); } if (!_getServiceSpecificOutParameters->is_valid_service) { /* no need to complain for minoccurs=0 element */ } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("service"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("service"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing service element */ sprintf(start_input_str, "<%s%sservice>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sservice>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_2 = _getServiceSpecificOutParameters->property_service; axutil_stream_write(stream, env, start_input_str, start_input_str_len); text_value_2_temp = axutil_xml_quote_string(env, text_value_2, AXIS2_TRUE); if (text_value_2_temp) { axutil_stream_write(stream, env, text_value_2_temp, axutil_strlen(text_value_2_temp)); AXIS2_FREE(env->allocator, text_value_2_temp); } else { axutil_stream_write(stream, env, text_value_2, axutil_strlen(text_value_2)); } axutil_stream_write(stream, env, end_input_str, end_input_str_len); AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
axis2_status_t wsf_wsdl_util_configure_security_for_service( const axutil_env_t* env, axutil_hash_t* script_client_options_hash, axutil_hash_t* policies_hash, axis2_svc_t* svc, axis2_conf_ctx_t* worker_conf_ctx) { axis2_char_t* policy_xml_str = NULL; axutil_hash_t* policy_hash = NULL; axutil_hash_t* security_token_hash = NULL; axiom_node_t* input_policy_node_axiom = NULL; axiom_node_t* binding_policy_node_axiom = NULL; neethi_policy_t* merged_neethi_policy = NULL; axis2_status_t success = AXIS2_FAILURE; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); if (script_client_options_hash) { policy_xml_str = (axis2_char_t*)axutil_hash_get(script_client_options_hash, WSF_WSDL_HK_POLICY_STRING, AXIS2_HASH_KEY_STRING); policy_hash = (axutil_hash_t*)axutil_hash_get(script_client_options_hash, WSF_WSDL_HK_POLICY_HASH, AXIS2_HASH_KEY_STRING); security_token_hash = (axutil_hash_t*)axutil_hash_get(script_client_options_hash, WSF_WSDL_HK_SECURITY_TOKEN, AXIS2_HASH_KEY_STRING); } if (policy_xml_str) { success = wsf_wsdl_util_policy_from_xml_string(env, policy_xml_str, &input_policy_node_axiom); } else if (policy_hash) { success = wsf_wsdl_util_policy_from_options_hash(env, policy_hash, &input_policy_node_axiom); } else if (policies_hash) /* TODO: correct this condition */ { success = AXIS2_SUCCESS; } else { AXIS2_LOG_DEBUG_MSG(env->log, "No policies found! so security is not added"); return AXIS2_SUCCESS; /* this is not a failure case, simply security is ommitted */ } if (success) { success = AXIS2_FAILURE; if (security_token_hash) { axis2_char_t* op_name = NULL; /* loop policies hash */ axutil_hash_index_t* hi = NULL; void* val = NULL; for (hi = axutil_hash_first(policies_hash, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_t* wsdl_policy_hash = NULL; axis2_ssize_t size; op_name = NULL; axutil_hash_this(hi, &op_name, &size, &val); wsdl_policy_hash = (axutil_hash_t *)val; if (!(op_name && wsdl_policy_hash)) { continue; } success = wsf_wsdl_util_policy_from_wsdl_policy_hash(env, wsdl_policy_hash, &input_policy_node_axiom, &binding_policy_node_axiom); if (success) { if (wsf_wsdl_util_create_merged_neethi_policy(env, input_policy_node_axiom, binding_policy_node_axiom, &merged_neethi_policy)) { if (wsf_wsdl_util_insert_policy_to_svc(env, merged_neethi_policy, svc, op_name)) { if (wsf_wsdl_util_add_security_to_svc_configuration(env, security_token_hash, svc)) { axis2_conf_t *conf = NULL; conf = axis2_conf_ctx_get_conf (worker_conf_ctx, env); wsf_wsdl_util_engage_module (conf, WSF_WSDL_MODULE_SECURITY, env, svc); } } } } } } } return success; }
axiom_node_t* AXIS2_CALL adb_item_serialize_obj( adb_item_t* _item, const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index) { axiom_node_t* current_node = NULL; int tag_closed = 0; axis2_char_t* xsi_prefix = NULL; axiom_namespace_t* xsi_ns = NULL; axiom_attribute_t* xsi_type_attri = NULL; axiom_namespace_t *ns1 = NULL; axis2_char_t *qname_uri = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *p_prefix = NULL; axis2_bool_t ns_already_defined; axis2_char_t *text_value_1; axis2_char_t *text_value_1_temp; axis2_char_t *start_input_str = NULL; axis2_char_t *end_input_str = NULL; unsigned int start_input_str_len = 0; unsigned int end_input_str_len = 0; axiom_data_source_t *data_source = NULL; axutil_stream_t *stream = NULL; int next_ns_index_value = 0; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _item, NULL); namespaces = axutil_hash_make(env); next_ns_index = &next_ns_index_value; ns1 = axiom_namespace_create (env, "http://www.daisy.org/ns/daisy-online/", "n"); axutil_hash_set(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n")); parent_element = axiom_element_create (env, NULL, "item", ns1 , &parent); axiom_element_set_namespace(parent_element, env, ns1, parent); data_source = axiom_data_source_create(env, parent, ¤t_node); stream = axiom_data_source_get_stream(data_source, env); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://www.daisy.org/ns/daisy-online/", p_prefix)); } if (!_item->is_valid_item) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property item"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("item"))); /* axutil_strlen("<:>") + 1 = 4 */ end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (5 + axutil_strlen(p_prefix) + axutil_strlen("item"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing item element */ sprintf(start_input_str, "<%s%sitem>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sitem>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_1 = _item->property_item; text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE); if (text_value_1_temp) { axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp)); AXIS2_FREE(env->allocator, text_value_1_temp); } else { axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1)); } AXIS2_FREE(env->allocator,start_input_str); AXIS2_FREE(env->allocator,end_input_str); } if(namespaces) { axutil_hash_index_t *hi; void *val; for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, NULL, NULL, &val); AXIS2_FREE(env->allocator, val); } axutil_hash_free(namespaces, env); } return parent; }
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; }