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_getSystemStatisticsResponse_deserialize_obj( adb_getSystemStatisticsResponse_t* _getSystemStatisticsResponse, 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, _getSystemStatisticsResponse, 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 getSystemStatisticsResponse : " "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, _getSystemStatisticsResponse-> 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 getSystemStatisticsResponse : " "Expected %s but returned %s", axutil_qname_to_string(_getSystemStatisticsResponse-> 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_SystemStatistics_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_SystemStatistics"); status = adb_SystemStatistics_deserialize((adb_SystemStatistics_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_getSystemStatisticsResponse_set_return(_getSystemStatisticsResponse, env, (adb_SystemStatistics_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_EXTERN axis2_status_t AXIS2_CALL axis2_svc_client_send_robust_with_op_qname( axis2_svc_client_t * svc_client, const axutil_env_t * env, const axutil_qname_t * op_qname, const axiom_node_t * payload) { axis2_msg_ctx_t *msg_ctx = NULL; axis2_status_t status = AXIS2_FAILURE; axis2_bool_t qname_free_flag = AXIS2_FALSE; AXIS2_PARAM_CHECK(env->error, svc_client, AXIS2_FAILURE); if(!op_qname) { op_qname = axutil_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL); if(!op_qname) { return AXIS2_FAILURE; } qname_free_flag = AXIS2_TRUE; } else { axis2_op_t *op = NULL; axis2_char_t *mep = NULL; axis2_svc_t *svc = NULL; svc = axis2_svc_client_get_svc(svc_client, env); if(!svc) { return AXIS2_FAILURE; } op = axis2_svc_get_op_with_qname(svc, env, op_qname); if(!op) { return AXIS2_FAILURE; } mep = (axis2_char_t *)axis2_op_get_msg_exchange_pattern(op, env); if(!mep || axutil_strcmp(AXIS2_MEP_URI_OUT_ONLY, mep) != 0) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "%s%s", "To use this method opeation uri should be", AXIS2_MEP_URI_OUT_ONLY); return AXIS2_FAILURE; } } svc_client->auth_failed = AXIS2_FALSE; svc_client->required_auth_is_http = AXIS2_FALSE; if(svc_client->auth_type) { AXIS2_FREE(env->allocator, svc_client->auth_type); } svc_client->auth_type = NULL; msg_ctx = axis2_msg_ctx_create(env, axis2_svc_ctx_get_conf_ctx(svc_client->svc_ctx, env), NULL, NULL); if(!axis2_svc_client_fill_soap_envelope(env, svc_client, msg_ctx, payload)) { return AXIS2_FAILURE; } if(!axis2_svc_client_create_op_client(svc_client, env, op_qname)) { return AXIS2_FAILURE; } axis2_op_client_add_out_msg_ctx(svc_client->op_client, env, msg_ctx); status = axis2_op_client_execute(svc_client->op_client, env, AXIS2_TRUE); axis2_svc_client_set_http_info(svc_client, env, msg_ctx); svc_client->auth_failed = axis2_msg_ctx_get_auth_failed(msg_ctx, env); svc_client->required_auth_is_http = axis2_msg_ctx_get_required_auth_is_http(msg_ctx, env); if(axis2_msg_ctx_get_auth_type(msg_ctx, env)) { svc_client->auth_type = axutil_strdup(env, axis2_msg_ctx_get_auth_type(msg_ctx, env)); } if(qname_free_flag) { axutil_qname_free((axutil_qname_t *)op_qname, env); } 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; }
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_status_t AXIS2_CALL adb_globallyEngageModuleResponse_deserialize_obj( adb_globallyEngageModuleResponse_t* _globallyEngageModuleResponse, 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, _globallyEngageModuleResponse, 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 globallyEngageModuleResponse : " "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, _globallyEngageModuleResponse-> 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 globallyEngageModuleResponse : " "Expected %s but returned %s", axutil_qname_to_string(_globallyEngageModuleResponse-> 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://service.mgt.module.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) { if (!axutil_strcasecmp(text_value , "true")) { status = adb_globallyEngageModuleResponse_set_return(_globallyEngageModuleResponse, env, AXIS2_TRUE); } else { status = adb_globallyEngageModuleResponse_set_return(_globallyEngageModuleResponse, env, AXIS2_FALSE); } } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element return"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for return "); if(element_qname) { axutil_qname_free(element_qname, env); } return AXIS2_FAILURE; } } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
axis2_status_t AXIS2_CALL adb_getServicesResponse1_deserialize( adb_getServicesResponse1_t* _getServicesResponse1, 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, _getServicesResponse1, 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 getServicesResponse : " "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, _getServicesResponse1-> qname)) { first_node = parent; } else { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in building adb object for getServicesResponse : " "Expected %s but returned %s", axutil_qname_to_string(_getServicesResponse1-> qname, env), axutil_qname_to_string(qname, env)); return AXIS2_FAILURE; } /* * building getServicesResponse 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, "getServicesResponse", "http://esb.servicesmanager.services.hdviper.psnc.pl/", NULL); if (adb_getServicesResponse_is_particle() || (current_node && current_element && (axutil_qname_equals(element_qname, env, qname)))) { if( current_node && current_element && (axutil_qname_equals(element_qname, env, qname))) { is_early_node_valid = AXIS2_TRUE; } element = (void*)adb_getServicesResponse_create(env); status = adb_getServicesResponse_deserialize((adb_getServicesResponse_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 getServicesResponse"); } else { status = adb_getServicesResponse1_set_getServicesResponse(_getServicesResponse1, env, (adb_getServicesResponse_t*)element); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for getServicesResponse "); 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 getServicesResponse missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
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_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_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_status_t axis2_addr_in_extract_addr_params( const axutil_env_t * env, axiom_soap_header_t * soap_header, axis2_msg_info_headers_t ** msg_info_headers_p, axutil_array_list_t * addr_headers, const axis2_char_t * addr_ns_str, axis2_msg_ctx_t * msg_ctx) { axutil_hash_t *header_block_ht = NULL; axutil_hash_index_t *hash_index = NULL; axis2_msg_info_headers_t *msg_info_headers = *(msg_info_headers_p); axis2_status_t status = AXIS2_SUCCESS; axis2_bool_t to_found = AXIS2_FALSE; axis2_bool_t reply_to_found = AXIS2_FALSE; axis2_bool_t fault_to_found = AXIS2_FALSE; axis2_bool_t action_found = AXIS2_FALSE; axis2_bool_t msg_id_found = AXIS2_FALSE; AXIS2_PARAM_CHECK(env->error, soap_header, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, msg_info_headers_p, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, addr_headers, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, addr_ns_str, AXIS2_FAILURE); if(!msg_info_headers) { AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No messgae info header. Creating new"); msg_info_headers = axis2_msg_info_headers_create(env, NULL, NULL); if(!msg_info_headers) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MSG_INFO_HEADERS, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No message information headers available"); return AXIS2_FAILURE; } } header_block_ht = axiom_soap_header_get_all_header_blocks(soap_header, env); if(!header_block_ht) { return AXIS2_FAILURE; } /* Iterate thru header blocks */ for(hash_index = axutil_hash_first(header_block_ht, env); hash_index; hash_index = axutil_hash_next(env, hash_index)) { void *hb = NULL; axiom_soap_header_block_t *header_block = NULL; axiom_node_t *header_block_node = NULL; axiom_element_t *header_block_ele = NULL; axis2_char_t *ele_localname = NULL; axis2_endpoint_ref_t *epr = NULL; axis2_char_t *role = NULL; axutil_hash_this(hash_index, NULL, NULL, &hb); header_block = (axiom_soap_header_block_t *)hb; header_block_node = axiom_soap_header_block_get_base_node(header_block, env); header_block_ele = (axiom_element_t *)axiom_node_get_data_element(header_block_node, env); ele_localname = axiom_element_get_localname(header_block_ele, env); role = axiom_soap_header_block_get_role(header_block, env); if(role && !axutil_strcmp(role, AXIOM_SOAP12_SOAP_ROLE_NONE)) { /* Role is none, no need of processing */ continue; } if(!axutil_strcmp(ele_localname, AXIS2_WSA_TO)) { /* Here the addressing epr overidde what ever already there in the message context */ epr = axis2_endpoint_ref_create(env, axiom_element_get_text(header_block_ele, env, header_block_node)); if(AXIS2_TRUE == to_found) { /* Duplicate To */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_TO, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; continue; } axis2_msg_info_headers_set_to(msg_info_headers, env, epr); axis2_addr_in_extract_to_epr_ref_params(env, epr, soap_header, addr_ns_str); axiom_soap_header_block_set_processed(header_block, env); to_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_FROM)) { epr = axis2_msg_info_headers_get_from(msg_info_headers, env); if(!epr) { /* The address is not known now. Pass the empty string and fill this once the element under this is processed. */ epr = axis2_endpoint_ref_create(env, ""); axis2_msg_info_headers_set_from(msg_info_headers, env, epr); } axis2_addr_in_extract_epr_information(env, header_block, epr, addr_ns_str); axiom_soap_header_block_set_processed(header_block, env); } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_REPLY_TO)) { epr = axis2_msg_info_headers_get_reply_to(msg_info_headers, env); if(reply_to_found == AXIS2_TRUE) { /* Duplicate Reply To */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_REPLY_TO, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; continue; } if(!epr) { epr = axis2_endpoint_ref_create(env, ""); axis2_msg_info_headers_set_reply_to(msg_info_headers, env, epr); } axis2_addr_in_extract_epr_information(env, header_block, epr, addr_ns_str); axiom_soap_header_block_set_processed(header_block, env); reply_to_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_FAULT_TO)) { epr = axis2_msg_info_headers_get_fault_to(msg_info_headers, env); if(fault_to_found == AXIS2_TRUE) { /* Duplicate Fault To */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_FAULT_TO, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; axis2_msg_info_headers_set_fault_to(msg_info_headers, env, NULL); continue; } if(!epr) { epr = axis2_endpoint_ref_create(env, ""); axis2_msg_info_headers_set_fault_to(msg_info_headers, env, epr); } axis2_addr_in_extract_epr_information(env, header_block, epr, addr_ns_str); axiom_soap_header_block_set_processed(header_block, env); fault_to_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_MESSAGE_ID)) { axis2_char_t *text = NULL; if(msg_id_found == AXIS2_TRUE) { /* Duplicate Message ID */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_MESSAGE_ID, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; continue; } text = axiom_element_get_text(header_block_ele, env, header_block_node); axis2_msg_info_headers_set_in_message_id(msg_info_headers, env, text); axiom_soap_header_block_set_processed(header_block, env); msg_id_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_ACTION)) { axis2_char_t *text = NULL; if(action_found == AXIS2_TRUE) { /* Duplicate Action */ axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_ACTION, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; continue; } text = axiom_element_get_text(header_block_ele, env, header_block_node); axis2_msg_info_headers_set_action(msg_info_headers, env, text); axiom_soap_header_block_set_processed(header_block, env); action_found = AXIS2_TRUE; } else if(!axutil_strcmp(ele_localname, AXIS2_WSA_RELATES_TO)) { axis2_char_t *address = NULL; axutil_qname_t *rqn = NULL; axiom_attribute_t *relationship_type = NULL; const axis2_char_t *relationship_type_value = NULL; axis2_relates_to_t *relates_to = NULL; rqn = axutil_qname_create(env, AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE, NULL, NULL); relationship_type = axiom_element_get_attribute(header_block_ele, env, rqn); if(!relationship_type) { if(!axutil_strcmp(AXIS2_WSA_NAMESPACE_SUBMISSION, addr_ns_str)) { relationship_type_value = AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE_SUBMISSION; } else { relationship_type_value = AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE; } } else { relationship_type_value = axiom_attribute_get_value(relationship_type, env); } address = axiom_element_get_text(header_block_ele, env, header_block_node); relates_to = axis2_relates_to_create(env, address, relationship_type_value); axis2_msg_info_headers_set_relates_to(msg_info_headers, env, relates_to); axiom_soap_header_block_set_processed(header_block, env); axutil_qname_free(rqn, env); } } /* If an action is not found, it's a false*/ if(action_found == AXIS2_FALSE) { axis2_addr_in_create_fault_envelope(env, AXIS2_WSA_PREFIX_ACTION, addr_ns_str, msg_ctx); status = AXIS2_FAILURE; } return status; }
AXIS2_EXTERN void AXIS2_CALL axis2_svc_client_send_receive_non_blocking_with_op_qname( axis2_svc_client_t * svc_client, const axutil_env_t * env, const axutil_qname_t * op_qname, const axiom_node_t * payload, axis2_callback_t * callback) { axis2_msg_ctx_t *msg_ctx = NULL; AXIS2_TRANSPORT_ENUMS transport_in_protocol; axis2_bool_t qname_free_flag = AXIS2_FALSE; AXIS2_PARAM_CHECK_VOID(env->error, svc_client); if(!op_qname) { op_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL); if(!op_qname) return; qname_free_flag = AXIS2_TRUE; } svc_client->auth_failed = AXIS2_FALSE; svc_client->required_auth_is_http = AXIS2_FALSE; if(svc_client->auth_type) { AXIS2_FREE(env->allocator, svc_client->auth_type); } svc_client->auth_type = NULL; msg_ctx = axis2_msg_ctx_create(env, axis2_svc_ctx_get_conf_ctx(svc_client-> svc_ctx, env), NULL, NULL); if(!msg_ctx) return; if(!axis2_svc_client_fill_soap_envelope(env, svc_client, msg_ctx, payload)) { return; } if(!axis2_svc_client_create_op_client(svc_client, env, op_qname)) { return; } axis2_op_client_set_callback(svc_client->op_client, env, callback); axis2_op_client_add_out_msg_ctx(svc_client->op_client, env, msg_ctx); /* If dual channel */ if(axis2_options_get_use_separate_listener(svc_client->options, env)) { axis2_op_t *op = NULL; transport_in_protocol = axis2_options_get_transport_in_protocol(svc_client->options, env); if(transport_in_protocol == AXIS2_TRANSPORT_ENUM_MAX) { axis2_options_set_transport_in_protocol(svc_client->options, env, AXIS2_TRANSPORT_ENUM_HTTP); transport_in_protocol = AXIS2_TRANSPORT_ENUM_HTTP; } axis2_listener_manager_make_sure_started(svc_client->listener_manager, env, transport_in_protocol, svc_client->conf_ctx); /* Following sleep is required to ensure the listener is ready to receive response. If it is missing, the response gets lost. - Samisa */ AXIS2_USLEEP(1); op = axis2_svc_get_op_with_qname(svc_client->svc, env, op_qname); /* At the end of the incoming flow this message receiver will be hit */ axis2_op_set_msg_recv(op, env, AXIS2_CALLBACK_RECV_GET_BASE(svc_client-> callback_recv, env)); axis2_op_client_set_callback_recv(svc_client->op_client, env, svc_client->callback_recv); } axis2_op_client_execute(svc_client->op_client, env, AXIS2_FALSE); axis2_svc_client_set_http_info(svc_client, env, msg_ctx); svc_client->auth_failed = axis2_msg_ctx_get_auth_failed(msg_ctx, env); svc_client->required_auth_is_http = axis2_msg_ctx_get_required_auth_is_http(msg_ctx, env); if(axis2_msg_ctx_get_auth_type(msg_ctx, env)) { svc_client->auth_type = axutil_strdup(env, axis2_msg_ctx_get_auth_type(msg_ctx, env)); } if(qname_free_flag) { axutil_qname_free((axutil_qname_t *)op_qname, env); op_qname = NULL; } }
AXIS2_EXTERN axiom_node_t *AXIS2_CALL axis2_svc_client_send_receive_with_op_qname( axis2_svc_client_t * svc_client, const axutil_env_t * env, const axutil_qname_t * op_qname, const axiom_node_t * payload) { axiom_soap_envelope_t *soap_envelope = NULL; axiom_soap_body_t *soap_body = NULL; axiom_node_t *soap_node = NULL; axis2_op_t *op = NULL; axutil_param_t *param = NULL; axutil_uri_t *action_uri = NULL; axis2_char_t *action_str = NULL; axis2_bool_t qname_free_flag = AXIS2_FALSE; axis2_msg_ctx_t *res_msg_ctx = NULL; axis2_msg_ctx_t *msg_ctx = NULL; AXIS2_PARAM_CHECK(env->error, svc_client, NULL); svc_client->last_response_soap_envelope = NULL; svc_client->last_response_has_fault = AXIS2_FALSE; svc_client->auth_failed = AXIS2_FALSE; svc_client->required_auth_is_http = AXIS2_FALSE; if(svc_client->auth_type) { AXIS2_FREE(env->allocator, svc_client->auth_type); } svc_client->auth_type = NULL; op = axis2_svc_get_op_with_qname(svc_client->svc, env, op_qname); if(op) { param = axis2_op_get_param(op, env, AXIS2_SOAP_ACTION); if(param) { action_uri = (axutil_uri_t *)axutil_param_get_value(param, env); action_str = axutil_uri_to_string(action_uri, env, AXIS2_URI_UNP_OMITUSERINFO); axis2_options_set_action(svc_client->options, env, action_str); } } if(!op_qname) { op_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL); if(!op_qname) return NULL; qname_free_flag = AXIS2_TRUE; } /* If dual channel blocking. We come to this block if the client indicate to use * a separate listener but don't provide a callback function to acted upon when * response is received in the listener thread. What we do here is we create a callback * and call axis2_svc_client_send_receive_non_blocking_with_op_qname with it. */ if(axis2_options_get_use_separate_listener(svc_client->options, env)) { axis2_callback_t *callback = NULL; axis2_msg_ctx_t *msg_ctx = NULL; long index = 0; /* This means doing a Request-Response invocation using two channels. If the transport is a two way transport (e.g. http), only one channel is used (e.g. in http cases 202 OK is sent to say no response available). Axis2 gets blocked and return when the response is available. */ callback = axis2_callback_create(env); if(!callback) { return NULL; } /* Call two channel non blocking invoke to do the work and wait on the callback. We don't * set a callback function for the callback. That functionality is handled here. */ axis2_svc_client_send_receive_non_blocking_with_op_qname(svc_client, env, op_qname, payload, callback); index = axis2_options_get_timeout_in_milli_seconds(svc_client->options, env) / 10; while(!axis2_callback_get_complete(callback, env)) { if(index-- >= 0) { AXIS2_USLEEP(10000); } else { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_RESPONSE_TIMED_OUT, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Response time out."); return NULL; } } soap_envelope = axis2_callback_get_envelope(callback, env); msg_ctx = axis2_callback_get_msg_ctx(callback, env); axis2_op_client_add_in_msg_ctx(svc_client->op_client, env, msg_ctx); /* start of hack to get rid of memory leak */ /*msg_ctx = axis2_msg_ctx_create(env, axis2_svc_ctx_get_conf_ctx(svc_client-> svc_ctx, env), NULL, NULL); if(!msg_ctx) return NULL; axis2_op_client_add_in_msg_ctx(svc_client->op_client, env, msg_ctx); axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);*/ /* end of hack to get rid of memory leak */ /* process the result of the invocation */ if(!soap_envelope) { if(axis2_callback_get_error(callback, env) != AXIS2_ERROR_NONE) { AXIS2_ERROR_SET(env->error, axis2_callback_get_error(callback, env), AXIS2_FAILURE); return NULL; } } } else { msg_ctx = axis2_msg_ctx_create(env, axis2_svc_ctx_get_conf_ctx(svc_client->svc_ctx, env), NULL, NULL); if(!msg_ctx) return NULL; if(!axis2_svc_client_fill_soap_envelope(env, svc_client, msg_ctx, payload)) { return NULL; } if(!axis2_svc_client_create_op_client(svc_client, env, op_qname)) { return NULL; } axis2_op_client_add_msg_ctx(svc_client->op_client, env, msg_ctx); axis2_op_client_execute(svc_client->op_client, env, AXIS2_TRUE); axis2_svc_client_set_http_info(svc_client, env, msg_ctx); svc_client->auth_failed = axis2_msg_ctx_get_auth_failed(msg_ctx, env); svc_client->required_auth_is_http = axis2_msg_ctx_get_required_auth_is_http(msg_ctx, env); if(axis2_msg_ctx_get_auth_type(msg_ctx, env)) { svc_client->auth_type = axutil_strdup(env, axis2_msg_ctx_get_auth_type(msg_ctx, env)); } res_msg_ctx = (axis2_msg_ctx_t *)axis2_op_client_get_msg_ctx(svc_client-> op_client, env, AXIS2_WSDL_MESSAGE_LABEL_IN); if(res_msg_ctx) { soap_envelope = axis2_msg_ctx_get_soap_envelope(res_msg_ctx, env); } else { axis2_op_client_add_msg_ctx(svc_client->op_client, env, res_msg_ctx); /* set in msg_ctx to be NULL to reset */ } } if(qname_free_flag) { axutil_qname_free((axutil_qname_t *)op_qname, env); } if(!soap_envelope) { return NULL; } svc_client->last_response_soap_envelope = soap_envelope; soap_body = axiom_soap_envelope_get_body(soap_envelope, env); if(!soap_body) { axiom_node_t *node = axiom_soap_envelope_get_base_node(soap_envelope, env); if(node) { axiom_element_t *envelope_element = (axiom_element_t *)axiom_node_get_data_element( node, env); axiom_util_get_first_child_element_with_localname(envelope_element, env, node, AXIOM_SOAP_BODY_LOCAL_NAME, &soap_node); if(soap_node) { return axiom_node_get_first_element(soap_node, env); } } return NULL; } if(axis2_msg_ctx_get_doing_rest(res_msg_ctx, env)) { /* All HTTP 4xx and 5xx status codes are treated as errors */ if(axis2_msg_ctx_get_status_code(res_msg_ctx, env) >= 400) { svc_client->last_response_has_fault = AXIS2_TRUE; } else { svc_client->last_response_has_fault = AXIS2_FALSE; } } else { svc_client->last_response_has_fault = axiom_soap_body_has_fault(soap_body, env); } if(AXIOM_SOAP11 == axiom_soap_envelope_get_soap_version(soap_envelope, env)) { axiom_soap_body_convert_fault_to_soap11(soap_body, env); } soap_node = axiom_soap_body_get_base_node(soap_body, env); if(!soap_node) { return NULL; } return axiom_node_get_first_element(soap_node, env); }
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_status_t AXIS2_CALL adb_ReferenceListChoice_deserialize_obj( adb_ReferenceListChoice_t* _ReferenceListChoice, 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, _ReferenceListChoice, 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_ReferenceListChoice_set_DataReference(_ReferenceListChoice, 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_ReferenceListChoice_set_KeyReference(_ReferenceListChoice, 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 wsclient_get_attachment (const axutil_env_t *env, axiom_node_t *node, axis2_char_t *base_dir, int is_mtom_enabled) { axiom_node_t *child_node = NULL; axiom_element_t *element; if (!node || !env) return AXIS2_FAILURE; if (axiom_node_get_node_type (node, env) == AXIOM_ELEMENT) { axis2_char_t *local_name; axiom_namespace_t *ns; axis2_char_t *ns_uri; element = (axiom_element_t *) axiom_node_get_data_element (node, env); local_name = axiom_element_get_localname (element, env); if (local_name) { if (!strcmp (local_name, "Include")) { ns = axiom_element_get_namespace(element, env, node); if (ns && (ns_uri = axiom_namespace_get_uri (ns, env)) && (!strcmp (ns_uri, "http://www.w3.org/2004/08/xop/include"))) { axiom_node_t *text_node; axiom_text_t *text; axiom_data_handler_t *data_handler; axis2_char_t *write_file = NULL; axis2_char_t *pwd; axis2_char_t *relative; axutil_qname_t *attribute_qname; axiom_attribute_t *href = NULL; axis2_char_t *cid_value; #if defined(WIN32) char path[256]; GetCurrentDirectory(256, path); pwd = path; #else pwd = AXIS2_GETENV ("PWD"); #endif relative = wsclient_get_relative_path (env, pwd, base_dir); attribute_qname = axutil_qname_create (env, "href", NULL, NULL); if (attribute_qname) href = axiom_element_get_attribute (element, env, attribute_qname); else return AXIS2_FAILURE; if (href) { cid_value = axiom_attribute_get_value (href, env); cid_value = cid_value + 4; } else return AXIS2_FAILURE; axiom_attribute_set_value (href, env, relative); text_node = axiom_node_get_first_child (node, env); if (text_node && (axiom_node_get_node_type (text_node, env) == AXIOM_TEXT)) { text = (axiom_text_t *) axiom_node_get_data_element (text_node, env); data_handler = axiom_text_get_data_handler(text, env); if (data_handler && text) { if (base_dir) { int len = 0; len = strlen (base_dir); if (base_dir [len - 1] != '/') strcat (base_dir, "/"); if (cid_value) write_file = strcat (base_dir, cid_value); else return AXIS2_FAILURE; } if (write_file) axiom_data_handler_set_file_name(data_handler, env, write_file); axiom_data_handler_write_to(data_handler, env); } } } } } child_node = axiom_node_get_first_element (node, env); while (child_node) { wsclient_get_attachment (env, child_node, base_dir, is_mtom_enabled); child_node = axiom_node_get_next_sibling (child_node, env); } } else return AXIS2_FAILURE; return AXIS2_SUCCESS; }
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_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_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_status_t AXIS2_CALL adb_removeServicePoliciesByNamespace_deserialize_obj( adb_removeServicePoliciesByNamespace_t* _removeServicePoliciesByNamespace, 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, _removeServicePoliciesByNamespace, 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 removeServicePoliciesByNamespace : " "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, _removeServicePoliciesByNamespace-> 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 removeServicePoliciesByNamespace : " "Expected %s but returned %s", axutil_qname_to_string(_removeServicePoliciesByNamespace-> 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_removeServicePoliciesByNamespace_set_serviceName(_removeServicePoliciesByNamespace, 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 namesapce 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, "namesapce", "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_removeServicePoliciesByNamespace_set_namesapce(_removeServicePoliciesByNamespace, env, text_value); } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for namesapce "); 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; }
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 prf_queryPackageListType_deserialize_obj( prf_queryPackageListType_t* _queryPackageListType, 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, _queryPackageListType, 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 queryPackageListType : " "NULL element can not be passed to deserialize"); return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, env); /* * building firmwareType 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, "firmwareType", "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_queryPackageListType_set_firmwareType(_queryPackageListType, 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 firmwareType"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = prf_queryPackageListType_set_firmwareType(_queryPackageListType, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for firmwareType "); 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 firmwareType missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } /* * building firmwareVersion 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, "firmwareVersion", "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_queryPackageListType_set_firmwareVersion(_queryPackageListType, 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 firmwareVersion"); status = AXIS2_FAILURE; } else { /* after all, we found this is a empty string */ status = prf_queryPackageListType_set_firmwareVersion(_queryPackageListType, env, ""); } } if(AXIS2_FAILURE == status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for firmwareVersion "); 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 firmwareVersion missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, env); element_qname = NULL; } return status; }
static axis2_svc_t * axis2_svc_client_create_annonymous_svc( axis2_svc_client_t * svc_client, const axutil_env_t * env) { /** now add anonymous operations to the axis2 service for use with the shortcut client API. NOTE: We only add the ones we know we'll use later in the convenience API; if you use this constructor then you can't expect any magic! */ axutil_qname_t *tmp_qname; axis2_svc_t *svc; axis2_op_t *op_out_in, *op_out_only, *op_robust_out_only; axis2_phases_info_t *info = NULL; tmp_qname = axutil_qname_create(env, AXIS2_ANON_SERVICE, NULL, NULL); if(!tmp_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"Error creating QName for service"); return NULL; } svc = axis2_svc_create_with_qname(env, tmp_qname); axutil_qname_free(tmp_qname, env); if(!svc) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the service"); return NULL; } tmp_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL); if(!tmp_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the QName for out-in operation"); return NULL; } op_out_in = axis2_op_create_with_qname(env, tmp_qname); axutil_qname_free(tmp_qname, env); tmp_qname = axutil_qname_create(env, AXIS2_ANON_OUT_ONLY_OP, NULL, NULL); if(!tmp_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the QName for out-only operation"); return NULL; } op_out_only = axis2_op_create_with_qname(env, tmp_qname); axutil_qname_free(tmp_qname, env); tmp_qname = axutil_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL); if(!tmp_qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the QName for robust-out-only operation"); return NULL; } op_robust_out_only = axis2_op_create_with_qname(env, tmp_qname); axutil_qname_free(tmp_qname, env); if(!op_out_in || !op_out_only || !op_robust_out_only) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); if(op_out_in) { axis2_op_free(op_out_in, env); } if(op_out_only) { axis2_op_free(op_out_only, env); } if(op_robust_out_only) { axis2_op_free(op_robust_out_only, env); } return NULL; } axis2_op_set_msg_exchange_pattern(op_out_in, env, AXIS2_MEP_URI_OUT_IN); axis2_op_set_msg_exchange_pattern(op_out_only, env, AXIS2_MEP_URI_OUT_ONLY); axis2_op_set_msg_exchange_pattern(op_robust_out_only, env, AXIS2_MEP_URI_ROBUST_OUT_ONLY); /* Setting operation phase */ info = axis2_conf_get_phases_info(svc_client->conf, env); axis2_phases_info_set_op_phases(info, env, op_out_in); axis2_phases_info_set_op_phases(info, env, op_out_only); axis2_phases_info_set_op_phases(info, env, op_robust_out_only); axis2_svc_add_op(svc, env, op_out_in); axis2_svc_add_op(svc, env, op_out_only); axis2_svc_add_op(svc, env, op_robust_out_only); return svc; }