Hello all,

No doubt my problem is due to user error, but I'm not sure what to try
next to fix this problem.

I am working to implement asynchronous mode client calls in a project
which is already fairly mature and works well in blocking mode.  When my
DLL is loaded, I initialise the Axis2/C environment, and I free the
environment on unload of the DLL.  In between I can make many web
service calls in blocking mode.

What is happening now is that I used code from the echo_non_blocking.c
sample to implement asynchronous mode but I get an access violation
because the env is freed inside the function which calls my on_complete
callback.  After this function is completed my application still tries
to use the same env.

Can someone point out which function to call so I can make use of the
asynchronous callbacks and still keep the same environment between
calls?




here is the code I am using:
========================================================================
=============================
      /* Send request */
      svc_client = axis2_stub_get_svc_client (stub, axis2_env );
      AXIS2_LOG_INFO(axis2_env->log, "\n---appel d'axis2 send receive
INITIÉ---\n");  ******* I see this in the log
      axis2_svc_client_send_receive_non_blocking(svc_client, axis2_env,
payload, callback);
      AXIS2_LOG_INFO(axis2_env->log, "\n---appel d'axis2 send receive
RETOURNÉ---\n");******* I see this in the log

      /** Wait till callback is complete. Simply keep the parent thread
running
         until our on_complete or on_error is invoked */
      while (count < 15)
      {
          if (isComplete)
          {
              /* We are done with the callback */
              break;
          }
          AXIS2_LOG_INFO(axis2_env->log, "\n---AXIS DORT---\n");
******* I see this in the log
          AXIS2_SLEEP(1);
          AXIS2_LOG_INFO(axis2_env->log, "\n---AXIS SE RÉVEILLE---\n");
******* crash happens here after on_complete.. Axis2_env is freed!
          count++;
      }

      if (!(count < 15))
      {
        AXIS2_LOG_INFO(axis2_env->log, "\n---appel d'axis2 send receive
COMPLÉTÉ TIMEOUT---\n");   **** never see this in log
        *lpiEtatTraitement = ETAT_TRAITEMENT_TIMEOUT;
      }
      else
      {
        AXIS2_LOG_INFO(axis2_env->log, "\n---appel d'axis2 send receive
COMPLÉTÉ OK---\n");        **** never see this in log
      }
========================================================================
=============================


axis2_status_t AXIS2_CALL OnRatingStubOpComplete(     struct
axis2_callback * callback,     const axutil_env_t * env)
{
    AXIS2_LOG_INFO(axis2_env->log,
"\n---OnRatingStubOpComplete()---\n");            ******* I see this in
the log
    isComplete = 1;
    return AXIS2_SUCCESS;
}

========================================================================
=============================

... In the trace execution goes into op_client.c here:

    if (args_list->callback)
    {
        axis2_callback_invoke_on_complete(args_list->callback, th_env,
args_list->op_client->async_result);    **** calls my on_complete
function above
        axis2_callback_set_complete(args_list->callback, th_env,
AXIS2_TRUE);
    }

    /* clean up memory */
    axis2_async_result_free(args_list->op_client->async_result, th_env);

    axis2_op_ctx_free(op_ctx, th_env);

    th_pool = th_env->thread_pool;

    AXIS2_FREE(th_env->allocator, args_list);

    if (th_env)
    {
        axutil_free_thread_env(th_env);
        th_env = NULL;
    }
    axutil_thread_pool_exit_thread(th_pool, thd);
***** this frees my env! as shown in my log
    return NULL;
}

========================================================================
=============================




So can someone tell me, is axis2_svc_client_send_receive_non_blocking
the wrong function to use if I want to make many service calls with one
environment?


Carl Lefrançois
Analyste / Programmeur
Larochelle Groupe Conseil

Tél. :      514-282-6817, poste 4548
Couriel : [EMAIL PROTECTED]
  _____  

"Ce message est confidentiel, à l'usage exclusif du destinataire
ci-dessus et son contenu ne représente en aucun cas un engagement de la
part de AXA, sauf en cas de stipulation expresse et par écrit de la part
de AXA. Toute publication, utilisation ou diffusion, même partielle,
doit être autorisée préalablement. Si vous n'êtes pas destinataire de ce
message, merci d'en avertir immédiatement l'expéditeur."

"This e-mail message is confidential, for the exclusive use of the
addressee and its contents shall not constitute a commitment by AXA,
except as otherwise specifically provided in writing by AXA. Any
unauthorized disclosure, use or dissemination, either whole or partial,
is prohibited. If you are not the intended recipient of the message,
please notify the sender immediately."

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to