Revision: 201017 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 17:14:12 +0300
branchRCL_3
changeset 14 9e96e2676219
parent 12 48e9d43c1d7f
child 15 32ab7ae9ec94
Revision: 201017 Kit: 201019
webservices/wsconnection/src/senserviceconnectionimpl.cpp
webservices/wsconnection/src/senservicedispatcher.cpp
webservices/wscore/src/senclientsession.cpp
webservices/wsframework/src/senwebservicesession.cpp
webservices/wshttpchanneltransportplugin/inc/senhttpchannel.h
webservices/wshttpchanneltransportplugin/inc/senhttpchannelimpl.h
webservices/wshttpchanneltransportplugin/inc/senhttpchanneltransportplugin.h
webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp
webservices/wshttpchanneltransportplugin/src/senhttpchanneltransportplugin.cpp
webservices/wsmanager/src/senservicemanagerimpl.cpp
webservices/wsoviplugin/src/wsoviservicesession.cpp
--- a/webservices/wsconnection/src/senserviceconnectionimpl.cpp	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wsconnection/src/senserviceconnectionimpl.cpp	Tue May 11 17:14:12 2010 +0300
@@ -922,7 +922,7 @@
 
         TInt appendRetVal(KErrNone);
         appendRetVal = ChunkMapL().Append( pTxnId, apClientOp );
-        TLSLOG_FORMAT((KSenServiceConnectionLogChannelBase+iConnectionID, KNormalLogLevel , _L8("- ChunkMapL().Append(%d, %d) returned: %d"), *pTxnId, apClientOp->Chunk().Handle(), appendRetVal));
+        TLSLOG_FORMAT((KSenServiceConnectionLogChannelBase+iConnectionID, KMinLogLevel , _L8("- ChunkMapL().Append(%d, %d) returned: %d"), *pTxnId, apClientOp->Chunk().Handle(), appendRetVal));
         if( appendRetVal == KErrNone )
             {
             TMessage msg;
--- a/webservices/wsconnection/src/senservicedispatcher.cpp	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wsconnection/src/senservicedispatcher.cpp	Tue May 11 17:14:12 2010 +0300
@@ -314,6 +314,7 @@
     }
 TBool CSenServiceDispatcher::RemoveFromQueue(TInt aTransactionID)
     {
+    TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, _L("CSenServiceDispatcher::RemoveFromQueue - VrtlTxnID (%d)"), aTransactionID));
     //This method gets called from two places 1)main thread from
     //CancelTransaction(aTransactionID) method and 2)child thread from
     //ExecuteL method once message has been dispacthed.
@@ -370,6 +371,7 @@
 
 TInt CSenServiceDispatcher::AddToTheTransMap(TInt* pVrtlaTxnId,TInt* pActlTxnId)
     {
+    TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, _L("CSenServiceDispatcher::AddToTheTransMap - VrtlTxnID [%d], ActlTxnId [%d]"), pVrtlaTxnId, pActlTxnId));
     TInt returnValue = KErrNone;
     //Wait on transaction map critical section if it is locked, and then add to 
     //the map.
@@ -384,6 +386,7 @@
 
 TInt CSenServiceDispatcher::RemoveFromTransMap(TInt* pVrtlaTxnId)
     {
+    TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, _L("CSenServiceDispatcher::RemoveFromTransMap - VrtlTxnID [%d]"), pVrtlaTxnId));
     TInt returnValue = KErrNone;
     //Is called from the main thread after we recieve the response.
     returnValue = TransactionMap().Find(*pVrtlaTxnId);
@@ -398,6 +401,7 @@
 
 TInt CSenServiceDispatcher::UpdateTransMap(TInt* pVrtlaTxnId,TInt* pActlTxnId)
     {
+    TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, _L("CSenServiceDispatcher::UpdateTransMap - VrtlTxnID [%d], ActlTxnId [%d]"), pVrtlaTxnId, pActlTxnId));
     TInt returnValue = KErrNone;
     //Is called from the main thread from HandleMessageChildAOL method.
     //Typically gets called when ESenReAuthAndResendNeeded and ESenResendNeeded
--- a/webservices/wscore/src/senclientsession.cpp	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wscore/src/senclientsession.cpp	Tue May 11 17:14:12 2010 +0300
@@ -998,6 +998,7 @@
         	{
         	CSLOG_L(iConnectionID,KMinLogLevel ,"ESenServGetIdentityProviders");
         	IdentityProviders(aMessage);
+	       	CSLOG_L(iConnectionID,KMinLogLevel ,"ESenServGetIdentityProviders Completed");
         	break;
         	}
         default:
@@ -5552,6 +5553,7 @@
         const RPointerArray<CSenIdentityProvider> pIdps = ((MSenCoreServiceManager&)iManager).IdentityProvidersL();
         
         const TInt count = pIdps.Count();
+        CSLOG_FORMAT((iConnectionID, KMinLogLevel , _L8("- TOTAL IDP Found: %d"), count));		
   
         // Calculate required heap allocation size:
         TInt size(0);
@@ -5666,11 +5668,12 @@
                 }
             CSLOG_L(iConnectionID,KMaxLogLevel ,"- Requested descriptions:");
             CSLOG_ALL(iConnectionID,KMaxLogLevel ,(*pIdPrs));
+		     CSLOG_L(iConnectionID,KMinLogLevel ,"CSenClientSession::IdentityProviders completed");			
             }
     #ifdef _SENDEBUG
         else
             {
-            CSLOG_FORMAT((iConnectionID, KNormalLogLevel , _L8("- AllocDescToRMsgL failed: %d"), retVal));
+            CSLOG_FORMAT((iConnectionID, KMinLogLevel , _L8("- AllocDescToRMsgL failed: %d"), retVal));
             }
     #endif // _SENDEBUG
 
--- a/webservices/wsframework/src/senwebservicesession.cpp	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wsframework/src/senwebservicesession.cpp	Tue May 11 17:14:12 2010 +0300
@@ -631,6 +631,7 @@
                                                            MSenRemoteServiceConsumer& aConsumer,
                                                            MSenProperties* aResponseTransportProperties )
     {
+    CSLOG_FORMAT((aConsumer.ConnectionId() , KMinLogLevel, _L8("CSenWebServiceSession::SendErrorToConsumerL - aErrorCode [%d]"), aErrorCode));
     CleanupStack::PushL(apError);
     TInt retVal(KErrNone);
 
--- a/webservices/wshttpchanneltransportplugin/inc/senhttpchannel.h	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wshttpchanneltransportplugin/inc/senhttpchannel.h	Tue May 11 17:14:12 2010 +0300
@@ -158,7 +158,9 @@
     virtual void EnableTimeOutL(TInt aTxnId, TInt aTimeOutSec) = 0;
     virtual void DisableTimeOutL(TInt aTxnId) = 0;
     virtual TInt32 UsedIap() = 0;
-    
+    virtual void ResetIapId() = 0;
+    virtual void ResetUsedIapId() = 0;
+    virtual void SetExplicitIapDefined(TBool aExplicitIapDefined) = 0;
     };
 
 #endif // SEN_HTTP_CHANNEL_H
--- a/webservices/wshttpchanneltransportplugin/inc/senhttpchannelimpl.h	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wshttpchanneltransportplugin/inc/senhttpchannelimpl.h	Tue May 11 17:14:12 2010 +0300
@@ -107,7 +107,7 @@
     TInt CancelTransaction(const TInt aTxnId);
     void CancelAllTransactions();
 
-    void SetExplicitIapDefined(TBool aExplicitIapDefined);
+    virtual void SetExplicitIapDefined(TBool aExplicitIapDefined);
     /*
     * Getter for currently effective IAP ID
     * @param aIapId will be assigned to hold
@@ -131,6 +131,8 @@
     void EnableTimeOutL(TInt aTxnId, TInt aTimeOutSec);
     void DisableTimeOutL(TInt aTxnId);
     virtual TInt32 UsedIap();
+    virtual void ResetIapId();
+    virtual void ResetUsedIapId();
     
 protected:
     CSenHttpChannelImpl(MSenIdentityManager& aManager);
--- a/webservices/wshttpchanneltransportplugin/inc/senhttpchanneltransportplugin.h	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wshttpchanneltransportplugin/inc/senhttpchanneltransportplugin.h	Tue May 11 17:14:12 2010 +0300
@@ -303,6 +303,7 @@
         //RFileLogger iLogger;
         TInt iStatusCode; // containts latest error or zero
 		TSenDataTrafficDetails iDetails;
+		TBool iIsConnectionFailed;
     };
 
 #endif // SEN_HTTP_CHANNEL_TRANSPORT_PLUGIN_H
--- a/webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp	Tue May 11 17:14:12 2010 +0300
@@ -16,15 +16,6 @@
 */
 
 
-
-
-
-
-
-
-
-
-
 #include <uri8.h>
 #include <es_sock.h>
 #include <in_sock.h>
@@ -185,10 +176,6 @@
 // Ask IAP from user
 void CSenHttpChannelImpl::ConstructL()
     {
-    // Open connection to the file logger server
-    TLSLOG_OPEN(KSenHttpChannelLogChannelBase, KSenHttpChannelLogLevel, KSenHttpChannelLogDir, KSenHttpChannelLogFile);
-    TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::ConstructL - Log file opened")));
-
     // Open the RHTTPSession
     TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("- Opening HTTP/TCP session.")));
 
@@ -252,10 +239,11 @@
 #ifndef __ENABLE_ALR__
 	IsOCCImplementedSDK();
 #endif	
-
-    const TInt result = SetIapPrefsL(aIapId, ETrue, iConnection, iSockServ);
-    User::LeaveIfError( result );
-    
+	if(aIapId > 0)
+		{
+    	const TInt result = SetIapPrefsL(aIapId, ETrue, iConnection, iSockServ);
+    	User::LeaveIfError( result );
+    	}
     }
 
 CSenHttpChannelImpl::~CSenHttpChannelImpl()
@@ -292,18 +280,16 @@
         
     iConnection.Close();
     iSockServ.Close();
-
-    // Close the log file and the connection to the server.
-    TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("Log file closed.")));
-    TLSLOG_CLOSE(KSenHttpChannelLogChannelBase);
+    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::~CSenHttpChannelImpl() Completed");
     }
 
 TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
    	{
-   	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetIapPrefsL	, IAP ID (%d)"), aIapId));
+   	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetIapPrefsL	, aIapId (%d)"), aIapId));
+   	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetIapPrefsL	, iIapId (%d)"), iIapId));
    	
     // Check whether IAP ID is not equal with the one that is currently in effect:
-    if(iExplicitIapDefined && iIapId == aIapId )
+    if(iExplicitIapDefined || iIapId == aIapId && iIapId > 0)
         {
         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect");
         return KErrNone;
@@ -323,13 +309,21 @@
         }
     else
         {
-        // Connect to a socket server    
-        TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Connecting to new socket server");    
-        User::LeaveIfError( aSocketServer.Connect() );       
-
-        // Open new connection
-        TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Opening new RConnection using the socket server.");       
-        User::LeaveIfError( aConnection.Open(aSocketServer) ); 
+        if(aConnection.SubSessionHandle())
+        	{
+            TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
+        	aConnection.Stop();
+        	}
+        else
+            {
+            // Connect to a socket server    
+            TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Connecting to new socket server");    
+            User::LeaveIfError( aSocketServer.Connect() );       
+    
+            // Open new connection
+            TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Opening new RConnection using the socket server.");       
+            User::LeaveIfError( aConnection.Open(aSocketServer) );        
+            }
         }
         
     // Set the IAP selection preferences (IAP ID, do not prompt)    
@@ -419,17 +413,39 @@
 			//TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection");
 			//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
 			//extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
-			extPrefs.SetIapId(aId);
-			extPrefs.SetSnapId(0);
+			if(aId != 0)
+				{
+				extPrefs.SetIapId(aId);
+				extPrefs.SetSnapId(0);
+				}
+			else
+				{
+				extPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet);
+				extPrefs.SetConnSelectionDialog(ETrue);
+				}
 			prefList.AppendL(&extPrefs);
 			retVal = aConnection.Start(prefList);
 			if(retVal == KErrNone)
 			    {
-			    iIapId = aId;
+			    if(aId == 0)
+			    	{
+                    aConnection.GetIntSetting( _L("IAP\\Id"), iIapId);
+                    TName name;
+                    retVal = aConnection.Name(name);
+                    if(retVal == KErrNone)
+                        {
+                        TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP Name [%S]"), &name));
+                        }
+                    TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("GetIntSetting returned IAP [%d]"), iIapId));			    
+			    	}
+			    else
+			    	{	
+			    	iIapId = aId;
+			    	}
 			    }
 			 else
 			    {
-				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP ->Start retVal [%d]"), retVal));
+                TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP ->Start retVal [%d]"), retVal));
 			    }
 		    }
 		else
@@ -457,6 +473,7 @@
 				TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting SnapPurpose Internet");
 				if(aDialogPref) //If it fails because of unavailibility of access points
 					{
+					TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Fails because of unavailibility of access points");
 					extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
 					extPrefs.SetConnSelectionDialog(ETrue);
 					}
@@ -474,6 +491,7 @@
 				extPrefs.SetConnSelectionDialog(EFalse);
 				}
 			prefList.AppendL(&extPrefs);
+			TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "SetID: RConnection Start");
 			retVal = aConnection.Start(prefList);
 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection Start retval[%d]"), retVal));
 			if(retVal == KErrNone)
@@ -494,7 +512,7 @@
 		    }
 		}    
 #endif    
-    if (!retVal)
+    if (!retVal && !aSNAP)
         {
         iExplicitIapDefined = ETrue;
         }	
@@ -505,7 +523,7 @@
     {
     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- CSenHttpChannelImpl::SetSnapPrefsL, SNAP ID (%d)"), aSnapId));
 		// Check whether SNAP ID is not equal with the one that is currently in effect:
-    if(iExplicitIapDefined && iSnapId == aSnapId )
+    if(iExplicitIapDefined && iSnapId == aSnapId)
         {
         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is same as currently in effect");
         return KErrNone;
@@ -524,13 +542,21 @@
         }
     else
         {
-        // Connect to a socket server    
-        TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Connecting to new socket server");    
-        User::LeaveIfError( aSocketServer.Connect() );       
-
-        // Open new connection
-        TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Opening new RConnection using the socket server.");       
-        User::LeaveIfError( aConnection.Open(aSocketServer) ); 
+        if(aConnection.SubSessionHandle())
+        	{
+            TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
+        	aConnection.Stop();
+        	}
+        else
+            {
+            // Connect to a socket server    
+            TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Connecting to new socket server");    
+            User::LeaveIfError( aSocketServer.Connect() );       
+    
+            // Open new connection
+            TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Opening new RConnection using the socket server.");       
+            User::LeaveIfError( aConnection.Open(aSocketServer) );         
+            }
         }
         
         
@@ -557,7 +583,7 @@
     // there is NO direct API to query effective SNAP ID from CommsDB.
     if (!retVal)
         {
-        iExplicitIapDefined = ETrue;
+        //iExplicitIapDefined = ETrue;
         iSnapId = aSnapId;
         }
     return retVal;
@@ -697,13 +723,20 @@
         // => only if property is set, and has value "FALSE", show PROMPT            
         prompt = ETrue;
         }
-
+	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL - iIapId [%d]"), iIapId)); 
 #ifndef __ENABLE_ALR__
+		TInt propRetVal = aProps.IapIdL(id);
     // Independent of dialog preference (property's existance), if IAP was predefined, it must be set        
-    if(((aProps.IapIdL(id)) == KErrNone))
+    if(propRetVal == KErrNone)
         {
+        TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL SetIapPrefs - id [%d]"), id));
         retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
         }
+    else if(iIapId > 0)
+        {
+        TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::InvokeHttpMethodL SetIapPrefs - iIapId [%d]"), iIapId)); 
+        retVal = SetIapPrefsL(iIapId, prompt, iConnection, iSockServ);
+        }
     else if(((aProps.SnapIdL(id)) == KErrNone))
         {
         retVal = SetSnapPrefsL(id, prompt, iConnection, iSockServ);
@@ -726,7 +759,8 @@
     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Set Snap/IAP prefs retVal [%d]"), retVal));    
     User::LeaveIfError(retVal);
     TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL After User::Leave");
-    TInt ret= iConnection.GetIntSetting(_L("IAP\\Id"), iUsedIapId);
+    //TInt ret= iConnection.GetIntSetting(_L("IAP\\Id"), iUsedIapId);
+    iUsedIapId = iIapId;
     // Check transport properties
     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));
 #else
@@ -1588,6 +1622,7 @@
 void CSenHttpChannelImpl::HandleRunErrorL(RHTTPTransaction aTransaction,
                                           TInt aError)
     {
+    TLSLOG_L(KSenHttpChannelLogChannelBase , KMaxLogLevel,"CSenHttpChannelImpl::HandleRunErrorL()");
     TInt txnId = aTransaction.Id();
     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::HandleRunErrorL( %d ): %d"),txnId, aError));
     CSenTxnState* pTxnState = FindTxnState(txnId);
@@ -1598,6 +1633,7 @@
     pTxnState->ResponseErrorL(aError);
     DeleteTxnState(txnId);
     aTransaction.Close();
+    TLSLOG_L(KSenHttpChannelLogChannelBase , KMaxLogLevel,"CSenHttpChannelImpl::HandleRunErrorL() Completed");
     }
 
 void CSenHttpChannelImpl::HandleRedirectRequiresConfirmationL(
@@ -1905,22 +1941,25 @@
 
 TBool CSenHttpChannelImpl::EffectiveIapId( TUint32 &aIapId )
     {
-	TInt handle = iConnection.SubSessionHandle();
+    /*
+		TInt handle = iConnection.SubSessionHandle();
 		if (handle>0)
 		    {
-			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), handle ));	    
-	        TUint connEnum(0);
-	        TInt err = iConnection.EnumerateConnections(connEnum);
-	        if (!err && !connEnum)
-	            {
-	            return EFalse;
-	            }
+				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), handle ));	    
+        TUint connEnum(0);
+        TInt err = iConnection.EnumerateConnections(connEnum);
+        TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId -  EnumerateConnections retVal [%d]"), err ));
+        if (!err && !connEnum)
+            {
+            TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::EffectiveIapId returns");
+            return EFalse;
+            }
 		    }
 	    else
 		    {
 		    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized.");	
 		    }
-
+		*/
 	if( iExplicitIapDefined )
 		{
 		TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8(" - IAP ID is known: %d"), iIapId ));
@@ -1930,24 +1969,25 @@
 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," - IAP ID is not known.");
 		}
 		    
-    if( handle && !iExplicitIapDefined )
-    	{
+  if(/* handle && */!iExplicitIapDefined )
+  	{
 		// Eventhough IAP was not explicitely set (through Serene API), this
 		// code can check what IAP end-user provided via IAP selection dialog:
 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::EffectiveIapId: about to call RConnection::GetIntSetting()");
-		_LIT( KIapIdKey, "IAP\\Id" );
-	    iConnection.GetIntSetting( KIapIdKey, iIapId);
-	    if ( iIapId > 0 )
-	    	{
+	//_LIT( KIapIdKey, "IAP\\Id" );
+    //iConnection.GetIntSetting( KIapIdKey, iIapId);
+    if ( iIapId > 0 )
+    	{
 			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("---- GetIntSetting(): retuens IAP(%d)"), iIapId ));
-	    	// Treat the end-user selection as "explicit" definition as well(!):
-	    	iExplicitIapDefined = ETrue; 
-	    	}
-	    }
-    if( iExplicitIapDefined )
-        {
-        aIapId = iIapId;
-        }
+    	// Treat the end-user selection as "explicit" definition as well(!):
+    	iExplicitIapDefined = ETrue; 
+    	}
+    }
+  if( iExplicitIapDefined )
+      {
+      aIapId = iIapId;
+      }
+  	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId() returns(%d)"), iExplicitIapDefined ));
     return iExplicitIapDefined;
     }
 
@@ -1968,4 +2008,17 @@
     {
     return iUsedIapId;
     }
+    
+void CSenHttpChannelImpl::ResetIapId()
+    {
+    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::ResetIapId()");
+    iIapId = 0; //Reset to Zero in case of errors to enable other IAP
+    }
+		
+void CSenHttpChannelImpl::ResetUsedIapId()
+    {
+    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::ResetUsedIapId()");
+    iUsedIapId = 0; //Reset to Zero in case of errors to enable other IAP
+    }
+    
 // END OF FILE
--- a/webservices/wshttpchanneltransportplugin/src/senhttpchanneltransportplugin.cpp	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wshttpchanneltransportplugin/src/senhttpchanneltransportplugin.cpp	Tue May 11 17:14:12 2010 +0300
@@ -104,7 +104,8 @@
     iProperties(NULL),
     iConsumerMap(EFalse, ETrue), 
     iSessionMap(EFalse, EFalse), // iConsumerMap deletes the txnIds (using same "new reserved" TInt here!)
-    iStatusCode(0)
+    iStatusCode(0),
+    iIsConnectionFailed(EFalse)
     {
     }
 
@@ -124,6 +125,10 @@
     delete ipCtx;
     ipCtx = NULL;
 
+    // Close the log file and the connection to the server.
+    TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("SenHttpChannel - Log file closed.")));
+    TLSLOG_CLOSE(KSenHttpChannelLogChannelBase);
+
     TLSLOG(KSenHttpChannelObserverLogChannelBase,KMinLogLevel,(_L("Got last data chunk.")));
     TLSLOG_CLOSE(KSenHttpChannelObserverLogChannelBase);
     }
@@ -135,6 +140,10 @@
     TLSLOG_L(KSenHttpChannelObserverLogChannelBase,KMinLogLevel,"CSenHttpChannelTransportPlugin::ConstructL(): log file opened.");
     TLSLOG_L(KSenHttpChannelObserverLogChannelBase,KMinLogLevel,"CSenHttpChannelTransportPlugin::ConstructL - Version 2 [2006-05-09]");
 
+    // Open connection to the file logger server
+    TLSLOG_OPEN(KSenHttpChannelLogChannelBase, KSenHttpChannelLogLevel, KSenHttpChannelLogDir, KSenHttpChannelLogFile);
+    TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("SenHttpChannel - Log file opened")));
+
     if( ipCtx )
         {
         // Attempt to find pre-defined IAP ID from transport context
@@ -455,10 +464,29 @@
 // Method to catch async error responses from httpchannel
 void CSenHttpChannelTransportPlugin::ResponseErrorL(TInt aRequestId, TInt aErrorCode, HBufC8* apErrorBody,CSenHttpTransportProperties* aHttpProperties)
     {
+    TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KMinLogLevel, _L8("CSenHttpChannelTransportPlugin::ResponseErrorL() - aErrorCode [%d]"), aErrorCode));
     CleanupStack::PushL(apErrorBody);
-    iHttpChannel->DisableTimeOutL(aRequestId);
+    if( (aErrorCode < KErrNone) && (apErrorBody == NULL) || aErrorCode == KErrAbort)
+    	{
+    	TLSLOG_L(KSenHttpChannelObserverLogChannelBase,KMinLogLevel,"CSenHttpChannelTransportPlugin::ResponseErrorL() Set iIsConnectionFailed True");
+    	iHttpChannel->ResetIapId();
+    	iHttpChannel->ResetUsedIapId();
+    	iHttpChannel->SetExplicitIapDefined(EFalse);
+    	iIsConnectionFailed = ETrue;
+    	TUint32 zeroIap = 0;
+			TBuf8<128> buf;
+	    buf.AppendFormat(_L8("%u"), zeroIap);
+    	LayeredPropertiesL().SetPropertyL(KIapIdLocalName, buf); //Reset the layered properties in case of wrong IAP
+    	}
+    else
+    	{
+    	iHttpChannel->SetExplicitIapDefined(ETrue);
+    	}	
+    if(iHttpChannel)
+    	{
+    	iHttpChannel->DisableTimeOutL(aRequestId);
+    	}
 #ifdef _SENDEBUG    
-    TLSLOG_L(KSenHttpChannelObserverLogChannelBase,KMinLogLevel,"CSenHttpChannelTransportPlugin::ResponseErrorL:");
     TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KNormalLogLevel, _L8("- Request's txnID: %d"), aRequestId));
     if ( apErrorBody )
         {
@@ -558,11 +586,12 @@
     // ALWAYS HANDLE IAP ID FIRST, SINCE IT *CAN RESET* HTTPCHANNEL!
     
     TUint32 iapId(KErrNone);
-
     retVal = LayeredPropertiesL().IapIdL(iapId);
-    if(retVal==KErrNone)
+    TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KMinLogLevel, _L8("- CSenHttpChannelTransportPlugin::ApplyPropertiesL() - iapId [%d]"), iapId));
+	TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KMinLogLevel, _L8("- LayeredPropertiesL() retVal [%d]"), retVal)); 
+    if(iIsConnectionFailed)
         {
-        TInt resetPerformed = ResetHttpChannelByIapIdL(iapId);
+		TInt resetPerformed = ResetHttpChannelByIapIdL(0); //Incase of connection error set Iap ID 0
 #ifdef _SENDEBUG
         if(resetPerformed == KErrNone)
             {
@@ -570,6 +599,16 @@
             }
 #endif // _SENDEBUG
         }
+    else if(retVal==KErrNone)
+        {
+       	TInt resetPerformed = ResetHttpChannelByIapIdL(iapId);
+#ifdef _SENDEBUG
+        if(resetPerformed == KErrNone)
+            {
+            TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KNormalLogLevel, _L8("- IAP re-set performed: (%d)"), 0));
+            }
+#endif // _SENDEBUG				
+        }
 
     // Handle ProxyHost and ProxyPort
     TPtrC8 proxyHost;
@@ -621,10 +660,10 @@
 
     TInt retVal(KErrNone);
     TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KMinLogLevel, _L8("- explicitIapIdDefined[%d], effectiveIapId[%d], aIapId[%d]"), explicitIapIdDefined, effectiveIapId, aIapId));
-    if(!explicitIapIdDefined || (explicitIapIdDefined && (effectiveIapId != aIapId) ))
+    if(!explicitIapIdDefined || (explicitIapIdDefined && (effectiveIapId != aIapId) ) || iIsConnectionFailed)
         {
         TLSLOG_L(KSenHttpChannelObserverLogChannelBase,KMinLogLevel,"CSenHttpChannelTransportPlugin::ResetHttpChannel():");
-
+        iIsConnectionFailed = EFalse;
         delete iHttpChannel;
         iHttpChannel = NULL;
         delete iRequester;
@@ -645,6 +684,7 @@
         {
         retVal = KErrAlreadyExists;
         }
+    TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KMinLogLevel, _L8("CSenHttpChannelTransportPlugin::ResetHttpChannelByIapIdL() - returns [%d]"), retVal));
     return retVal;
     }
 
--- a/webservices/wsmanager/src/senservicemanagerimpl.cpp	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wsmanager/src/senservicemanagerimpl.cpp	Tue May 11 17:14:12 2010 +0300
@@ -389,6 +389,8 @@
     TPtr8 ptr = provider->Des();
     TInt retVal = iConnection.RegisterIdentityProvider(ptr);
     delete provider;
+    provider = NULL;
+	TLSLOG_L(KSenServiceManagerLogChannelBase+iConnectionID, KMinLogLevel,"CSenServiceManagerImpl::RegisterIdentityProviderL(aProvider) Completed");    
     return retVal;
     }
 
@@ -1198,6 +1200,7 @@
             if(retVal == KErrNone)
                 {
                 retVal = ExtractIdentiyProvidersL(descriptions, aList);
+                TLSLOG_FORMAT((KSenServiceManagerLogChannelBase+iConnectionID, KMinLogLevel , _L8("-ExtractIdentiyProvidersL returned [%d]"), retVal));
                 }
             }
         }
@@ -1301,6 +1304,10 @@
 
             }
         } //  END OF: if idp.Length() > 0
+    else
+       	{
+		TLSLOG_L(KSenServiceManagerLogChannelBase+iConnectionID, KMinLogLevel,"CSenServiceManagerImpl::ExtractIdentiyProvidersL aIdPs(aIdPs, aList) aIdPs = 0 length");
+        }
     return retVal;
     }
 TAny* CSenServiceManagerImpl::InterfaceByUid( TUid aUID )
--- a/webservices/wsoviplugin/src/wsoviservicesession.cpp	Tue Apr 27 17:46:55 2010 +0300
+++ b/webservices/wsoviplugin/src/wsoviservicesession.cpp	Tue May 11 17:14:12 2010 +0300
@@ -715,7 +715,7 @@
                                                      MSenProperties* aResponseTransportProperties )
     {
     TLSLOG_L(KSenClientSessionLogChannelBase+aConsumer.ConnectionId()  , KMinLogLevel,"CWSOviServiceSession::SendErrorToConsumerL");
-    TLSLOG_FORMAT((KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KNormalLogLevel , _L8("- ErrorCode: %d"), aErrorCode ));
+    TLSLOG_FORMAT((KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel , _L8("- ErrorCode: %d"), aErrorCode ));
     ((CWSOviPlugin&)iFramework).ProcessInboundDispatchL(this, aErrorCode, apError, aResponseTransportProperties);
     TInt answer = CanHandleErrorL();
     if (answer)