webservices/wscore/src/senclientsession.cpp
changeset 28 0802db42e4e9
parent 1 272b002df977
equal deleted inserted replaced
2:150a13bad6af 28:0802db42e4e9
    35 #include "senwspattern.h"
    35 #include "senwspattern.h"
    36 #include <SenIdentityProvider.h>
    36 #include <SenIdentityProvider.h>
    37 #include <SenXmlUtils.h>
    37 #include <SenXmlUtils.h>
    38 #include <SenXmlProperties.h>
    38 #include <SenXmlProperties.h>
    39 
    39 
    40 #include <xmlengnodelist.h> 
    40 #include <xml/dom/xmlengnodelist.h> 
    41 #include <defaultcaps.hrh>
    41 #include <defaultcaps.hrh>
    42 
    42 
    43 #include "senclientsession.h"
    43 #include "senclientsession.h"
    44 #include "senservicemanagerdefines.h"       // IPC enumerations
    44 #include "senservicemanagerdefines.h"       // IPC enumerations
    45 #include "msencoreservicemanager.h"
    45 #include "msencoreservicemanager.h"
    57 #include "senlayeredtransportproperties.h"  // internal Framework\inc
    57 #include "senlayeredtransportproperties.h"  // internal Framework\inc
    58 #include "senmessagecontext.h"              // internal Framework\inc
    58 #include "senmessagecontext.h"              // internal Framework\inc
    59 
    59 
    60 #include "SenSoapEnvelope2.h"
    60 #include "SenSoapEnvelope2.h"
    61 #include "sensoapmessagedom2.h"
    61 #include "sensoapmessagedom2.h"
    62 #include "xmlengchunkcontainer.h"
    62 #include <xml/dom/xmlengchunkcontainer.h>
    63 #include "xmlengfilecontainer.h"
    63 #include <xml/dom/xmlengfilecontainer.h>
    64 #include "xmlengdeserializer.h"
    64 #include <xml/dom/xmlengdeserializer.h>
    65 #include "SenParser.h"
    65 #include "SenParser.h"
    66 #include "seninternalcredential.h"
    66 #include "seninternalcredential.h"
    67 #include "senservercontext.h"
    67 #include "senservercontext.h"
    68 #include "senapplicationcontext.h"
    68 #include "senapplicationcontext.h"
    69 #include "senclientcontext.h"
    69 #include "senclientcontext.h"
   166         }
   166         }
   167     resHandler->iNext = iFirst;
   167     resHandler->iNext = iFirst;
   168     iFirst = resHandler;
   168     iFirst = resHandler;
   169 
   169 
   170     CActiveScheduler::Add(resHandler);
   170     CActiveScheduler::Add(resHandler);
   171     resHandler->SetActive();
   171     if(!resHandler->IsActive())
       
   172     	resHandler->SetActive();
   172     resHandler->iStatus = KRequestPending;
   173     resHandler->iStatus = KRequestPending;
   173 
   174 
   174     TIpcArgs args(&resHandler->iProgressData, resHandler->iSoapOrCid);
   175     TIpcArgs args(&resHandler->iProgressData, resHandler->iSoapOrCid);
   175     SendReceive(ESenCliServTransferProgress, args, resHandler->iStatus);
   176     SendReceive(ESenCliServTransferProgress, args, resHandler->iStatus);
   176     }
   177     }
   222         {
   223         {
   223         resHandler->Cancel();
   224         resHandler->Cancel();
   224         CSenMessageResourceHandler* tmp = resHandler;
   225         CSenMessageResourceHandler* tmp = resHandler;
   225         resHandler = resHandler->iNext;
   226         resHandler = resHandler->iNext;
   226         delete tmp;
   227         delete tmp;
       
   228         tmp = NULL;
   227         }
   229         }
   228     RSessionBase::Close();
   230     RSessionBase::Close();
   229     }
   231     }
   230 
   232 
   231 TInt RSenConnectionServerSession::InitProgressObserver(const RMessage2& aMessage)
   233 TInt RSenConnectionServerSession::InitProgressObserver(const RMessage2& aMessage)
   258 		{
   260 		{
   259 		caSync->Start();
   261 		caSync->Start();
   260 		SendReceive(ESenCliServPrefferedCarrierAvailable, args, caSync->iStatus);
   262 		SendReceive(ESenCliServPrefferedCarrierAvailable, args, caSync->iStatus);
   261         retVal = caSync->iStatus.Int();
   263         retVal = caSync->iStatus.Int();
   262 		delete caSync;
   264 		delete caSync;
       
   265 		caSync = NULL;
   263 		}
   266 		}
   264 	return retVal;        
   267 	return retVal;        
   265 	
   268 	
   266 	}
   269 	}
   267 
   270 
   277         {
   280         {
   278         caSync->Start();		
   281         caSync->Start();		
   279         SendReceive(ESenCliServNewCarrierActive, args, caSync->iStatus);
   282         SendReceive(ESenCliServNewCarrierActive, args, caSync->iStatus);
   280         retVal = caSync->iStatus.Int();
   283         retVal = caSync->iStatus.Int();
   281         delete caSync;
   284         delete caSync;
       
   285         caSync = NULL;
   282         }
   286         }
   283     return retVal;
   287     return retVal;
   284     }
   288     }
   285 
   289 
   286 TInt RSenConnectionServerSession::MobilityError( TInt& aError )
   290 TInt RSenConnectionServerSession::MobilityError( TInt& aError )
   292         {
   296         {
   293         caSync->Start();		
   297         caSync->Start();		
   294         SendReceive(ESenCliServMobilityError, args, caSync->iStatus);
   298         SendReceive(ESenCliServMobilityError, args, caSync->iStatus);
   295         retVal = caSync->iStatus.Int();
   299         retVal = caSync->iStatus.Int();
   296         delete caSync;
   300         delete caSync;
       
   301         caSync = NULL;
   297         }
   302         }
   298     return retVal;        
   303     return retVal;        
   299     }
   304     }
   300 #endif //__ENABLE_ALR__
   305 #endif //__ENABLE_ALR__
   301 
   306 
   326 		caSync->Start();
   331 		caSync->Start();
   327 		Mem::FillZ(&asWait, sizeof(asWait));
   332 		Mem::FillZ(&asWait, sizeof(asWait));
   328 		asWait.Start();
   333 		asWait.Start();
   329 		retVal = caSync->iStatus.Int();
   334 		retVal = caSync->iStatus.Int();
   330 		delete caSync;
   335 		delete caSync;
       
   336 		caSync = NULL;
   331 		}
   337 		}
   332 	return retVal;
   338 	return retVal;
   333 	}
   339 	}
   334 
   340 
   335 CSenConnAgentSync::CSenConnAgentSync(): CActive(EPriorityStandard)
   341 CSenConnAgentSync::CSenConnAgentSync(): CActive(EPriorityStandard)
   354 	{
   360 	{
   355 	}
   361 	}
   356 
   362 
   357 void CSenConnAgentSync::Start()
   363 void CSenConnAgentSync::Start()
   358 	{
   364 	{
   359 	SetActive();
   365 	if(!IsActive())
       
   366 		SetActive();
   360 	}
   367 	}
   361 
   368 
   362 CSenClientSession* CSenClientSession::NewL(MSenServiceManager& aServer, CSenServerContext& aCtx)
   369 CSenClientSession* CSenClientSession::NewL(MSenServiceManager& aServer, CSenServerContext& aCtx)
   363     {
   370     {
   364     CSenClientSession* self = CSenClientSession::NewLC(aServer, aCtx);
   371     CSenClientSession* self = CSenClientSession::NewLC(aServer, aCtx);
   989             }
   996             }
   990         case ESenServGetIdentityProviders:
   997         case ESenServGetIdentityProviders:
   991         	{
   998         	{
   992         	CSLOG_L(iConnectionID,KMinLogLevel ,"ESenServGetIdentityProviders");
   999         	CSLOG_L(iConnectionID,KMinLogLevel ,"ESenServGetIdentityProviders");
   993         	IdentityProviders(aMessage);
  1000         	IdentityProviders(aMessage);
       
  1001 	       	CSLOG_L(iConnectionID,KMinLogLevel ,"ESenServGetIdentityProviders Completed");
   994         	break;
  1002         	break;
   995         	}
  1003         	}
   996         default:
  1004         default:
   997             {
  1005             {
   998             CSLOG(iConnectionID, KMinLogLevel ,(_L("default")));
  1006             CSLOG(iConnectionID, KMinLogLevel ,(_L("default")));
  1498     }
  1506     }
  1499 TInt CSenClientSession::ParseMessageL(TInt aTransactionId,
  1507 TInt CSenClientSession::ParseMessageL(TInt aTransactionId,
  1500                                       const TDesC8& aRequest,
  1508                                       const TDesC8& aRequest,
  1501                                       CSenAtomEntry& aAtomEntry)
  1509                                       CSenAtomEntry& aAtomEntry)
  1502     {
  1510     {
  1503 	CSLOG_L(iConnectionID, KMinLogLevel ,"CSenClientSession::ParseMessageL");
  1511 	CSLOG_L(iConnectionID, KMinLogLevel ,"CSenClientSession::ParseMessageL(aTransactionId, aRequest, aAtomEntry)");
  1504     CSenParser* pParser = CSenParser::NewLC();
  1512     CSenParser* pParser = CSenParser::NewLC();
  1505     pParser->EnableFeature(EReportNamespaceMapping);
  1513     pParser->EnableFeature(EReportNamespaceMapping);
  1506 	pParser->ParseL(aRequest, aAtomEntry);
  1514 	pParser->ParseL(aRequest, aAtomEntry);
  1507 	
  1515 	
  1508 	// handle binary containers (BLOBs / attachments)
  1516 	// handle binary containers (BLOBs / attachments)
  1549                 }
  1557                 }
  1550             }
  1558             }
  1551         }
  1559         }
  1552 	
  1560 	
  1553     CleanupStack::PopAndDestroy(pParser);
  1561     CleanupStack::PopAndDestroy(pParser);
       
  1562     CSLOG_L(iConnectionID, KMinLogLevel ,"CSenClientSession::ParseMessageL(aTransactionId, aRequest, aAtomEntry) Completed");
  1554     return KErrNone;
  1563     return KErrNone;
  1555     }    
  1564     }    
  1556 TInt CSenClientSession::ParseMessageL(TInt aTransactionId,
  1565 TInt CSenClientSession::ParseMessageL(TInt aTransactionId,
  1557                                       const TDesC8& aRequest,
  1566                                       const TDesC8& aRequest,
  1558                                       CSenSoapEnvelope2& aSoapEnvelope)
  1567                                       CSenSoapEnvelope2& aSoapEnvelope)
  1559     {
  1568     {
  1560     CSLOG_L(iConnectionID, KMinLogLevel , "CSenClientSession::ParseMessageL");
  1569     CSLOG_L(iConnectionID, KMinLogLevel , "CSenClientSession::ParseMessageL(aTransactionId, aRequest, aSoapEnvelope)");
  1561     CSenParser* pParser = CSenParser::NewLC();
  1570     CSenParser* pParser = CSenParser::NewLC();
  1562     pParser->EnableFeature(EReportNamespaceMapping);
  1571     pParser->EnableFeature(EReportNamespaceMapping);
  1563 	pParser->ParseL(aRequest, aSoapEnvelope);
  1572 	pParser->ParseL(aRequest, aSoapEnvelope);
  1564 
  1573 
  1565 
  1574 
  1649         		}        
  1658         		}        
  1650             CleanupStack::PopAndDestroy(&elementArray);
  1659             CleanupStack::PopAndDestroy(&elementArray);
  1651             }
  1660             }
  1652         }
  1661         }
  1653     CleanupStack::PopAndDestroy(pParser);
  1662     CleanupStack::PopAndDestroy(pParser);
  1654     
  1663     CSLOG_L(iConnectionID, KMinLogLevel , "CSenClientSession::ParseMessageL(aTransactionId, aRequest, aSoapEnvelope) Completed");
  1655     return retVal;
  1664     return retVal;
  1656     }
  1665     }
  1657     
  1666     
  1658 TInt CSenClientSession::SearchMsgChunk( const RMessage2& aMessage, CSenChunk*& aHit )
  1667 TInt CSenClientSession::SearchMsgChunk( const RMessage2& aMessage, CSenChunk*& aHit )
  1659     {
  1668     {
  1941                 if ( pErrorMsg )
  1950                 if ( pErrorMsg )
  1942                     {
  1951                     {
  1943                     CleanupStack::PushL( pErrorMsg );
  1952                     CleanupStack::PushL( pErrorMsg );
  1944                     }
  1953                     }
  1945                 aSenChunk.ChunkHeader().SetContextId(transactionId); // temporary
  1954                 aSenChunk.ChunkHeader().SetContextId(transactionId); // temporary
  1946                 CSLOG_FORMAT((iConnectionID, KNormalLogLevel , _L8("SendMsgL - SetContextId: %d"), transactionId));
  1955                 CSLOG_FORMAT((iConnectionID, KMinLogLevel , _L8("SendMsgL - SetContextId: %d"), transactionId));
  1947                 }
  1956                 }
  1948             else 
  1957             else 
  1949                 {
  1958                 {
  1950                 // "Add to ctx" -setter method failed, delete orphan msg:
  1959                 // "Add to ctx" -setter method failed, delete orphan msg:
  1951                 CleanupStack::PopAndDestroy(pSoapMessage);
  1960                 CleanupStack::PopAndDestroy(pSoapMessage);
  3737     delete msg;
  3746     delete msg;
  3738     return err;
  3747     return err;
  3739     }
  3748     }
  3740 void CSenClientSession::AddCredentialL( const RMessage2& aMessage )
  3749 void CSenClientSession::AddCredentialL( const RMessage2& aMessage )
  3741     {
  3750     {
       
  3751     CSLOG(iConnectionID, KMinLogLevel ,(_L("CSenClientSession::AddCredentialL()")));
  3742     TInt retVal(KErrNone);
  3752     TInt retVal(KErrNone);
  3743     CSenChunk* pSenChunk = NULL;
  3753     CSenChunk* pSenChunk = NULL;
  3744 
  3754 
  3745     pSenChunk = CSenChunk::NewLC(KNullDesC);
  3755     pSenChunk = CSenChunk::NewLC(KNullDesC);
  3746     pSenChunk->SetLogger(Log());
  3756     pSenChunk->SetLogger(Log());
  3849                 	
  3859                 	
  3850                 	// Following takes the ownership of pIdp and pCredential
  3860                 	// Following takes the ownership of pIdp and pCredential
  3851                     iManager.AddCredentialL(pIdP, pCredential, retVal);
  3861                     iManager.AddCredentialL(pIdP, pCredential, retVal);
  3852                     
  3862                     
  3853                   	RWSDescriptionArray aMatches;
  3863                   	RWSDescriptionArray aMatches;
  3854                     	iManager.ServiceDescriptionsL(aMatches,*pSD);
  3864                     iManager.ServiceDescriptionsL(aMatches,*pSD);
  3855                	CleanupClosePushL(aMatches);
  3865                		CleanupClosePushL(aMatches);
  3856 
  3866 
  3857                     	for(TInt i = 0; i < aMatches.Count(); i++)
  3867                   	for(TInt i = 0; i < aMatches.Count(); i++)
  3858                     	{
  3868                   		{
  3859                     		((CSenWebServiceSession*)aMatches[i])->AddCredentialObserverL(*pCredential);
  3869                       	if(((CSenWebServiceSession*)aMatches[i]) && pCredential)
  3860                     	}
  3870                           {
  3861 
  3871 	                      CSLOG_FORMAT((iConnectionID, KMinLogLevel , _L8("SD Type is = %d"), aMatches[i]->DescriptionClassType()));						  
       
  3872                           if( aMatches[i]->HasSuperClass( MSenServiceDescription::EServiceSession ) )
       
  3873                           	{
       
  3874                             CSLOG(iConnectionID, KMinLogLevel ,(_L("CSenClientSession::AddCredentialL() - Calling AddCredentialObserverL()")));
       
  3875                             ((CSenWebServiceSession*)aMatches[i])->AddCredentialObserverL(*pCredential);
       
  3876                             CSLOG(iConnectionID, KMinLogLevel ,(_L("CSenClientSession::AddCredentialL() - Completed AddCredentialObserverL()")));
       
  3877                           	}
       
  3878                           else
       
  3879                           	{
       
  3880                           	CSLOG(iConnectionID, KMinLogLevel ,(_L("CSenClientSession::AddCredentialL() - SD is not the session object !!! ")));
       
  3881                           	}	
       
  3882                           }
       
  3883                   		}
       
  3884                   		
  3862                      CleanupStack::PopAndDestroy(&aMatches);
  3885                      CleanupStack::PopAndDestroy(&aMatches);
  3863                     
  3886                     
  3864                     CleanupStack::Pop(pCredential);
  3887                     CleanupStack::Pop(pCredential);
  3865                     CleanupStack::Pop(pIdP);
  3888                     CleanupStack::Pop(pIdP);
  3866                                         
  3889                                         
  3871         }
  3894         }
  3872 
  3895 
  3873     CleanupStack::PopAndDestroy(pSenChunk);
  3896     CleanupStack::PopAndDestroy(pSenChunk);
  3874         
  3897         
  3875     aMessage.Complete(retVal);
  3898     aMessage.Complete(retVal);
       
  3899     CSLOG(iConnectionID, KMinLogLevel ,(_L("CSenClientSession::AddCredentialL() Completed")));
  3876     }
  3900     }
  3877 
  3901 
  3878 void CSenClientSession::CredentialsL( const RMessage2& aMessage )
  3902 void CSenClientSession::CredentialsL( const RMessage2& aMessage )
  3879     {
  3903     {
  3880     _LIT8(KNoProperties, "-");
  3904     _LIT8(KNoProperties, "-");
  4241             {
  4265             {
  4242             TInt* pTxnId = txnIds[i];
  4266             TInt* pTxnId = txnIds[i];
  4243             TInt cancelledTxnId(*pTxnId);
  4267             TInt cancelledTxnId(*pTxnId);
  4244             txnIds.Remove(i);
  4268             txnIds.Remove(i);
  4245             delete pTxnId;
  4269             delete pTxnId;
       
  4270             pTxnId = NULL;
  4246             CSLOG_FORMAT((iConnectionID, KNormalLogLevel , _L8("- Now processing txn with id %d"), cancelledTxnId));
  4271             CSLOG_FORMAT((iConnectionID, KNormalLogLevel , _L8("- Now processing txn with id %d"), cancelledTxnId));
  4247 
  4272 
  4248 
  4273 
  4249             // Attempt to cancel the actual activity on the transport layer.
  4274             // Attempt to cancel the actual activity on the transport layer.
  4250             // Note that even if transport will not cancel this transaction,
  4275             // Note that even if transport will not cancel this transaction,
  5542     if ( retVal == KErrNone )
  5567     if ( retVal == KErrNone )
  5543         {
  5568         {
  5544         const RPointerArray<CSenIdentityProvider> pIdps = ((MSenCoreServiceManager&)iManager).IdentityProvidersL();
  5569         const RPointerArray<CSenIdentityProvider> pIdps = ((MSenCoreServiceManager&)iManager).IdentityProvidersL();
  5545         
  5570         
  5546         const TInt count = pIdps.Count();
  5571         const TInt count = pIdps.Count();
       
  5572         CSLOG_FORMAT((iConnectionID, KMinLogLevel , _L8("- TOTAL IDP Found: %d"), count));		
  5547   
  5573   
  5548         // Calculate required heap allocation size:
  5574         // Calculate required heap allocation size:
  5549         TInt size(0);
  5575         TInt size(0);
  5550         if(count>0)
  5576         if(count>0)
  5551             {
  5577             {
  5656                 
  5682                 
  5657                 pBuf = NULL;
  5683                 pBuf = NULL;
  5658                 }
  5684                 }
  5659             CSLOG_L(iConnectionID,KMaxLogLevel ,"- Requested descriptions:");
  5685             CSLOG_L(iConnectionID,KMaxLogLevel ,"- Requested descriptions:");
  5660             CSLOG_ALL(iConnectionID,KMaxLogLevel ,(*pIdPrs));
  5686             CSLOG_ALL(iConnectionID,KMaxLogLevel ,(*pIdPrs));
       
  5687 		     CSLOG_L(iConnectionID,KMinLogLevel ,"CSenClientSession::IdentityProviders completed");			
  5661             }
  5688             }
  5662     #ifdef _SENDEBUG
  5689     #ifdef _SENDEBUG
  5663         else
  5690         else
  5664             {
  5691             {
  5665             CSLOG_FORMAT((iConnectionID, KNormalLogLevel , _L8("- AllocDescToRMsgL failed: %d"), retVal));
  5692             CSLOG_FORMAT((iConnectionID, KMinLogLevel , _L8("- AllocDescToRMsgL failed: %d"), retVal));
  5666             }
  5693             }
  5667     #endif // _SENDEBUG
  5694     #endif // _SENDEBUG
  5668 
  5695 
  5669         }
  5696         }
  5670     CleanupStack::PopAndDestroy(pSenChunk); // Close SenChunk
  5697     CleanupStack::PopAndDestroy(pSenChunk); // Close SenChunk