webservices/wsstar/wsstarplugin/src/wsstarplugin.cpp
changeset 28 0802db42e4e9
parent 1 272b002df977
equal deleted inserted replaced
2:150a13bad6af 28:0802db42e4e9
   752 void CWSStarPlugin::RemoveHandler(const TDesC8& aCue)
   752 void CWSStarPlugin::RemoveHandler(const TDesC8& aCue)
   753     {
   753     {
   754     TInt count = iMsgHandlers.Count();
   754     TInt count = iMsgHandlers.Count();
   755     for(TInt i=0;i<count; i++)
   755     for(TInt i=0;i<count; i++)
   756         {
   756         {
   757         if (iMsgHandlers[i]->Name() == aCue)
   757         if( iMsgHandlers[i] && (iMsgHandlers[i]->Name() == aCue) )
   758             {
   758             {
   759             delete iMsgHandlers[i];
   759             delete iMsgHandlers[i];
   760             iMsgHandlers.Remove(i);
   760             iMsgHandlers.Remove(i);
   761             return;
   761             return;
   762             }
   762             }
   763         }
   763         }
   764     count = iSessionHandlers.Count();
   764     count = iSessionHandlers.Count();
   765     for(TInt i=0;i<count; i++)
   765     for(TInt i=0;i<count; i++)
   766         {
   766         {
   767         if (iSessionHandlers[i]->Name() == aCue)
   767         if( iSessionHandlers[i] && (iSessionHandlers[i]->Name() == aCue) )
   768             {
   768             {
   769             delete iSessionHandlers[i];
   769             delete iSessionHandlers[i];
   770             iSessionHandlers.Remove(i);
   770             iSessionHandlers.Remove(i);
   771             return;
   771             return;
   772             }
   772             }
   787     CWSStarSessionContext* pSessionValidateCtx = ((CWSStarServiceSession*)aRemoteServiceSession)->SessionContext();
   787     CWSStarSessionContext* pSessionValidateCtx = ((CWSStarServiceSession*)aRemoteServiceSession)->SessionContext();
   788     if (!pSessionValidateCtx) //sessionCts exist if revalidation is processing
   788     if (!pSessionValidateCtx) //sessionCts exist if revalidation is processing
   789         {
   789         {
   790         CWSStarPolicyHandler* policyHandler = (CWSStarPolicyHandler*)Handler(WSStarConfig::KPolicyValue);
   790         CWSStarPolicyHandler* policyHandler = (CWSStarPolicyHandler*)Handler(WSStarConfig::KPolicyValue);
   791         pSessionValidateCtx = CWSStarSessionContext::NewLC(Manager().XMLReader(), &aPattern, policyHandler);
   791         pSessionValidateCtx = CWSStarSessionContext::NewLC(Manager().XMLReader(), &aPattern, policyHandler);
   792         pSessionValidateCtx->Add(WSStarContextKeys::KServiceSession(), *(MSenRemoteServiceSession*)aRemoteServiceSession);
   792         if(pSessionValidateCtx)
       
   793         	pSessionValidateCtx->Add(WSStarContextKeys::KServiceSession(), *(MSenRemoteServiceSession*)aRemoteServiceSession);
   793         ((CWSStarServiceSession*)aRemoteServiceSession)->SetSessionContext(pSessionValidateCtx);
   794         ((CWSStarServiceSession*)aRemoteServiceSession)->SetSessionContext(pSessionValidateCtx);
   794         CleanupStack::Pop(pSessionValidateCtx);
   795         CleanupStack::Pop(pSessionValidateCtx);
   795         }
   796         }
   796     else
   797     else
   797         {
   798         {
   798         pSessionValidateCtx->Update(WSStarContextKeys::KServiceSession(), *(MSenRemoteServiceSession*)aRemoteServiceSession);
   799         if(pSessionValidateCtx)
       
   800         	pSessionValidateCtx->Update(WSStarContextKeys::KServiceSession(), *(MSenRemoteServiceSession*)aRemoteServiceSession);
   799         }
   801         }
   800     TInt error(KErrNone);
   802     TInt error(KErrNone);
   801     TRAPD(errorL, error = pSTShandler->InvokeL(*pSessionValidateCtx));
   803     TRAPD(errorL, error = pSTShandler->InvokeL(*pSessionValidateCtx));
   802     if ( error )
   804     if ( error )
   803         {
   805         {
   839         if ( pNotOwnedErrorMsg )
   841         if ( pNotOwnedErrorMsg )
   840             {
   842             {
   841             aErrorMessage = pNotOwnedErrorMsg->AllocL();
   843             aErrorMessage = pNotOwnedErrorMsg->AllocL();
   842             }
   844             }
   843         }
   845         }
   844     
   846 
   845     
       
   846     
       
   847     if (cberrorL!=KErrNone)
   847     if (cberrorL!=KErrNone)
   848         {
   848         {
   849         TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("CWSStarPlugin::ProcessOutboundValidationL() !!!!leave from validate handler")));
   849         TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("CWSStarPlugin::ProcessOutboundValidationL() !!!!leave from validate handler")));
   850         error = cberrorL;
   850         error = cberrorL;
   851         }
   851         }
  1049 void CWSStarPlugin::GenerateDeviceIdL()
  1049 void CWSStarPlugin::GenerateDeviceIdL()
  1050     {
  1050     {
  1051     CSenGuidGen* pGuidGenerator = CSenGuidGen::NewLC();
  1051     CSenGuidGen* pGuidGenerator = CSenGuidGen::NewLC();
  1052     delete iDeviceId;
  1052     delete iDeviceId;
  1053     iDeviceId = NULL;
  1053     iDeviceId = NULL;
  1054     iDeviceId = pGuidGenerator->GetRandomGuid8LC();
  1054     if(pGuidGenerator)
       
  1055     	iDeviceId = pGuidGenerator->GetRandomGuid8LC();
  1055     TPtr8 deviceIdDes = iDeviceId->Des();
  1056     TPtr8 deviceIdDes = iDeviceId->Des();
  1056     deviceIdDes.LowerCase();
  1057     deviceIdDes.LowerCase();
  1057     CleanupStack::Pop(iDeviceId);
  1058     CleanupStack::Pop(iDeviceId);
  1058     CleanupStack::PopAndDestroy(pGuidGenerator);
  1059     CleanupStack::PopAndDestroy(pGuidGenerator);
  1059     }
  1060     }