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 Tomaz Rotovnik <to...@uni-mb.si> on 2005/10/05 21:40:25 UTC

Safe threading - Client side

Hello

I'm looking for some information's about running multiple calls in client side of axis. I'm using axis version 1.5. The problem is that when I call function again before it returns (in different thread) it returns exception when calling invoke method.

In main loop there is call to create new object

pBLP = new Soap(s.strURL.c_str(), APTHTTP1_1);

and this instance is used each time when function "setConfirmTransaction" is called for example

pCT = pBLP->ConfirmTransaction(sTr.szAuthReference);

This calling part is implemented in callback function, which can be called many times (before we get receive from the server it can be called again (multiple threads)).

I hope someone could give me some possible solution. 

Thanks in advance

Tomaz



Here is example of "setConfirmTransaction" function

##################################################################
setConfirmTransaction* Soap::ConfirmTransaction(xsd__string Value0)
{
 setConfirmTransaction* pReturn = NULL;
 const char* pcCmplxFaultName;
 pcCmplxFaultName = NULL;

 try{

 if (AXIS_SUCCESS != m_pCall->initialize(CPP_DOC_PROVIDER)) return pReturn;
 m_pCall->setTransportProperty(SOAPACTION_HEADER , "http://tempuri.org/ConfirmTransaction");
 m_pCall->setSOAPVersion(SOAP_VER_1_1);
 m_pCall->setOperation("ConfirmTransaction", "http://tempuri.org/WebService");
 includeSecure();
 applyUserPreferences();
 m_pCall->addParameter((void*)Value0, "lTransactionID", XSD_STRING);
  
 if (AXIS_SUCCESS == m_pCall->invoke())
 {
    if(AXIS_SUCCESS == m_pCall->checkMessage("ConfirmTransactionResponse", "http://tempuri.org/WebService"))
  {
        pReturn = (setConfirmTransaction*)m_pCall->getCmplxObject((void*) Axis_DeSerialize_setConfirmTransaction, (void*) Axis_Create_setConfirmTransaction, (void*) Axis_Delete_setConfirmTransaction,"ConfirmTransactionResult", 0);
  }
 }
 m_pCall->unInitialize();
 return pReturn;
 }
 catch(AxisException& e)
 {......
 ###############################################################################

Re: Safe threading - Client side

Posted by Samisa Abeysinghe <sa...@gmail.com>.
We have some tests with threads in the test forlder, some of which were 
passing. (I did not run the test framework lately, could someone please 
mention what threded tests are passing/running)
Please have a look at tests with the name suffix 'TTest' (run `ls 
tests/auto_build/testcases/client/cpp/*TTest*` in source extract folder)
This will give you an idea on how to use clients in threads.

Thanks,
Samisa...

Tomaz Rotovnik wrote:

>  
> Hello
>  
> I'm looking for some information's about running multiple calls in 
> client side of axis. I'm using axis version 1.5. The problem is that 
> when I call function again before it returns (in different thread) 
> it returns exception when calling invoke method.
>  
> In main loop there is call to create new object
>  
> pBLP = new Soap(s.strURL.c_str(), APTHTTP1_1);
>  
> and this instance is used each time when function 
> "setConfirmTransaction" is called for example
>  
> pCT = pBLP->ConfirmTransaction(sTr.szAuthReference);
>  
> This calling part is implemented in callback function, which can be 
> called many times (before we get receive from the server it can be 
> called again (multiple threads)).
>  
> I hope someone could give me some possible solution.
>  
> Thanks in advance
>  
> Tomaz
>  
>  
>  
> Here is example of "setConfirmTransaction" function
>  
> ##################################################################
> setConfirmTransaction* Soap::ConfirmTransaction(xsd__string Value0)
> {
>  setConfirmTransaction* pReturn = NULL;
>  const char* pcCmplxFaultName;
>  pcCmplxFaultName = NULL;
>  try{
>  
>  if (AXIS_SUCCESS != m_pCall->initialize(CPP_DOC_PROVIDER)) return 
> pReturn;
>  m_pCall->setTransportProperty(SOAPACTION_HEADER , 
> "http://tempuri.org/ConfirmTransaction");
>  m_pCall->setSOAPVersion(SOAP_VER_1_1);
>  m_pCall->setOperation("ConfirmTransaction", 
> "http://tempuri.org/WebService");
>  includeSecure();
>  applyUserPreferences();
>  m_pCall->addParameter((void*)Value0, "lTransactionID", XSD_STRING);
>   
>  if (AXIS_SUCCESS == m_pCall->invoke())
>  {
>     if(AXIS_SUCCESS == 
> m_pCall->checkMessage("ConfirmTransactionResponse", 
> "http://tempuri.org/WebService"))
>   {
>         pReturn = 
> (setConfirmTransaction*)m_pCall->getCmplxObject((void*) 
> Axis_DeSerialize_setConfirmTransaction, 
> (void*) Axis_Create_setConfirmTransaction, (void*) 
> Axis_Delete_setConfirmTransaction,"ConfirmTransactionResult", 0);
>   }
>  }
>  m_pCall->unInitialize();
>  return pReturn;
>  }
>  catch(AxisException& e)
>  {......
>  ###############################################################################