AXIS2_EXTERN axis2_svc_t *AXIS2_CALL axis2_svc_create_with_qname( const axutil_env_t * env, const axutil_qname_t * qname) { axis2_svc_t *svc = NULL; axis2_status_t status = AXIS2_FAILURE; AXIS2_PARAM_CHECK(env->error, qname, NULL); svc = axis2_svc_create(env); if(!svc) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service creation failed for name %s", axutil_qname_get_localpart(qname, env)); return NULL; } status = axis2_svc_set_qname(svc, env, qname); if(AXIS2_FAILURE == status) { axis2_svc_free(svc, env); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Setting name %s to service failed", axutil_qname_get_localpart(qname, env)); return NULL; } return svc; }
/** * Checks whether given node is having same name and namespace as given * @param env Environment. Must not be null * @param node node to be checked for name and namespace * @param name local name to be checked against given node * @param ns namespace to be checked against given node. Can be null. If null, will be omitted * @return AXIS2_TRUE if given name/ns is same as in the node. AXIS2_FALSE otherwise. */ AXIS2_EXTERN axis2_bool_t AXIS2_CALL oxs_axiom_check_node_name( const axutil_env_t *env, axiom_node_t* node, axis2_char_t* name, axis2_char_t* ns) { axiom_element_t * ele = NULL; axis2_char_t* namestr = NULL; axis2_char_t* ns_str = NULL; axutil_qname_t* qname = NULL; ele = axiom_node_get_data_element(node, env); qname = axiom_element_get_qname(ele, env, node); namestr = axutil_qname_get_localpart(qname, env); if(axutil_strcmp(namestr, name)) { return AXIS2_FALSE; } if(ns) { ns_str = axutil_qname_get_uri(qname, env); if(axutil_strcmp(ns_str, ns)) { return AXIS2_FALSE; } } return AXIS2_TRUE; }
axis2_op_t *AXIS2_CALL axis2_req_uri_disp_find_op( axis2_msg_ctx_t * msg_ctx, const axutil_env_t * env, axis2_svc_t * svc) { axis2_endpoint_ref_t *endpoint_ref = NULL; axis2_op_t *op = NULL; AXIS2_PARAM_CHECK(env->error, svc, NULL); if(axis2_msg_ctx_get_doing_rest(msg_ctx, env)) return NULL; endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env); if(endpoint_ref) { const axis2_char_t *address = NULL; address = axis2_endpoint_ref_get_address(endpoint_ref, env); if(address) { axis2_char_t **url_tokens = NULL; url_tokens = axutil_parse_request_url_for_svc_and_op(env, address); if(url_tokens) { if(url_tokens[1]) { axutil_qname_t *op_qname = NULL; AXIS2_LOG_DEBUG( env->log, AXIS2_LOG_SI, "Checking for operation using \ target endpoint uri fragment : %s", url_tokens[1]); op_qname = axutil_qname_create(env, url_tokens[1], NULL, NULL); op = axis2_svc_get_op_with_name(svc, env, axutil_qname_get_localpart(op_qname, env)); axutil_qname_free(op_qname, env); if(op) AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Operation found using target endpoint uri fragment"); } if(url_tokens[0]) AXIS2_FREE(env->allocator, url_tokens[0]); if(url_tokens[1]) AXIS2_FREE(env->allocator, url_tokens[1]); AXIS2_FREE(env->allocator, url_tokens); } } } return op; }
axis2_status_t AXIS2_CALL axis2_statistics_admin_out_op_count_handler_invoke(struct axis2_handler *handler, const axutil_env_t *env, struct axis2_msg_ctx *msg_ctx) { axis2_status_t status = AXIS2_SUCCESS; service_admin_counter_t *counter = NULL; axutil_param_t *param = NULL; axis2_op_t *op = NULL; axis2_svc_t *svc = NULL; const axis2_char_t *svc_name = NULL; AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[adminservices] Start:axis2_statistics_admin_out_op_count_handler_invoke"); AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE); svc = axis2_msg_ctx_get_svc(msg_ctx, env); if(svc) { svc_name = axis2_svc_get_name(svc, env); } op = axis2_msg_ctx_get_op(msg_ctx, env); if(op) { param = axis2_op_get_param(op, env, AXIS2_OUT_OPERATION_COUNTER); if(param) { counter = axutil_param_get_value(param, env); if(counter) { service_admin_counter_increment(counter, env, msg_ctx); } } else { axis2_char_t *op_name = NULL; op_name = axutil_qname_get_localpart(axis2_op_get_qname(op, env), env); axutil_allocator_switch_to_global_pool(env->allocator); counter = service_admin_counter_create(env, svc_name, op_name); if(counter) { service_admin_counter_increment(counter, env, msg_ctx); param = axutil_param_create(env, AXIS2_OUT_OPERATION_COUNTER, counter); if(param) { axis2_op_add_param(op, env, param); } } axutil_allocator_switch_to_local_pool(env->allocator); } } AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[adminservices] End:axis2_statistics_admin_out_op_count_handler_invoke"); return status; }
/* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL rm_sample_svc_invoke( axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *node, axis2_msg_ctx_t *msg_ctx) { axis2_op_t *op = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; op = axis2_msg_ctx_get_op(msg_ctx, env); if(op) { op_qname = (axutil_qname_t *)axis2_op_get_qname(op, env); if(op_qname) { op_name = axutil_qname_get_localpart(op_qname, env); } if(op_name) { axis2_endpoint_ref_t* to_epr = NULL; to_epr = axis2_msg_ctx_get_to(msg_ctx, env); if (to_epr) { const axis2_char_t* to_address = NULL; to_address = axis2_endpoint_ref_get_address(to_epr, env); if (to_address && strstr(to_address, AXIS2_ANON_SERVICE)) { axis2_msg_ctx_set_wsa_action(msg_ctx, env, AXIS2_ANON_OUT_IN_OP); } } if (!axutil_strcmp(op_name, "echoString")) { return rm_sample_svc_echo(env, node); } if (!axutil_strcmp(op_name, "ping")) { rm_sample_svc_ping(env, node); return NULL; } if (!axutil_strcmp(op_name, "mtomSample")) { return rm_sample_svc_mtom(env, node, msg_ctx); } } } return NULL; }
/** * Auxiliary function to determine an ADB object type from its Axiom node. * @param env pointer to environment struct * @param node double pointer to the parent node to deserialize * @return type name on success, else NULL */ axis2_char_t *AXIS2_CALL axis2_extension_mapper_type_from_node( const axutil_env_t *env, axiom_node_t** node) { axiom_node_t *parent = *node; axutil_qname_t *element_qname = NULL; axiom_element_t *element = NULL; axutil_hash_index_t *hi; void *val; axiom_attribute_t *type_attr; axutil_hash_t *ht; axis2_char_t *temp; axis2_char_t *type; 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 : " "NULL elemenet can not be passed to deserialize"); return AXIS2_FAILURE; } element = (axiom_element_t *)axiom_node_get_data_element(parent, env); ht = axiom_element_get_all_attributes(element, env); if (ht == NULL) return NULL; for (hi = axutil_hash_first(ht, env); hi; hi = axutil_hash_next(env, hi)) { axis2_char_t *localpart; axutil_hash_this(hi, NULL, NULL, &val); type_attr = (axiom_attribute_t *)val; localpart = axutil_qname_get_localpart(axiom_attribute_get_qname(type_attr, env), env); if (axutil_strcmp(localpart, "type") == 0) break; } type = axiom_attribute_get_value(type_attr, env); if (type != NULL && (temp = axutil_strchr(type, ':')) != NULL) { if (axutil_strchr(temp, ':') != NULL) type = temp + 1; /* Pointer arithmetic */ } return type; }
AXIS2_EXTERN const axis2_char_t *AXIS2_CALL axis2_svc_get_name( const axis2_svc_t * svc, const axutil_env_t * env) { if(svc->qname) { return axutil_qname_get_localpart(svc->qname, env); } return NULL; }
axis2_bool_t axis2_addr_in_check_element( const axutil_env_t * env, axutil_qname_t * expected_qname, axutil_qname_t * actual_qname) { axis2_char_t *exp_qn_lpart = NULL; axis2_char_t *act_qn_lpart = NULL; axis2_char_t *exp_qn_nsuri = NULL; axis2_char_t *act_qn_nsuri = NULL; AXIS2_PARAM_CHECK(env->error, expected_qname, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, actual_qname, AXIS2_FAILURE); exp_qn_lpart = axutil_qname_get_localpart(expected_qname, env); act_qn_lpart = axutil_qname_get_localpart(actual_qname, env); exp_qn_nsuri = axutil_qname_get_localpart(expected_qname, env); act_qn_nsuri = axutil_qname_get_localpart(actual_qname, env); return ((!axutil_strcmp(exp_qn_lpart, act_qn_lpart)) && (!axutil_strcmp(exp_qn_nsuri, act_qn_nsuri))); }
static axis2_bool_t AXIS2_CALL axiom_soap_header_qname_matches( const axutil_env_t * env, axutil_qname_t * element_qname, axutil_qname_t * qname_to_match) { int lparts_match = 0; int uris_match = 0; axis2_char_t *ele_lpart = NULL; axis2_char_t *match_lpart = NULL; axis2_char_t *ele_nsuri = NULL; axis2_char_t *match_nsuri = NULL; if(!(qname_to_match)) { return AXIS2_TRUE; } if(qname_to_match) { match_lpart = axutil_qname_get_localpart(qname_to_match, env); match_nsuri = axutil_qname_get_uri(qname_to_match, env); } if(element_qname) { ele_lpart = axutil_qname_get_localpart(element_qname, env); ele_nsuri = axutil_qname_get_uri(element_qname, env); } lparts_match = (!match_lpart || (axutil_strcmp(match_lpart, "") == 0) || (element_qname && (axutil_strcmp(ele_lpart, match_lpart) == 0))); uris_match = (!match_nsuri || (axutil_strcmp(match_nsuri, "") == 0) || (element_qname && (axutil_strcmp(ele_nsuri, match_nsuri) == 0))); return lparts_match && uris_match; }
/** * Traverse thru the node and its descendents. Check if the node has a particular attribute with * qname as in @qname. Returns the attribute value. * @param env Environment. MUST NOT be NULL, * @param node the node to be searched * @param qname the qname of the attribute * @return the attribute value if found, else NULL */ AXIS2_EXTERN axis2_char_t* AXIS2_CALL oxs_axiom_get_attribute_val_of_node_by_qname( const axutil_env_t *env, axiom_node_t *node, axutil_qname_t *qname) { axis2_char_t *local_name = NULL; axis2_char_t *ns_uri = NULL; /* Get localname of the qname */ local_name = axutil_qname_get_localpart(qname, env); /* Get namespace uri of the qname */ ns_uri = axutil_qname_get_uri(qname, env); return oxs_axiom_get_attribute_value_of_node_by_name(env, node, local_name, ns_uri); }
/* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL savan_subs_mgr_svc_invoke( axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *node, axis2_msg_ctx_t *msg_ctx) { /* Invoke the business logic. * Depending on the function name invoke the correct impl method. */ axis2_op_t *op = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; op = axis2_msg_ctx_get_op(msg_ctx, env); if(op) { op_qname = (axutil_qname_t *)axis2_op_get_qname(op, env); if(op_qname) op_name = axutil_qname_get_localpart(op_qname, env); if(op_name) { if (axutil_strcmp(op_name, "add_subscriber") == 0) return savan_subs_mgr_svc_add_subscriber(env, node, msg_ctx); if (axutil_strcmp(op_name, "remove_subscriber") == 0) return savan_subs_mgr_svc_remove_subscriber(env, node, msg_ctx); if (axutil_strcmp(op_name, "get_subscriber") == 0) return savan_subs_mgr_svc_get_subscriber(env, node, msg_ctx); if (axutil_strcmp(op_name, "get_subscriber_list") == 0) return savan_subs_mgr_svc_get_subscriber_list(env, node, msg_ctx); if (axutil_strcmp(op_name, "get_topic_list") == 0) return savan_subs_mgr_svc_get_topic_list(env, node, msg_ctx); /*if (axutil_strcmp(op_name, "add_topic") == 0) return savan_subs_mgr_svc_add_topic(env, node, msg_ctx);*/ } } return NULL; }
/** * Private function implementations */ static axis2_char_t * wsf_xml_msg_recv_get_method_name( axis2_msg_ctx_t * msg_ctx, const axutil_env_t * env) { axis2_op_ctx_t *op_ctx = NULL; axis2_op_t *op = NULL; const axutil_qname_t *qname = NULL; axis2_char_t *name = NULL; op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); if (!op_ctx) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[wsfphp] Operation Context is not found"); return NULL; } op = axis2_op_ctx_get_op(op_ctx, env); if (!op) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[wsfphp] Operation is not found"); return NULL; } qname = axis2_op_get_qname(op, env); if (!qname) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[wsfphp] Operation QName is not found"); return NULL; } name = axutil_qname_get_localpart(qname, env); return name; }
/* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL axis2_svc_skel_SecurityAdminService_invoke(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *content_node, axis2_msg_ctx_t *msg_ctx) { /* depending on the function name invoke the * corresponding method */ axis2_op_ctx_t *operation_ctx = NULL; axis2_op_t *operation = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; axis2_msg_ctx_t *in_msg_ctx = NULL; axiom_soap_envelope_t *req_soap_env = NULL; axiom_soap_header_t *req_soap_header = NULL; axiom_soap_envelope_t *res_soap_env = NULL; axiom_soap_header_t *res_soap_header = NULL; axiom_node_t *ret_node = NULL; axiom_node_t *input_header = NULL; axiom_node_t *output_header = NULL; axiom_node_t *header_base_node = NULL; axis2_svc_skel_SecurityAdminService_t *svc_skeleton_wrapper = NULL; adb_getScenariosResponse_t* ret_val1; adb_getScenarios_t* input_val1; axis2_status_t ret_val2; adb_applySecurity_t* input_val2; axis2_status_t ret_val3; adb_activateUsernameTokenAuthentication_t* input_val3; axis2_status_t ret_val4; adb_disableSecurityOnService_t* input_val4; adb_getSecurityConfigDataResponse_t* ret_val5; adb_getSecurityConfigData_t* input_val5; adb_getSecurityScenarioResponse_t* ret_val6; adb_getSecurityScenario_t* input_val6; svc_skeleton_wrapper = (axis2_svc_skel_SecurityAdminService_t*)svc_skeleton; operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); operation = axis2_op_ctx_get_op(operation_ctx, env); op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env); op_name = axutil_qname_get_localpart(op_qname, env); if (op_name) { if ( axutil_strcmp(op_name, "getScenarios") == 0 ) { input_val1 = adb_getScenarios_create( env); if( AXIS2_FAILURE == adb_getScenarios_deserialize(input_val1, env, &content_node, NULL, AXIS2_FALSE)) { adb_getScenarios_free(input_val1, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getScenarios_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val1 = axis2_skel_SecurityAdminService_getScenarios(env, msg_ctx,input_val1, (axis2_skel_SecurityAdminService_getScenarios_fault*)&(svc_skeleton_wrapper->fault)); if ( NULL == ret_val1 ) { adb_getScenarios_free(input_val1, env); return NULL; } ret_node = adb_getScenariosResponse_serialize(ret_val1, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getScenariosResponse_free(ret_val1, env); adb_getScenarios_free(input_val1, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "applySecurity") == 0 ) { input_val2 = adb_applySecurity_create( env); if( AXIS2_FAILURE == adb_applySecurity_deserialize(input_val2, env, &content_node, NULL, AXIS2_FALSE)) { adb_applySecurity_free(input_val2, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_applySecurity_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val2 = axis2_skel_SecurityAdminService_applySecurity(env, msg_ctx,input_val2, (axis2_skel_SecurityAdminService_applySecurity_fault*)&(svc_skeleton_wrapper->fault)); if( AXIS2_FAILURE == ret_val2 ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from applySecurity "); } adb_applySecurity_free(input_val2, env); /* since this has no output params it just returns NULL */ return NULL; } if ( axutil_strcmp(op_name, "activateUsernameTokenAuthentication") == 0 ) { input_val3 = adb_activateUsernameTokenAuthentication_create( env); if( AXIS2_FAILURE == adb_activateUsernameTokenAuthentication_deserialize(input_val3, env, &content_node, NULL, AXIS2_FALSE)) { adb_activateUsernameTokenAuthentication_free(input_val3, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_activateUsernameTokenAuthentication_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val3 = axis2_skel_SecurityAdminService_activateUsernameTokenAuthentication(env, msg_ctx,input_val3, (axis2_skel_SecurityAdminService_activateUsernameTokenAuthentication_fault*)&(svc_skeleton_wrapper->fault)); if( AXIS2_FAILURE == ret_val3 ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from activateUsernameTokenAuthentication "); } adb_activateUsernameTokenAuthentication_free(input_val3, env); /* since this has no output params it just returns NULL */ return NULL; } if ( axutil_strcmp(op_name, "disableSecurityOnService") == 0 ) { input_val4 = adb_disableSecurityOnService_create( env); if( AXIS2_FAILURE == adb_disableSecurityOnService_deserialize(input_val4, env, &content_node, NULL, AXIS2_FALSE)) { adb_disableSecurityOnService_free(input_val4, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_disableSecurityOnService_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val4 = axis2_skel_SecurityAdminService_disableSecurityOnService(env, msg_ctx,input_val4, (axis2_skel_SecurityAdminService_disableSecurityOnService_fault*)&(svc_skeleton_wrapper->fault)); if( AXIS2_FAILURE == ret_val4 ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from disableSecurityOnService "); } adb_disableSecurityOnService_free(input_val4, env); /* since this has no output params it just returns NULL */ return NULL; } if ( axutil_strcmp(op_name, "getSecurityConfigData") == 0 ) { input_val5 = adb_getSecurityConfigData_create( env); if( AXIS2_FAILURE == adb_getSecurityConfigData_deserialize(input_val5, env, &content_node, NULL, AXIS2_FALSE)) { adb_getSecurityConfigData_free(input_val5, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getSecurityConfigData_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val5 = axis2_skel_SecurityAdminService_getSecurityConfigData(env, msg_ctx,input_val5, (axis2_skel_SecurityAdminService_getSecurityConfigData_fault*)&(svc_skeleton_wrapper->fault)); if ( NULL == ret_val5 ) { adb_getSecurityConfigData_free(input_val5, env); return NULL; } ret_node = adb_getSecurityConfigDataResponse_serialize(ret_val5, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getSecurityConfigDataResponse_free(ret_val5, env); adb_getSecurityConfigData_free(input_val5, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getSecurityScenario") == 0 ) { input_val6 = adb_getSecurityScenario_create( env); if( AXIS2_FAILURE == adb_getSecurityScenario_deserialize(input_val6, env, &content_node, NULL, AXIS2_FALSE)) { adb_getSecurityScenario_free(input_val6, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getSecurityScenario_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val6 = axis2_skel_SecurityAdminService_getSecurityScenario(env, msg_ctx,input_val6, (axis2_skel_SecurityAdminService_getSecurityScenario_fault*)&(svc_skeleton_wrapper->fault)); if ( NULL == ret_val6 ) { adb_getSecurityScenario_free(input_val6, env); return NULL; } ret_node = adb_getSecurityScenarioResponse_serialize(ret_val6, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getSecurityScenarioResponse_free(ret_val6, env); adb_getSecurityScenario_free(input_val6, env); return ret_node; /* since this has no output params it just returns NULL */ } } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2_svc_skel_SecurityAdminService service ERROR: invalid OM parameters in request\n"); return NULL; }
AXIS2_EXTERN axis2_svc_grp_ctx_t *AXIS2_CALL axis2_conf_ctx_fill_ctxs( axis2_conf_ctx_t * conf_ctx, const axutil_env_t * env, axis2_msg_ctx_t * msg_ctx) { axis2_char_t *svc_grp_ctx_id = NULL; axis2_svc_grp_ctx_t *svc_grp_ctx = NULL; axis2_svc_ctx_t *svc_ctx = NULL; axis2_svc_t *svc = NULL; axis2_svc_grp_t *svc_grp = NULL; const axutil_qname_t *qname = NULL; axis2_char_t *svc_id = NULL; axis2_op_ctx_t *op_ctx = NULL; AXIS2_PARAM_CHECK(env->error, msg_ctx, NULL); svc = axis2_msg_ctx_get_svc(msg_ctx, env); if(!svc) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SERVICE_NOT_YET_FOUND, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service not yet found in message context. Cannot proceed"); return NULL; } qname = axis2_svc_get_qname(svc, env); if(!qname) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service found in message context has no name."); return NULL; } svc_id = axutil_qname_get_localpart(qname, env); if(!svc_id) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service found in message context has no name."); return NULL; } svc_grp = axis2_svc_get_parent(svc, env); if(svc_grp) { svc_grp_ctx_id = (axis2_char_t *)axis2_svc_grp_get_name(svc_grp, env); } if(!svc_grp_ctx_id) { svc_grp_ctx_id = (axis2_char_t *)axutil_string_get_buffer(axis2_msg_ctx_get_svc_grp_ctx_id( msg_ctx, env), env); } /* By this time service group context id must have a value, either from transport or from * addressing */ if(svc_grp_ctx_id) { svc_grp_ctx = (axis2_svc_grp_ctx_t *)axutil_hash_get(conf_ctx->svc_grp_ctx_map, svc_grp_ctx_id, AXIS2_HASH_KEY_STRING); if(svc_grp_ctx) { svc_ctx = axis2_svc_grp_ctx_get_svc_ctx(svc_grp_ctx, env, svc_id); if(!svc_ctx) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC_GRP, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service group context has no servie context set for service %s", svc_id); return NULL; } } } if(!svc_grp_ctx_id) { svc_grp_ctx_id = axutil_uuid_gen(env); if(svc_grp_ctx_id) { axutil_string_t *svc_grp_ctx_id_str = axutil_string_create_assume_ownership(env, &svc_grp_ctx_id); axis2_msg_ctx_set_svc_grp_ctx_id(msg_ctx, env, svc_grp_ctx_id_str); axutil_string_free(svc_grp_ctx_id_str, env); } } if(!svc_grp_ctx) { axis2_svc_grp_t *svc_group; svc_group = axis2_svc_get_parent(svc, env); svc_grp_ctx = axis2_svc_grp_get_svc_grp_ctx(svc_group, env, conf_ctx); svc_ctx = axis2_svc_grp_ctx_get_svc_ctx(svc_grp_ctx, env, svc_id); if(!svc_ctx) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC_GRP, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service group context has no servie context set for service %s", svc_id); return NULL; } axis2_svc_grp_ctx_set_id(svc_grp_ctx, env, svc_grp_ctx_id); axis2_conf_ctx_register_svc_grp_ctx(conf_ctx, env, svc_grp_ctx_id, svc_grp_ctx); } /* When you come here operation context MUST have already been assigned to the message context */ op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); if(!op_ctx) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_MSG_CTX, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Operation context not set for message context"); return NULL; } axis2_op_ctx_set_parent(op_ctx, env, svc_ctx); axis2_msg_ctx_set_svc_ctx(msg_ctx, env, svc_ctx); axis2_msg_ctx_set_svc_grp_ctx(msg_ctx, env, svc_grp_ctx); return svc_grp_ctx; }
/* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL axis2_svc_skel_IIp2Location_invoke(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *content_node, axis2_msg_ctx_t *msg_ctx) { /* depending on the function name invoke the * corresponding method */ axis2_op_ctx_t *operation_ctx = NULL; axis2_op_t *operation = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; axis2_msg_ctx_t *in_msg_ctx = NULL; axiom_soap_envelope_t *req_soap_env = NULL; axiom_soap_header_t *req_soap_header = NULL; axiom_soap_envelope_t *res_soap_env = NULL; axiom_soap_header_t *res_soap_header = NULL; axiom_node_t *ret_node = NULL; axiom_node_t *input_header = NULL; axiom_node_t *output_header = NULL; axiom_node_t *header_base_node = NULL; axis2_svc_skel_IIp2Location_t *svc_skeleton_wrapper = NULL; adb_getResponse_t* ret_val1; adb_get_t* input_val1; axis2_status_t ret_val2; adb_add_t* input_val2; svc_skeleton_wrapper = (axis2_svc_skel_IIp2Location_t*)svc_skeleton; operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); operation = axis2_op_ctx_get_op(operation_ctx, env); op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env); op_name = axutil_qname_get_localpart(op_qname, env); if (op_name) { if ( axutil_strcmp(op_name, "get") == 0 ) { input_val1 = adb_get_create( env); if( AXIS2_FAILURE == adb_get_deserialize(input_val1, env, &content_node, NULL, AXIS2_FALSE)) { adb_get_free(input_val1, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_get_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val1 = axis2_skel_IIp2Location_get(env, msg_ctx,input_val1); if ( NULL == ret_val1 ) { adb_get_free(input_val1, env); return NULL; } ret_node = adb_getResponse_serialize(ret_val1, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getResponse_free(ret_val1, env); adb_get_free(input_val1, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "add") == 0 ) { input_val2 = adb_add_create( env); if( AXIS2_FAILURE == adb_add_deserialize(input_val2, env, &content_node, NULL, AXIS2_FALSE)) { adb_add_free(input_val2, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_add_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val2 = axis2_skel_IIp2Location_add(env, msg_ctx,input_val2); if( AXIS2_FAILURE == ret_val2 ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from add "); } adb_add_free(input_val2, env); /* since this has no output params it just returns NULL */ return NULL; } } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2_svc_skel_IIp2Location service ERROR: invalid OM parameters in request\n"); return NULL; }
/* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL axis2_svc_skel_LoggingAdmin_invoke(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *content_node, axis2_msg_ctx_t *msg_ctx) { /* depending on the function name invoke the * corresponding method */ axis2_op_ctx_t *operation_ctx = NULL; axis2_op_t *operation = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; axis2_msg_ctx_t *in_msg_ctx = NULL; axiom_soap_envelope_t *req_soap_env = NULL; axiom_soap_header_t *req_soap_header = NULL; axiom_soap_envelope_t *res_soap_env = NULL; axiom_soap_header_t *res_soap_header = NULL; axiom_node_t *ret_node = NULL; axiom_node_t *input_header = NULL; axiom_node_t *output_header = NULL; axiom_node_t *header_base_node = NULL; axis2_svc_skel_LoggingAdmin_t *svc_skeleton_wrapper = NULL; adb_getAllLoggerDataResponse_t* ret_val1; adb_getAllLoggerData_t* input_val1; axis2_status_t ret_val2; axis2_status_t ret_val3; adb_updateSystemLog_t* input_val3; adb_getSystemLogResponse_t* ret_val4; adb_getAppenderDataResponse_t* ret_val5; adb_getAppenderData_t* input_val5; axis2_status_t ret_val6; adb_updateAllAppenderData_t* input_val6; adb_getLoggerDataResponse_t* ret_val7; adb_getLoggerData_t* input_val7; axis2_status_t ret_val8; adb_updateLoggerData_t* input_val8; svc_skeleton_wrapper = (axis2_svc_skel_LoggingAdmin_t*)svc_skeleton; operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); operation = axis2_op_ctx_get_op(operation_ctx, env); op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env); op_name = axutil_qname_get_localpart(op_qname, env); if (op_name) { if ( axutil_strcmp(op_name, "getAllLoggerData") == 0 ) { input_val1 = adb_getAllLoggerData_create( env); if( AXIS2_FAILURE == adb_getAllLoggerData_deserialize(input_val1, env, &content_node, NULL, AXIS2_FALSE)) { adb_getAllLoggerData_free(input_val1, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getAllLoggerData_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val1 = axis2_skel_LoggingAdmin_getAllLoggerData(env, msg_ctx,input_val1); if ( NULL == ret_val1 ) { adb_getAllLoggerData_free(input_val1, env); return NULL; } ret_node = adb_getAllLoggerDataResponse_serialize(ret_val1, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getAllLoggerDataResponse_free(ret_val1, env); adb_getAllLoggerData_free(input_val1, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "restoreDefaults") == 0 ) { ret_val2 = axis2_skel_LoggingAdmin_restoreDefaults(env, msg_ctx, (axis2_skel_LoggingAdmin_restoreDefaults_fault*)&(svc_skeleton_wrapper->fault)); if( AXIS2_FAILURE == ret_val2 ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from restoreDefaults "); } /* since this has no output params it just returns NULL */ return NULL; } if ( axutil_strcmp(op_name, "updateSystemLog") == 0 ) { input_val3 = adb_updateSystemLog_create( env); if( AXIS2_FAILURE == adb_updateSystemLog_deserialize(input_val3, env, &content_node, NULL, AXIS2_FALSE)) { adb_updateSystemLog_free(input_val3, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_updateSystemLog_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val3 = axis2_skel_LoggingAdmin_updateSystemLog(env, msg_ctx,input_val3, (axis2_skel_LoggingAdmin_updateSystemLog_fault*)&(svc_skeleton_wrapper->fault)); if( AXIS2_FAILURE == ret_val3 ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from updateSystemLog "); } adb_updateSystemLog_free(input_val3, env); /* since this has no output params it just returns NULL */ return NULL; } if ( axutil_strcmp(op_name, "getSystemLog") == 0 ) { ret_val4 = axis2_skel_LoggingAdmin_getSystemLog(env, msg_ctx, (axis2_skel_LoggingAdmin_getSystemLog_fault*)&(svc_skeleton_wrapper->fault)); if ( NULL == ret_val4 ) { return NULL; } ret_node = adb_getSystemLogResponse_serialize(ret_val4, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getSystemLogResponse_free(ret_val4, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getAppenderData") == 0 ) { input_val5 = adb_getAppenderData_create( env); if( AXIS2_FAILURE == adb_getAppenderData_deserialize(input_val5, env, &content_node, NULL, AXIS2_FALSE)) { adb_getAppenderData_free(input_val5, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getAppenderData_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val5 = axis2_skel_LoggingAdmin_getAppenderData(env, msg_ctx,input_val5); if ( NULL == ret_val5 ) { adb_getAppenderData_free(input_val5, env); return NULL; } ret_node = adb_getAppenderDataResponse_serialize(ret_val5, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getAppenderDataResponse_free(ret_val5, env); adb_getAppenderData_free(input_val5, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "updateAllAppenderData") == 0 ) { input_val6 = adb_updateAllAppenderData_create( env); if( AXIS2_FAILURE == adb_updateAllAppenderData_deserialize(input_val6, env, &content_node, NULL, AXIS2_FALSE)) { adb_updateAllAppenderData_free(input_val6, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_updateAllAppenderData_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val6 = axis2_skel_LoggingAdmin_updateAllAppenderData(env, msg_ctx,input_val6, (axis2_skel_LoggingAdmin_updateAllAppenderData_fault*)&(svc_skeleton_wrapper->fault)); if( AXIS2_FAILURE == ret_val6 ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from updateAllAppenderData "); } adb_updateAllAppenderData_free(input_val6, env); /* since this has no output params it just returns NULL */ return NULL; } if ( axutil_strcmp(op_name, "getLoggerData") == 0 ) { input_val7 = adb_getLoggerData_create( env); if( AXIS2_FAILURE == adb_getLoggerData_deserialize(input_val7, env, &content_node, NULL, AXIS2_FALSE)) { adb_getLoggerData_free(input_val7, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getLoggerData_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val7 = axis2_skel_LoggingAdmin_getLoggerData(env, msg_ctx,input_val7); if ( NULL == ret_val7 ) { adb_getLoggerData_free(input_val7, env); return NULL; } ret_node = adb_getLoggerDataResponse_serialize(ret_val7, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getLoggerDataResponse_free(ret_val7, env); adb_getLoggerData_free(input_val7, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "updateLoggerData") == 0 ) { input_val8 = adb_updateLoggerData_create( env); if( AXIS2_FAILURE == adb_updateLoggerData_deserialize(input_val8, env, &content_node, NULL, AXIS2_FALSE)) { adb_updateLoggerData_free(input_val8, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_updateLoggerData_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val8 = axis2_skel_LoggingAdmin_updateLoggerData(env, msg_ctx,input_val8, (axis2_skel_LoggingAdmin_updateLoggerData_fault*)&(svc_skeleton_wrapper->fault)); if( AXIS2_FAILURE == ret_val8 ) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from updateLoggerData "); } adb_updateLoggerData_free(input_val8, env); /* since this has no output params it just returns NULL */ return NULL; } } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2_svc_skel_LoggingAdmin service ERROR: invalid OM parameters in request\n"); return NULL; }
/* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL axis2_svc_skel_TraderExchange_invoke(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *content_node, axis2_msg_ctx_t *msg_ctx) { /* depending on the function name invoke the * corresponding method */ axis2_op_ctx_t *operation_ctx = NULL; axis2_op_t *operation = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; axiom_node_t *ret_node = NULL; axis2_status_t ret_val1 = AXIS2_SUCCESS; axis2_updateRequest_t* input_val1_1; operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); operation = axis2_op_ctx_get_op(operation_ctx, env); op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env); op_name = axutil_qname_get_localpart(op_qname, env); if (op_name) { if ( axutil_strcmp(op_name, "update") == 0 ) { input_val1_1 = axis2_updateRequest_create( env); axis2_updateRequest_deserialize(input_val1_1, env, content_node ); ret_val1 = axis2_skel_TraderExchange_update(env, input_val1_1 ); if ( AXIS2_FAILURE == ret_val1) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from update " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return axis2_svc_skel_TraderExchange_on_fault( svc_skeleton, env, NULL); } /*ret_node = axis2__serialize(ret_val1, env, NULL, AXIS2_FALSE); axis2__free(ret_val1, env); axis2_updateRequest_free(input_val1_1, env); */ return ret_node; } } printf("axis2_svc_skel_TraderExchange service ERROR: invalid OM parameters in request\n"); return content_node; }
/* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL axis2_svc_skel_StatisticsAdmin_invoke(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *content_node, axis2_msg_ctx_t *msg_ctx) { /* depending on the function name invoke the * corresponding method */ axis2_op_ctx_t *operation_ctx = NULL; axis2_op_t *operation = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; axis2_msg_ctx_t *in_msg_ctx = NULL; axiom_soap_envelope_t *req_soap_env = NULL; axiom_soap_header_t *req_soap_header = NULL; axiom_soap_envelope_t *res_soap_env = NULL; axiom_soap_header_t *res_soap_header = NULL; axiom_node_t *ret_node = NULL; axiom_node_t *input_header = NULL; axiom_node_t *output_header = NULL; axiom_node_t *header_base_node = NULL; axis2_svc_skel_StatisticsAdmin_t *svc_skeleton_wrapper = NULL; adb_getMaxServiceResponseTimeResponse_t* ret_val1; adb_getMaxServiceResponseTime_t* input_val1; adb_getServiceRequestCountResponse_t* ret_val2; adb_getServiceRequestCount_t* input_val2; adb_getSystemResponseCountResponse_t* ret_val3; adb_getOperationResponseCountResponse_t* ret_val4; adb_getOperationResponseCount_t* input_val4; adb_getAvgOperationResponseTimeResponse_t* ret_val5; adb_getAvgOperationResponseTime_t* input_val5; adb_getOperationStatisticsResponse_t* ret_val6; adb_getOperationStatistics_t* input_val6; adb_getMinSystemResponseTimeResponse_t* ret_val7; adb_getSystemFaultCountResponse_t* ret_val8; adb_getMaxSystemResponseTimeResponse_t* ret_val9; adb_getServiceFaultCountResponse_t* ret_val10; adb_getServiceFaultCount_t* input_val10; adb_getMinServiceResponseTimeResponse_t* ret_val11; adb_getMinServiceResponseTime_t* input_val11; adb_getMaxOperationResponseTimeResponse_t* ret_val12; adb_getMaxOperationResponseTime_t* input_val12; adb_getServiceStatisticsResponse_t* ret_val13; adb_getServiceStatistics_t* input_val13; adb_getOperationFaultCountResponse_t* ret_val14; adb_getOperationFaultCount_t* input_val14; adb_getAvgServiceResponseTimeResponse_t* ret_val15; adb_getAvgServiceResponseTime_t* input_val15; adb_getServiceResponseCountResponse_t* ret_val16; adb_getServiceResponseCount_t* input_val16; adb_getSystemRequestCountResponse_t* ret_val17; adb_getMinOperationResponseTimeResponse_t* ret_val18; adb_getMinOperationResponseTime_t* input_val18; adb_getAvgSystemResponseTimeResponse_t* ret_val19; adb_getSystemStatisticsResponse_t* ret_val20; adb_getOperationRequestCountResponse_t* ret_val21; adb_getOperationRequestCount_t* input_val21; svc_skeleton_wrapper = (axis2_svc_skel_StatisticsAdmin_t*)svc_skeleton; operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); operation = axis2_op_ctx_get_op(operation_ctx, env); op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env); op_name = axutil_qname_get_localpart(op_qname, env); if (op_name) { if ( axutil_strcmp(op_name, "getMaxServiceResponseTime") == 0 ) { input_val1 = adb_getMaxServiceResponseTime_create( env); if( AXIS2_FAILURE == adb_getMaxServiceResponseTime_deserialize(input_val1, env, &content_node, NULL, AXIS2_FALSE)) { adb_getMaxServiceResponseTime_free(input_val1, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getMaxServiceResponseTime_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val1 = axis2_skel_StatisticsAdmin_getMaxServiceResponseTime(env, msg_ctx,input_val1); if ( NULL == ret_val1 ) { adb_getMaxServiceResponseTime_free(input_val1, env); return NULL; } ret_node = adb_getMaxServiceResponseTimeResponse_serialize(ret_val1, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getMaxServiceResponseTimeResponse_free(ret_val1, env); adb_getMaxServiceResponseTime_free(input_val1, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getServiceRequestCount") == 0 ) { input_val2 = adb_getServiceRequestCount_create( env); if( AXIS2_FAILURE == adb_getServiceRequestCount_deserialize(input_val2, env, &content_node, NULL, AXIS2_FALSE)) { adb_getServiceRequestCount_free(input_val2, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getServiceRequestCount_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val2 = axis2_skel_StatisticsAdmin_getServiceRequestCount(env, msg_ctx,input_val2); if ( NULL == ret_val2 ) { adb_getServiceRequestCount_free(input_val2, env); return NULL; } ret_node = adb_getServiceRequestCountResponse_serialize(ret_val2, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getServiceRequestCountResponse_free(ret_val2, env); adb_getServiceRequestCount_free(input_val2, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getSystemResponseCount") == 0 ) { ret_val3 = axis2_skel_StatisticsAdmin_getSystemResponseCount(env, msg_ctx); if ( NULL == ret_val3 ) { return NULL; } ret_node = adb_getSystemResponseCountResponse_serialize(ret_val3, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getSystemResponseCountResponse_free(ret_val3, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getOperationResponseCount") == 0 ) { input_val4 = adb_getOperationResponseCount_create( env); if( AXIS2_FAILURE == adb_getOperationResponseCount_deserialize(input_val4, env, &content_node, NULL, AXIS2_FALSE)) { adb_getOperationResponseCount_free(input_val4, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getOperationResponseCount_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val4 = axis2_skel_StatisticsAdmin_getOperationResponseCount(env, msg_ctx,input_val4); if ( NULL == ret_val4 ) { adb_getOperationResponseCount_free(input_val4, env); return NULL; } ret_node = adb_getOperationResponseCountResponse_serialize(ret_val4, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getOperationResponseCountResponse_free(ret_val4, env); adb_getOperationResponseCount_free(input_val4, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getAvgOperationResponseTime") == 0 ) { input_val5 = adb_getAvgOperationResponseTime_create( env); if( AXIS2_FAILURE == adb_getAvgOperationResponseTime_deserialize(input_val5, env, &content_node, NULL, AXIS2_FALSE)) { adb_getAvgOperationResponseTime_free(input_val5, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getAvgOperationResponseTime_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val5 = axis2_skel_StatisticsAdmin_getAvgOperationResponseTime(env, msg_ctx,input_val5); if ( NULL == ret_val5 ) { adb_getAvgOperationResponseTime_free(input_val5, env); return NULL; } ret_node = adb_getAvgOperationResponseTimeResponse_serialize(ret_val5, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getAvgOperationResponseTimeResponse_free(ret_val5, env); adb_getAvgOperationResponseTime_free(input_val5, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getOperationStatistics") == 0 ) { input_val6 = adb_getOperationStatistics_create( env); if( AXIS2_FAILURE == adb_getOperationStatistics_deserialize(input_val6, env, &content_node, NULL, AXIS2_FALSE)) { adb_getOperationStatistics_free(input_val6, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getOperationStatistics_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val6 = axis2_skel_StatisticsAdmin_getOperationStatistics(env, msg_ctx,input_val6); if ( NULL == ret_val6 ) { adb_getOperationStatistics_free(input_val6, env); return NULL; } ret_node = adb_getOperationStatisticsResponse_serialize(ret_val6, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getOperationStatisticsResponse_free(ret_val6, env); adb_getOperationStatistics_free(input_val6, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getMinSystemResponseTime") == 0 ) { ret_val7 = axis2_skel_StatisticsAdmin_getMinSystemResponseTime(env, msg_ctx); if ( NULL == ret_val7 ) { return NULL; } ret_node = adb_getMinSystemResponseTimeResponse_serialize(ret_val7, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getMinSystemResponseTimeResponse_free(ret_val7, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getSystemFaultCount") == 0 ) { ret_val8 = axis2_skel_StatisticsAdmin_getSystemFaultCount(env, msg_ctx); if ( NULL == ret_val8 ) { return NULL; } ret_node = adb_getSystemFaultCountResponse_serialize(ret_val8, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getSystemFaultCountResponse_free(ret_val8, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getMaxSystemResponseTime") == 0 ) { ret_val9 = axis2_skel_StatisticsAdmin_getMaxSystemResponseTime(env, msg_ctx); if ( NULL == ret_val9 ) { return NULL; } ret_node = adb_getMaxSystemResponseTimeResponse_serialize(ret_val9, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getMaxSystemResponseTimeResponse_free(ret_val9, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getServiceFaultCount") == 0 ) { input_val10 = adb_getServiceFaultCount_create( env); if( AXIS2_FAILURE == adb_getServiceFaultCount_deserialize(input_val10, env, &content_node, NULL, AXIS2_FALSE)) { adb_getServiceFaultCount_free(input_val10, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getServiceFaultCount_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val10 = axis2_skel_StatisticsAdmin_getServiceFaultCount(env, msg_ctx,input_val10); if ( NULL == ret_val10 ) { adb_getServiceFaultCount_free(input_val10, env); return NULL; } ret_node = adb_getServiceFaultCountResponse_serialize(ret_val10, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getServiceFaultCountResponse_free(ret_val10, env); adb_getServiceFaultCount_free(input_val10, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getMinServiceResponseTime") == 0 ) { input_val11 = adb_getMinServiceResponseTime_create( env); if( AXIS2_FAILURE == adb_getMinServiceResponseTime_deserialize(input_val11, env, &content_node, NULL, AXIS2_FALSE)) { adb_getMinServiceResponseTime_free(input_val11, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getMinServiceResponseTime_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val11 = axis2_skel_StatisticsAdmin_getMinServiceResponseTime(env, msg_ctx,input_val11); if ( NULL == ret_val11 ) { adb_getMinServiceResponseTime_free(input_val11, env); return NULL; } ret_node = adb_getMinServiceResponseTimeResponse_serialize(ret_val11, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getMinServiceResponseTimeResponse_free(ret_val11, env); adb_getMinServiceResponseTime_free(input_val11, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getMaxOperationResponseTime") == 0 ) { input_val12 = adb_getMaxOperationResponseTime_create( env); if( AXIS2_FAILURE == adb_getMaxOperationResponseTime_deserialize(input_val12, env, &content_node, NULL, AXIS2_FALSE)) { adb_getMaxOperationResponseTime_free(input_val12, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getMaxOperationResponseTime_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val12 = axis2_skel_StatisticsAdmin_getMaxOperationResponseTime(env, msg_ctx,input_val12); if ( NULL == ret_val12 ) { adb_getMaxOperationResponseTime_free(input_val12, env); return NULL; } ret_node = adb_getMaxOperationResponseTimeResponse_serialize(ret_val12, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getMaxOperationResponseTimeResponse_free(ret_val12, env); adb_getMaxOperationResponseTime_free(input_val12, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getServiceStatistics") == 0 ) { input_val13 = adb_getServiceStatistics_create( env); if( AXIS2_FAILURE == adb_getServiceStatistics_deserialize(input_val13, env, &content_node, NULL, AXIS2_FALSE)) { adb_getServiceStatistics_free(input_val13, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getServiceStatistics_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val13 = axis2_skel_StatisticsAdmin_getServiceStatistics(env, msg_ctx,input_val13); if ( NULL == ret_val13 ) { adb_getServiceStatistics_free(input_val13, env); return NULL; } ret_node = adb_getServiceStatisticsResponse_serialize(ret_val13, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getServiceStatisticsResponse_free(ret_val13, env); adb_getServiceStatistics_free(input_val13, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getOperationFaultCount") == 0 ) { input_val14 = adb_getOperationFaultCount_create( env); if( AXIS2_FAILURE == adb_getOperationFaultCount_deserialize(input_val14, env, &content_node, NULL, AXIS2_FALSE)) { adb_getOperationFaultCount_free(input_val14, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getOperationFaultCount_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val14 = axis2_skel_StatisticsAdmin_getOperationFaultCount(env, msg_ctx,input_val14); if ( NULL == ret_val14 ) { adb_getOperationFaultCount_free(input_val14, env); return NULL; } ret_node = adb_getOperationFaultCountResponse_serialize(ret_val14, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getOperationFaultCountResponse_free(ret_val14, env); adb_getOperationFaultCount_free(input_val14, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getAvgServiceResponseTime") == 0 ) { input_val15 = adb_getAvgServiceResponseTime_create( env); if( AXIS2_FAILURE == adb_getAvgServiceResponseTime_deserialize(input_val15, env, &content_node, NULL, AXIS2_FALSE)) { adb_getAvgServiceResponseTime_free(input_val15, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getAvgServiceResponseTime_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val15 = axis2_skel_StatisticsAdmin_getAvgServiceResponseTime(env, msg_ctx,input_val15); if ( NULL == ret_val15 ) { adb_getAvgServiceResponseTime_free(input_val15, env); return NULL; } ret_node = adb_getAvgServiceResponseTimeResponse_serialize(ret_val15, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getAvgServiceResponseTimeResponse_free(ret_val15, env); adb_getAvgServiceResponseTime_free(input_val15, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getServiceResponseCount") == 0 ) { input_val16 = adb_getServiceResponseCount_create( env); if( AXIS2_FAILURE == adb_getServiceResponseCount_deserialize(input_val16, env, &content_node, NULL, AXIS2_FALSE)) { adb_getServiceResponseCount_free(input_val16, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getServiceResponseCount_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val16 = axis2_skel_StatisticsAdmin_getServiceResponseCount(env, msg_ctx,input_val16); if ( NULL == ret_val16 ) { adb_getServiceResponseCount_free(input_val16, env); return NULL; } ret_node = adb_getServiceResponseCountResponse_serialize(ret_val16, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getServiceResponseCountResponse_free(ret_val16, env); adb_getServiceResponseCount_free(input_val16, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getSystemRequestCount") == 0 ) { ret_val17 = axis2_skel_StatisticsAdmin_getSystemRequestCount(env, msg_ctx); if ( NULL == ret_val17 ) { return NULL; } ret_node = adb_getSystemRequestCountResponse_serialize(ret_val17, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getSystemRequestCountResponse_free(ret_val17, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getMinOperationResponseTime") == 0 ) { input_val18 = adb_getMinOperationResponseTime_create( env); if( AXIS2_FAILURE == adb_getMinOperationResponseTime_deserialize(input_val18, env, &content_node, NULL, AXIS2_FALSE)) { adb_getMinOperationResponseTime_free(input_val18, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getMinOperationResponseTime_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val18 = axis2_skel_StatisticsAdmin_getMinOperationResponseTime(env, msg_ctx,input_val18); if ( NULL == ret_val18 ) { adb_getMinOperationResponseTime_free(input_val18, env); return NULL; } ret_node = adb_getMinOperationResponseTimeResponse_serialize(ret_val18, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getMinOperationResponseTimeResponse_free(ret_val18, env); adb_getMinOperationResponseTime_free(input_val18, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getAvgSystemResponseTime") == 0 ) { ret_val19 = axis2_skel_StatisticsAdmin_getAvgSystemResponseTime(env, msg_ctx); if ( NULL == ret_val19 ) { return NULL; } ret_node = adb_getAvgSystemResponseTimeResponse_serialize(ret_val19, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getAvgSystemResponseTimeResponse_free(ret_val19, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getSystemStatistics") == 0 ) { ret_val20 = axis2_skel_StatisticsAdmin_getSystemStatistics(env, msg_ctx); if ( NULL == ret_val20 ) { return NULL; } ret_node = adb_getSystemStatisticsResponse_serialize(ret_val20, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getSystemStatisticsResponse_free(ret_val20, env); return ret_node; /* since this has no output params it just returns NULL */ } if ( axutil_strcmp(op_name, "getOperationRequestCount") == 0 ) { input_val21 = adb_getOperationRequestCount_create( env); if( AXIS2_FAILURE == adb_getOperationRequestCount_deserialize(input_val21, env, &content_node, NULL, AXIS2_FALSE)) { adb_getOperationRequestCount_free(input_val21, env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE); AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getOperationRequestCount_deserialize: " "This should be due to an invalid XML"); return NULL; } ret_val21 = axis2_skel_StatisticsAdmin_getOperationRequestCount(env, msg_ctx,input_val21); if ( NULL == ret_val21 ) { adb_getOperationRequestCount_free(input_val21, env); return NULL; } ret_node = adb_getOperationRequestCountResponse_serialize(ret_val21, env, NULL, NULL, AXIS2_TRUE, NULL, NULL); adb_getOperationRequestCountResponse_free(ret_val21, env); adb_getOperationRequestCount_free(input_val21, env); return ret_node; /* since this has no output params it just returns NULL */ } } AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2_svc_skel_StatisticsAdmin service ERROR: invalid OM parameters in request\n"); return NULL; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axiom_soap_header_remove_header_block( axiom_soap_header_t * soap_header, const axutil_env_t * env, axutil_qname_t * qname) { axis2_char_t *qn_localname = NULL; axis2_char_t *qname_ns = NULL; axis2_char_t *qname_prefix = NULL; axutil_hash_index_t *hi = NULL; AXIS2_PARAM_CHECK(env->error, qname, AXIS2_FAILURE); qn_localname = axutil_qname_get_localpart(qname, env); qname_ns = axutil_qname_get_uri(qname, env); qname_prefix = axutil_qname_get_prefix(qname, env); if(!soap_header->header_blocks) { return AXIS2_FAILURE; } for(hi = axutil_hash_first(soap_header->header_blocks, env); hi; hi = axutil_hash_next(env, hi)) { const void *key = NULL; void *val = NULL; axutil_hash_this(hi, &key, NULL, &val); if(val) { axiom_soap_header_block_t *header_block = NULL; axiom_element_t *ele = NULL; axiom_node_t *node = NULL; header_block = (axiom_soap_header_block_t *)val; node = axiom_soap_header_block_get_base_node(header_block, env); if(node) { axutil_qname_t *element_qname = NULL; ele = (axiom_element_t *)axiom_node_get_data_element(node, env); element_qname = axiom_element_get_qname(ele, env, node); if(axiom_soap_header_qname_matches(env, element_qname, qname) == AXIS2_TRUE) { axiom_node_detach(node, env); /* axiom_node_free_tree(node, env); */ axutil_hash_set(soap_header->header_blocks, key, AXIS2_HASH_KEY_STRING, NULL); axiom_soap_header_block_free(header_block, env); axiom_node_free_tree(node, env); break; } } } } if(hi) { AXIS2_FREE(env->allocator, hi); } return AXIS2_SUCCESS; }
bool Axis2QpidReceiver::start( void) { if(!conf_ctx) return false; Connection connection; axis2_bool_t serverSide = AXIS2_TRUE; serverSide = axis2_amqp_util_conf_ctx_get_server_side(conf_ctx, env); while(true) { try { std::list<string> queueNameList; string qpidBrokerIP = axis2_amqp_util_conf_ctx_get_qpid_broker_ip(conf_ctx, env); int qpidBrokerPort = axis2_amqp_util_conf_ctx_get_qpid_broker_port(conf_ctx, env); /* Check if Client Side and Resolve Dynamic Queue Name */ if(serverSide == AXIS2_TRUE) /* Server side */ { std::cout << "Connecting to Qpid Broker on " << qpidBrokerIP << ":" << qpidBrokerPort << " ... "; } /* Create Connection to Qpid Broker */ connection.open(qpidBrokerIP, qpidBrokerPort); if(serverSide == AXIS2_TRUE) /* Server side */ { /* Create queue for each service. Queue name is equal to service name */ axis2_conf_t* conf = axis2_conf_ctx_get_conf(conf_ctx, env); if(!conf) return false; axutil_hash_t* serviceMap = axis2_conf_get_all_svcs(conf, env); if(!serviceMap) return false; axutil_hash_index_t* serviceHI = NULL; void* serviceValue = NULL; for(serviceHI = axutil_hash_first(serviceMap, env); serviceHI; serviceHI = axutil_hash_next(env, serviceHI)) { axutil_hash_this(serviceHI, NULL, NULL, &serviceValue); axis2_svc_t* service = (axis2_svc_t*)serviceValue; if(!service) return false; axis2_char_t* serviceName = axutil_qname_get_localpart(axis2_svc_get_qname( service, env), env); if(!serviceName) return false; queueNameList.push_back(serviceName); } std::cout << "CONNECTED" << std::endl; } else /* Client side separate listener in dual-channel case */ { string queueName = axis2_amqp_util_conf_ctx_get_dual_channel_queue_name(conf_ctx, env); queueNameList.push_back(queueName); } /* Create new session */ Session session = connection.newSession(); /* Create Subscription manager */ SubscriptionManager subscriptionManager(session); Axis2QpidReceiverListener qpidReceiverListener(env, conf_ctx); /* Subscribe to queues */ while(!queueNameList.empty()) { string queueName = queueNameList.front(); session.queueDeclare(arg::queue = queueName, arg::autoDelete = true); session.exchangeBind(arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT, arg::queue = queueName, arg::bindingKey = queueName); subscriptionManager.subscribe(qpidReceiverListener, queueName); queueNameList.pop_front(); } /* Listen and Wait */ if(serverSide == AXIS2_TRUE) /* Server side */ { std::cout << "Started Axis2 AMQP Server ..." << std::endl; } subscriptionManager.run(); return true; } catch(const std::exception& e) { connection.close(); if(serverSide == AXIS2_TRUE) /* Server side */ { std::cout << "FAILED" << std::endl; } sleep(5); } } connection.close(); return false; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_engine_receive( axis2_engine_t * engine, const axutil_env_t * env, axis2_msg_ctx_t * msg_ctx) { axis2_conf_ctx_t *conf_ctx = NULL; axis2_conf_t *conf = NULL; axis2_op_ctx_t *op_ctx = NULL; axis2_op_t *op = NULL; axutil_array_list_t *pre_calculated_phases = NULL; axutil_array_list_t *op_specific_phases = NULL; axis2_status_t status = AXIS2_FAILURE; AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Start:axis2_engine_receive"); AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE); conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env); conf = axis2_conf_ctx_get_conf(conf_ctx, env); pre_calculated_phases = axis2_conf_get_in_phases_upto_and_including_post_dispatch(conf, env); if(axis2_msg_ctx_is_paused(msg_ctx, env)) { /* The message has paused, so re-run them from the position they stopped. */ axis2_engine_resume_invocation_phases(engine, env, pre_calculated_phases, msg_ctx); if(axis2_msg_ctx_is_paused(msg_ctx, env)) { AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Message context is paused. So return here."); return AXIS2_SUCCESS; } /* Resume op specific phases */ op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); if(op_ctx) { op = axis2_op_ctx_get_op(op_ctx, env); op_specific_phases = axis2_op_get_in_flow(op, env); axis2_engine_resume_invocation_phases(engine, env, op_specific_phases, msg_ctx); if(axis2_msg_ctx_is_paused(msg_ctx, env)) { AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Message context is paused. So return here."); return AXIS2_SUCCESS; } } } else { status = axis2_engine_invoke_phases(engine, env, pre_calculated_phases, msg_ctx); if(status != AXIS2_SUCCESS) { if(axis2_msg_ctx_get_server_side(msg_ctx, env)) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invoking pre-calculated phases failed"); return status; } } if(axis2_msg_ctx_is_paused(msg_ctx, env)) { AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Message context is paused. So return here."); return AXIS2_SUCCESS; } op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); if(op_ctx) { op = axis2_op_ctx_get_op(op_ctx, env); op_specific_phases = axis2_op_get_in_flow(op, env); status = axis2_engine_invoke_phases(engine, env, op_specific_phases, msg_ctx); if(status != AXIS2_SUCCESS) { axis2_char_t *op_name = NULL; op_name = axutil_qname_get_localpart(axis2_op_get_qname(op, env), env); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invoking operation specific phases failed for operation %s", op_name); return status; } if(axis2_msg_ctx_is_paused(msg_ctx, env)) { AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Message context is paused. So return here."); return AXIS2_SUCCESS; } } } if((axis2_msg_ctx_get_server_side(msg_ctx, env)) && !(axis2_msg_ctx_is_paused(msg_ctx, env))) { axis2_msg_recv_t *receiver = NULL; status = axis2_engine_check_must_understand_headers(env, msg_ctx); if(status != AXIS2_SUCCESS) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Check for must understand headers failed"); return status; } /* Invoke the message receivers */ if(!op) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Operation not found"); return AXIS2_FAILURE; } receiver = axis2_op_get_msg_recv(op, env); if(!receiver) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Message receiver not set in operation description"); return AXIS2_FAILURE; } status = axis2_msg_recv_receive(receiver, env, msg_ctx, axis2_msg_recv_get_derived( receiver, env)); } AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:axis2_engine_receive"); return status; }
/* * This method invokes the right service method */ axiom_node_t* AXIS2_CALL axis2_svc_skel_TraderClient_invoke(axis2_svc_skeleton_t *svc_skeleton, const axutil_env_t *env, axiom_node_t *content_node, axis2_msg_ctx_t *msg_ctx) { /* depending on the function name invoke the * corresponding method */ axis2_op_ctx_t *operation_ctx = NULL; axis2_op_t *operation = NULL; axutil_qname_t *op_qname = NULL; axis2_char_t *op_name = NULL; axiom_node_t *ret_node = NULL; axis2_buyResponse_t* ret_val1 = NULL; axis2_buyRequest_t* input_val1_1; axis2_getPortfolioResponse_t* ret_val2 = NULL; axis2_getPortfolioRequest_t* input_val2_1; axis2_depositResponse_t* ret_val3 = NULL; axis2_depositRequest_t* input_val3_1; axis2_getSymbolsResponse_t* ret_val4 = NULL; axis2_getSymbolsRequest_t* input_val4_1; axis2_getQuoteResponse_t* ret_val5 = NULL; axis2_getQuoteRequest_t* input_val5_1; axis2_createAccountResponse_t* ret_val6 = NULL; axis2_createAccountRequest_t* input_val6_1; axis2_sellResponse_t* ret_val7 = NULL; axis2_sellRequest_t* input_val7_1; operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env); operation = axis2_op_ctx_get_op(operation_ctx, env); op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env); op_name = axutil_qname_get_localpart(op_qname, env); if (op_name) { if ( axutil_strcmp(op_name, "buy") == 0 ) { input_val1_1 = axis2_buyRequest_create( env); axis2_buyRequest_deserialize(input_val1_1, env, content_node ); ret_val1 = axis2_skel_TraderClient_buy(env, input_val1_1 ); if ( NULL == ret_val1 ) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from buy " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return axis2_svc_skel_TraderClient_on_fault( svc_skeleton, env, NULL); } ret_node = axis2_buyResponse_serialize(ret_val1, env, NULL, AXIS2_FALSE); axis2_buyResponse_free(ret_val1, env); axis2_buyRequest_free(input_val1_1, env); return ret_node; } if ( axutil_strcmp(op_name, "getPortfolio") == 0 ) { input_val2_1 = axis2_getPortfolioRequest_create( env); axis2_getPortfolioRequest_deserialize(input_val2_1, env, content_node ); ret_val2 = axis2_skel_TraderClient_getPortfolio(env, input_val2_1 ); if ( NULL == ret_val2 ) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from getPortfolio " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return axis2_svc_skel_TraderClient_on_fault( svc_skeleton, env, NULL); } ret_node = axis2_getPortfolioResponse_serialize(ret_val2, env, NULL, AXIS2_FALSE); axis2_getPortfolioResponse_free(ret_val2, env); axis2_getPortfolioRequest_free(input_val2_1, env); return ret_node; } if ( axutil_strcmp(op_name, "deposit") == 0 ) { input_val3_1 = axis2_depositRequest_create( env); axis2_depositRequest_deserialize(input_val3_1, env, content_node ); ret_val3 = axis2_skel_TraderClient_deposit(env, input_val3_1 ); if ( NULL == ret_val3 ) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from deposit " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return axis2_svc_skel_TraderClient_on_fault( svc_skeleton, env, NULL); } ret_node = axis2_depositResponse_serialize(ret_val3, env, NULL, AXIS2_FALSE); axis2_depositResponse_free(ret_val3, env); axis2_depositRequest_free(input_val3_1, env); return ret_node; } if ( axutil_strcmp(op_name, "getSymbols") == 0 ) { input_val4_1 = axis2_getSymbolsRequest_create( env); axis2_getSymbolsRequest_deserialize(input_val4_1, env, content_node ); ret_val4 = axis2_skel_TraderClient_getSymbols(env, input_val4_1 ); if ( NULL == ret_val4 ) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from getSymbols " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return axis2_svc_skel_TraderClient_on_fault( svc_skeleton, env, NULL); } ret_node = axis2_getSymbolsResponse_serialize(ret_val4, env, NULL, AXIS2_FALSE); axis2_getSymbolsResponse_free(ret_val4, env); axis2_getSymbolsRequest_free(input_val4_1, env); return ret_node; } if ( axutil_strcmp(op_name, "getQuote") == 0 ) { input_val5_1 = axis2_getQuoteRequest_create( env); axis2_getQuoteRequest_deserialize(input_val5_1, env, content_node ); ret_val5 = axis2_skel_TraderClient_getQuote(env, input_val5_1 ); if ( NULL == ret_val5 ) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from getQuote " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return axis2_svc_skel_TraderClient_on_fault( svc_skeleton, env, NULL); } ret_node = axis2_getQuoteResponse_serialize(ret_val5, env, NULL, AXIS2_FALSE); axis2_getQuoteResponse_free(ret_val5, env); axis2_getQuoteRequest_free(input_val5_1, env); return ret_node; } if ( axutil_strcmp(op_name, "createAccount") == 0 ) { input_val6_1 = axis2_createAccountRequest_create( env); axis2_createAccountRequest_deserialize(input_val6_1, env, content_node ); ret_val6 = axis2_skel_TraderClient_createAccount(env, input_val6_1 ); if ( NULL == ret_val6 ) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from createAccount " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return axis2_svc_skel_TraderClient_on_fault( svc_skeleton, env, NULL); } ret_node = axis2_createAccountResponse_serialize(ret_val6, env, NULL, AXIS2_FALSE); axis2_createAccountResponse_free(ret_val6, env); axis2_createAccountRequest_free(input_val6_1, env); return ret_node; } if ( axutil_strcmp(op_name, "sell") == 0 ) { input_val7_1 = axis2_sellRequest_create( env); axis2_sellRequest_deserialize(input_val7_1, env, content_node ); ret_val7 = axis2_skel_TraderClient_sell(env, input_val7_1 ); if ( NULL == ret_val7 ) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from sell " " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); return axis2_svc_skel_TraderClient_on_fault( svc_skeleton, env, NULL); } ret_node = axis2_sellResponse_serialize(ret_val7, env, NULL, AXIS2_FALSE); axis2_sellResponse_free(ret_val7, env); axis2_sellRequest_free(input_val7_1, env); return ret_node; } } printf("axis2_svc_skel_TraderClient service ERROR: invalid OM parameters in request\n"); return content_node; }
axis2_status_t axis2_addr_out_handler_add_to_header( const axutil_env_t * env, axis2_endpoint_ref_t * epr, axiom_node_t ** parent_node_p, const axis2_char_t * addr_ns) { axiom_node_t *parent_node = NULL; const axutil_qname_t *interface_qname = NULL; axiom_node_t *interface_node = NULL; axiom_element_t *interface_ele = NULL; const axis2_char_t *element_localname = NULL; axis2_svc_name_t *service_name = NULL; axiom_namespace_t *addr_ns_obj = NULL; AXIS2_PARAM_CHECK(env->error, epr, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, parent_node_p, AXIS2_FAILURE); parent_node = *(parent_node_p); interface_qname = axis2_endpoint_ref_get_interface_qname(epr, env); if(interface_qname) { axis2_char_t *text = NULL; axis2_char_t *qname_prefix = NULL; axis2_char_t *qname_localpart = NULL; addr_ns_obj = axiom_namespace_create(env, addr_ns, AXIS2_WSA_DEFAULT_PREFIX); if(!axutil_strcmp(addr_ns, AXIS2_WSA_NAMESPACE_SUBMISSION)) { element_localname = EPR_PORT_TYPE; } else { element_localname = AXIS2_WSA_INTERFACE_NAME; } interface_ele = axiom_element_create(env, parent_node, element_localname, addr_ns_obj, &interface_node); qname_prefix = axutil_qname_get_prefix(interface_qname, env); qname_localpart = axutil_qname_get_localpart(interface_qname, env); text = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (axutil_strlen(qname_prefix) + axutil_strlen(qname_localpart) + 2)); sprintf(text, "%s:%s", qname_prefix, qname_localpart); axiom_element_set_text(interface_ele, env, text, interface_node); AXIS2_FREE(env->allocator, text); if(interface_ele) { axiom_namespace_t *dec_ns = NULL; dec_ns = axiom_element_find_declared_namespace(interface_ele, env, addr_ns, AXIS2_WSA_DEFAULT_PREFIX); if(!dec_ns) { axiom_namespace_free(addr_ns_obj, env); addr_ns_obj = NULL; } } } service_name = axis2_endpoint_ref_get_svc_name(epr, env); return AXIS2_SUCCESS; }
AXIS2_EXTERN axis2_op_t *AXIS2_CALL axis2_svc_get_op_with_qname( const axis2_svc_t * svc, const axutil_env_t * env, const axutil_qname_t * op_qname) { axis2_op_t *op = NULL; axis2_char_t *nc_name = NULL; axis2_char_t *nc_tmp = NULL; /* This is just for the sake of comparison, * and must not be used to change the passed value */ axis2_bool_t is_matched = AXIS2_FALSE; AXIS2_PARAM_CHECK(env->error, op_qname, NULL); nc_name = axutil_qname_get_localpart(op_qname, env); nc_tmp = nc_name; op = axutil_hash_get(svc->op_alias_map, nc_tmp, AXIS2_HASH_KEY_STRING); if(op) { return op; } op = axutil_hash_get(svc->op_action_map, nc_tmp, AXIS2_HASH_KEY_STRING); if(op) { return op; } if(*nc_tmp && svc->op_action_map) { axutil_hash_index_t *hi = NULL; const void *key = NULL; for(hi = axutil_hash_first(svc->op_action_map, env); hi; hi = axutil_hash_next(env, hi)) { axutil_hash_this(hi, &key, NULL, NULL); nc_tmp = nc_name; if(key) { axis2_char_t *search = NULL; axis2_bool_t match_start = AXIS2_TRUE; axis2_char_t *search_tmp = NULL; search = (axis2_char_t *)key; if(!axutil_strchr(search, '*')) { if(axutil_strstr(nc_tmp, search)) { axis2_char_t *comp_tmp = NULL; comp_tmp = axutil_strstr(nc_tmp, search); if(strlen(comp_tmp) == strlen(search)) { nc_tmp = (axis2_char_t *)key; is_matched = AXIS2_TRUE; break; } } continue; } if(search[0] == '*') { search++; if(!*search) { nc_tmp = (axis2_char_t *)key; is_matched = AXIS2_TRUE; break; } else if(axutil_strchr(search, '*')) { continue; } match_start = AXIS2_FALSE; } while(search && *search) { size_t length = 0; axis2_char_t *loc_tmp = NULL; if(search_tmp) { AXIS2_FREE(env->allocator, search_tmp); search_tmp = NULL; } loc_tmp = axutil_strchr(search, '*'); if(loc_tmp && *loc_tmp) { if(!loc_tmp[1]) { is_matched = AXIS2_TRUE; break; } length = (size_t)(loc_tmp - search); /* We are sure that the difference lies within the int range */ search_tmp = (axis2_char_t *)(AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (length + 1))); strncpy(search_tmp, search, length); search_tmp[length] = '\0'; } else if(axutil_strstr(nc_tmp, search)) { axis2_char_t *comp_tmp = NULL; comp_tmp = axutil_strstr(nc_tmp, search); if(strlen(comp_tmp) == strlen(search)) { nc_tmp = (axis2_char_t *)key; is_matched = AXIS2_TRUE; break; } break; } else { break; } if(search_tmp && axutil_strstr(nc_tmp, search_tmp)) { if(match_start && !(axutil_strncmp(nc_tmp, search, (int)length) == 0)) { break; } else if(!match_start) { match_start = AXIS2_TRUE; } } else { break; } search += axutil_strlen(search_tmp) + 1; nc_tmp = axutil_strstr(nc_tmp, search_tmp) + axutil_strlen(search_tmp); } if(search_tmp) { AXIS2_FREE(env->allocator, search_tmp); search_tmp = NULL; } if(is_matched || !search || !*search) { nc_tmp = (axis2_char_t *)key; is_matched = AXIS2_TRUE; break; } } } } if(!is_matched) { nc_tmp = nc_name; } op = axutil_hash_get(svc->op_alias_map, nc_tmp, AXIS2_HASH_KEY_STRING); if(op) { return op; } return (axis2_op_t *)axutil_hash_get(svc->op_action_map, nc_tmp, AXIS2_HASH_KEY_STRING); }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_svc_add_op( axis2_svc_t * svc, const axutil_env_t * env, axis2_op_t * op) { axis2_status_t status = AXIS2_FAILURE; axis2_msg_recv_t *msg_recv = NULL; const axutil_qname_t *qname = NULL; axis2_char_t *key = NULL; const axis2_char_t *svcname = NULL; axutil_array_list_t *mappings_list = NULL; int size = 0; int j = 0; AXIS2_PARAM_CHECK(env->error, op, AXIS2_FAILURE); svcname = axis2_svc_get_name(svc, env); qname = axis2_op_get_qname(op, env); if(qname) key = axutil_qname_get_localpart(qname, env); mappings_list = axis2_op_get_wsamapping_list(op, env); /* Adding action mappings into service */ if(mappings_list) size = axutil_array_list_size(mappings_list, env); for(j = 0; j < size; j++) { axis2_char_t *mapping = NULL; mapping = (axis2_char_t *)axutil_array_list_get(mappings_list, env, j); status = axis2_svc_add_mapping(svc, env, mapping, op); if(AXIS2_SUCCESS != status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Adding operation %s to service %s mapping list failed", svcname, key); return status; } } status = axis2_op_set_parent(op, env, svc); if(AXIS2_SUCCESS != status) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Setting service %s as operation %s parent failed", svcname, key); return status; } msg_recv = axis2_op_get_msg_recv(op, env); if(msg_recv == NULL) { msg_recv = axis2_desc_builder_load_default_msg_recv(env); axis2_op_set_msg_recv(op, env, msg_recv); } if(key) { /* If service defines the operation, then we should not override with module level * operation. Module operations are global. If any setting to be modified, those operations * can be defined in service */ if(!axutil_hash_get(svc->op_alias_map, key, AXIS2_HASH_KEY_STRING)) { axutil_hash_set(svc->op_alias_map, key, AXIS2_HASH_KEY_STRING, op); } } return AXIS2_SUCCESS; }
/** * Here we extract all operations defined in module.xml and built execution * chains for them by calling axis2_phase_resolver_build_execution_chains_for_module_op() * function. Within that function handlers of the modules defined for that * operation are added to module operation chains appropriately. */ AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_svc_add_module_ops( axis2_svc_t * svc, const axutil_env_t * env, axis2_module_desc_t * module_desc, axis2_conf_t * conf) { axutil_hash_t *map = NULL; axutil_hash_index_t *hash_idx = NULL; axis2_phase_resolver_t *phase_resolver = NULL; axis2_op_t *op_desc = NULL; axis2_status_t status = AXIS2_FAILURE; const axis2_char_t *svcname = NULL; axis2_char_t *modname = NULL; axis2_char_t *opname = NULL; AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Entry:axis2_svc_add_module_ops"); AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, conf, AXIS2_FAILURE); svcname = axis2_svc_get_name(svc, env); modname = axutil_qname_get_localpart(axis2_module_desc_get_qname(module_desc, env), env); map = axis2_module_desc_get_all_ops(module_desc, env); phase_resolver = axis2_phase_resolver_create_with_config_and_svc(env, conf, svc); if(!phase_resolver) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Creating phase resolver failed for service %s", svcname); return AXIS2_FAILURE; } for(hash_idx = axutil_hash_first(map, env); hash_idx; hash_idx = axutil_hash_next(env, hash_idx)) { void *v = NULL; axutil_hash_this(hash_idx, NULL, NULL, &v); op_desc = (axis2_op_t *)v; opname = axutil_qname_get_localpart(axis2_op_get_qname(op_desc, env), env); status = axis2_phase_resolver_build_execution_chains_for_module_op(phase_resolver, env, op_desc); if(AXIS2_SUCCESS != status) { axis2_phase_resolver_free(phase_resolver, env); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Builidng module operation %s failed for module %s", opname, modname); return status; } status = axis2_svc_add_op(svc, env, op_desc); if(AXIS2_SUCCESS != status) { axis2_phase_resolver_free(phase_resolver, env); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Adding operation %s to service %s failed", opname, svcname); return status; } } axis2_phase_resolver_free(phase_resolver, env); AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:axis2_svc_add_module_ops"); return AXIS2_SUCCESS; }