axis2_endpoint_ref_t *AXIS2_CALL axis2_tcp_server_get_reply_to_epr( axis2_transport_receiver_t * server, const axutil_env_t * env, const axis2_char_t * svc_name) { axis2_endpoint_ref_t *epr = NULL; const axis2_char_t *host_address = NULL; axis2_char_t *svc_path = NULL; axutil_url_t *url = NULL; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, svc_name, NULL); host_address = "127.0.0.1"; /* TODO : get from axis2.xml */ svc_path = axutil_stracat(env, "/axis2/services/", svc_name); url = axutil_url_create(env, "tcp", host_address, AXIS2_INTF_TO_IMPL(server)->port, svc_path); AXIS2_FREE(env->allocator, svc_path); if (!url) { return NULL; } epr = axis2_endpoint_ref_create(env, axutil_url_to_external_form(url, env)); axutil_url_free(url, env); return epr; }
axis2_endpoint_ref_t *AXIS2_CALL axis2_udp_receiver_get_reply_to_epr( axis2_transport_receiver_t * receiver, const axutil_env_t * env, const axis2_char_t * svc_name) { axis2_endpoint_ref_t *epr = NULL; const axis2_char_t *host_address = NULL; axis2_char_t *svc_path = NULL; axutil_url_t *url = NULL; AXIS2_PARAM_CHECK(env->error, svc_name, NULL); AXIS2_PARAM_CHECK(env->error, receiver, NULL); host_address = AXIS2_DEFAULT_HOST_ADDRESS; /* TODO : get from axis2.xml */ svc_path = axutil_stracat(env, AXIS2_DEFAULT_SVC_PATH, svc_name); url = axutil_url_create(env, "soap.udp", host_address, AXIS2_INTF_TO_IMPL(receiver)->port, svc_path); AXIS2_FREE(env->allocator, svc_path); if (!url) { return NULL; } epr = axis2_endpoint_ref_create(env, axutil_url_to_external_form(url, env)); axutil_url_free(url, env); return epr; }
void test_url(axutil_env_t *env) { axutil_url_t * url; axis2_char_t *url_str = "https://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12386356"; axis2_char_t *set_server = "www.yahoo.com"; axis2_char_t *set_protocol = "file"; axis2_char_t *set_path = "/bar/"; axis2_port_t set_port = 80; axis2_char_t *get_protocol; axis2_char_t *get_server; axis2_port_t get_port; axis2_char_t *get_path; axis2_status_t status; url = axutil_url_parse_string(env,url_str); CUT_ASSERT_PTR_NOT_EQUAL(url, NULL, 1); status = axutil_url_set_protocol(url,env,set_protocol); CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0); status = axutil_url_set_server(url,env,set_server); CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0); status = axutil_url_set_port(url,env,set_port); CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0); status = axutil_url_set_path(url,env,set_path); CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0); get_protocol = axutil_url_get_protocol(url,env); CUT_ASSERT_STR_EQUAL(get_protocol, set_protocol, 0); get_server = axutil_url_get_server(url,env); CUT_ASSERT_STR_EQUAL(get_server, "www.yahoo.com:80", 0); get_port = axutil_url_get_port(url,env); CUT_ASSERT_INT_EQUAL(get_port,set_port,0); get_path = axutil_url_get_path(url,env); CUT_ASSERT_STR_EQUAL(get_path, set_path, 0); axutil_url_free(url,env); }
AXIS2_EXTERN void AXIS2_CALL axis2_http_client_free( axis2_http_client_t * http_client, const axutil_env_t * env) { if(http_client->proxy_host) { AXIS2_FREE(env->allocator, http_client->proxy_host); } if(http_client->proxy_host_port) { AXIS2_FREE(env->allocator, http_client->proxy_host_port); } if(http_client->url) { axutil_url_free(http_client->url, env); } if(http_client->response) { axis2_http_simple_response_free(http_client->response, env); } if(-1 != http_client->sockfd) { #ifdef AXIS2_SSL_ENABLED if(http_client->data_stream) { if(http_client->data_stream->stream_type == AXIS2_STREAM_SOCKET) { axutil_network_handler_close_socket(env, http_client->sockfd); /** ssl streams of type AXIS2_STREAM_BASIC will be handled by SSL_shutdown(); */ } } #else axutil_network_handler_close_socket(env, http_client->sockfd); #endif http_client->sockfd = -1; } if(http_client->data_stream && http_client->owns_stream) { axutil_stream_free(http_client->data_stream,env); } if(http_client->req_body) { AXIS2_FREE(env->allocator, http_client->req_body); } /* There is no other appropriate place to free the mime_part list when a * particular client send requests. */ if(http_client->mime_parts) { int i = 0; for(i = 0; i < axutil_array_list_size(http_client->mime_parts, env); i++) { axiom_mime_part_t *mime_part = NULL; mime_part = (axiom_mime_part_t *)axutil_array_list_get(http_client->mime_parts, env, i); if(mime_part) { axiom_mime_part_free(mime_part, env); } } axutil_array_list_free(http_client->mime_parts, env); } AXIS2_FREE(env->allocator, http_client); return; }