You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Patrick Duflot <pd...@gmail.com> on 2011/06/06 16:16:01 UTC

Re: sockets not closed

Hi,

I also noticed this behaviour.
I could work around the issue by creating / deleting the axis2_svc_client
object inside the while loop.

Cheers



On Wed, May 11, 2011 at 12:50 PM, sebastien <se...@yahoo.fr> wrote:

> Hi,
>
> I am using axis2-C to create a web service client on Windows.
>
> After each request-response, I have observed that:
>
>  - in windows Task Manager, the number handles is increased with 3 units
>  - with netstat -a, I see a lot of sockets in state TIME_WAIT or CLOSE_WAIT
>
> Below is the way that I set up my client. Is there anything wrong?
>
> const axutil_env_t *env = NULL;
> const axis2_char_t *address = NULL;
> axis2_endpoint_ref_t *endpoint_ref = NULL;
> axis2_options_t *options = NULL;
> const axis2_char_t *client_home = NULL;
> axis2_svc_client_t *svc_client = NULL;
> axiom_node_t *payload = NULL;
> axiom_node_t *ret_node = NULL;
> axiom_node_t *payload2 = NULL;
> axiom_node_t *ret_node2 = NULL;
> /* Set up the environment */
> env = axutil_env_create_all("echo.log", AXIS2_LOG_LEVEL_TRACE);
>
> address = "http://localhost:8080/axis2/services/Test";
> /* Create EPR with given address */
> endpoint_ref = axis2_endpoint_ref_create(env, address);
> /* Setup options */
> options = axis2_options_create(env);
> axis2_options_set_to(options, env, endpoint_ref);
> axis2_options_set_http_auth_info(
> options,env,"sebastien","seb","Basic");
>
> client_home = "C:/util/axis2/axis2c-bin-1.6.0-win32";
>
> /* Create service client */
> svc_client = axis2_svc_client_create(env, client_home);
> if (!svc_client)
> {
> printf
> ("Error creating service client, Please check AXIS2C_HOME again\n");
> AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "Stub invoke FAILED: Error code:" " %d :: %s",
> env->error->error_number,
> AXIS2_ERROR_GET_MESSAGE(env->error));
> return -1;
> }
> /* Set service client options */
> axis2_svc_client_set_options(svc_client, env, options);
> /* Engage addressing module */
> axis2_svc_client_engage_module(svc_client, env, AXIS2_MODULE_ADDRESSING);
> while(1)
> {
> Sleep(1000);
> /* Build the SOAP request message payload using OM API. */
> payload = build_om_payload_for_echo_svc(env);
> /* Send request */
> ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
> if (ret_node)
> {
> printf("\necho client invoke SUCCESSFUL!\n");
> axiom_node_free_tree(ret_node, env);
> }
> else
> {
> AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "Stub invoke FAILED: Error code:" " %d :: %s",
> env->error->error_number,
> AXIS2_ERROR_GET_MESSAGE(env->error));
> printf("echo client invoke FAILED!\n");
> }
> }
>
> if (svc_client)
> {
> axis2_svc_client_free(svc_client, env);
> svc_client = NULL;
> }
> if (env)
> {
> axutil_env_free((axutil_env_t *) env);
> env = NULL;
> }
> return 0;
>
>
>
>
> Thanks,
>
> Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: c-user-help@axis.apache.org
>
>