Revision: 201003 PDK_3.0.g
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 00:57:16 +0200
changeset 3 b5a195438f6a
parent 2 150a13bad6af
child 7 7bc6ab9b5bcd
child 8 28640b20cc44
child 15 0aea830faa24
Revision: 201003 Kit: 201005
webservices/wscore/group/sencore.mmp
webservices/wscore/inc/senmobilityobserver.h
webservices/wscore/src/senmobilityobserver.cpp
webservices/wshttpchanneltransportplugin/group/senhttpchanneltransportplugin.mmp
webservices/wshttpchanneltransportplugin/inc/senhttpchannelimpl.h
webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp
webservices/wshttpchanneltransportplugin/src/senhttpchanneltransportplugin.cpp
--- a/webservices/wscore/group/sencore.mmp	Tue Jan 26 13:03:48 2010 +0200
+++ b/webservices/wscore/group/sencore.mmp	Tue Feb 02 00:57:16 2010 +0200
@@ -100,6 +100,8 @@
 LIBRARY esock.lib		//MOBILITY
 LIBRARY commdb.lib //MOBILITY
 LIBRARY  netmeta.lib
+LIBRARY  platformver.lib //extendedconnpref.h
+LIBRARY  extendedconnpref.lib //extendedconnpref.h
 #endif
 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES
 LIBRARY senlogger.lib   // for TLS based logging
--- a/webservices/wscore/inc/senmobilityobserver.h	Tue Jan 26 13:03:48 2010 +0200
+++ b/webservices/wscore/inc/senmobilityobserver.h	Tue Feb 02 00:57:16 2010 +0200
@@ -88,6 +88,9 @@
 	TInt StartConnection(TUint32& aId, TBool aIsSnapId) ;
 	TInt OpenSocketSever() ;
 	void RefreshAvailabilityL() ;
+	TInt SetID(TUint32 aId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer, TBool aSNAP);
+	TBool IsOCCImplementedSDK();
+	TInt GetS60PlatformVersion(TUint& aMajor, TUint& aMinor);
 
 	/**
 	* By default Symbian OS constructor is private.
@@ -100,8 +103,8 @@
 	TUint32 iIapId;
 	TUint32 iNewIapId;
 	TUint32 iSnapId;
-	 CSenXmlReader &iReader ;
-	private:    // Data
+	CSenXmlReader &iReader ;
+	TBool iOCCenabled;
 	};
     
 #endif /*M_SEN_MOBILITY_OBSERVER_H    */
--- a/webservices/wscore/src/senmobilityobserver.cpp	Tue Jan 26 13:03:48 2010 +0200
+++ b/webservices/wscore/src/senmobilityobserver.cpp	Tue Feb 02 00:57:16 2010 +0200
@@ -27,6 +27,8 @@
 #include "senlayeredtransportproperties.h"
 #include "senlogger.h"
 #include "senservicemanagerdefines.h"
+#include <versioninfo.h>  // VersionInfo
+#include <extendedconnpref.h>
 
 // -----------------------------------------------------------------------------
 // CALRObserver::NewL
@@ -65,6 +67,7 @@
 #endif    
     User::LeaveIfError( iSocketServer.Connect());
     TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "CALRObserver::ConstructL()");
+    IsOCCImplementedSDK();
     }
 
 // -----------------------------------------------------------------------------
@@ -77,7 +80,8 @@
      iIapId(0),
      iNewIapId(0),
      iSnapId(0),
-     iReader(aReader)
+     iReader(aReader),
+     iOCCenabled(EFalse)
     {
     CActiveScheduler::Add( this );
     }
@@ -140,8 +144,59 @@
         //RunL status error: " ) );
         User::Leave(iStatus.Int()) ;
         }
-    }    
-
+    }
+    
+// On return, aMajor and aMinor contain the version information
+TBool CALRObserver::IsOCCImplementedSDK()
+	{   
+	TBool occ = EFalse;
+	// Obtain the version number
+	TUint major;
+	TUint minor;	
+	TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("CSenHttpChannelImpl::IsOCCImplementedSDK()")));		
+	TInt ret = GetS60PlatformVersion(major, minor);
+	if (ret == KErrNone)
+		{
+		if(major == 5 && minor == 2)
+			{
+			occ = ETrue;
+			iOCCenabled = ETrue;
+			TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("---- IsOCCImplementedSDK() returns TRUE")));
+			}
+		else
+			{
+			TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("---- IsOCCImplementedSDK() returns False")));
+			}
+		}
+	return occ;
+	}
+	
+// On return, aMajor and aMinor contain the version information
+TInt CALRObserver::GetS60PlatformVersion(TUint& aMajor, TUint& aMinor)
+	{   
+	TInt ret = KErrNone;
+	// Connect to the file server session
+	RFs fsSession;
+	TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("CSenHttpChannelImpl::GetS60PlatformVersion()")));	
+	ret = fsSession.Connect();
+	if(ret == KErrNone)
+		{
+		CleanupClosePushL(fsSession); // Obtain the version numberTUint major;
+		VersionInfo::TPlatformVersion platformVersion;  
+		TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "--- GetS60PlatformVersion getting Version info");		
+		ret = VersionInfo::GetVersion(platformVersion, fsSession);   
+		CleanupStack::PopAndDestroy();  // fsSession		
+		if (ret == KErrNone)       
+			{     
+			aMajor = platformVersion.iMajorVersion;  
+			aMinor = platformVersion.iMinorVersion;   
+		   	TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("--- GetS60PlatformVersion Version: Major [%d], Minor[%d]"), aMajor, aMinor));
+			}		
+		}
+	TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("--- GetS60PlatformVersion returns [%d]"), ret));
+	return ret;
+	}	
+	
 // -----------------------------------------------------------------------------
 // CALRObserver::RunError
 // -----------------------------------------------------------------------------
@@ -363,7 +418,7 @@
 
     TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get SNAPID from pTransportProperties ");
 	TInt error = pTransportProperties->SnapIdL(id) ;
-	if(error || id >= (TUint)KErrNotFound) //
+	if(error || id >= (TUint)KErrNotFound) //SNAP not found
 		{
         TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get IAPID from pTransportProperties ");
 	    error = pTransportProperties->IapIdL(id);		
@@ -373,7 +428,7 @@
 		isSnap = ETrue ;
 		}  
 		
-    if(error || id >= (TUint)KErrNotFound) 
+    if(error || id >= (TUint)KErrNotFound) //IAP also not found
 	    {
     	//Application Did not provide IAP ID through transport properties
     	//Now we need to check consumer and provider policy of service description
@@ -385,7 +440,7 @@
             CSenWSPattern* pConsumerPolicy = (CSenWSPattern*)&aInitializer;
 		    TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get SNAPID from pConsumerPolicy ");
 			error = pConsumerPolicy->ConsumerSnapId( id );
-			if(error || id >= (TUint)KErrNotFound) 
+			if(error || id >= (TUint)KErrNotFound) //SNAP not found
 			    {
         		TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get IAPID from pConsumerPolicy ");
 				error = pConsumerPolicy->ConsumerIapId( id );			 	
@@ -445,6 +500,11 @@
         {
         //check with first Snapid
         isStartConnectionRequired = ETrue ;
+        if(iOCCenabled != EFalse)
+	        {
+	        isSnap = ETrue; //We must start with SNAP for OCC
+			TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- isSnap Modified for OCC Support ");     
+			}
      	TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- StartConnection required as (iIapId == 0 && iSnapId == 0) openId = %d, isSnap = %d, iIapId = %d and iSnapId = %d "), openId, isSnap, iIapId, iSnapId));
         }
     else if(isSnap != EFalse && openId != iSnapId)
@@ -495,6 +555,146 @@
      	TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::OpenConnectionL returnd %d "), error));
         return error ;
 	}
+	
+TInt CALRObserver::SetID(TUint32 aId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer, TBool aSNAP)
+	{
+   /*
+    * Single click connectivity feature has been implemented by CSock (RConnection class).
+    * According to this client no need to set the IAP ID. 
+    * Automatically RConnection will use the suitable IAP
+    */
+    TInt retVal = KErrNone;
+    TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("CSenHttpChannelImpl  called with ID [%d]"), aId));
+	    
+	if (iOCCenabled == EFalse)	    
+		{
+		if(aSNAP != EFalse && aId)
+		    {
+		    TConnSnapPref SNAPPrefs;
+		    iSnapId = aId ;
+		    SNAPPrefs.SetSnap( aId ); 
+		    // Start connecting with Snap
+		    retVal = iConnection.Start(SNAPPrefs);						
+		    TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection Started with SNAP");
+		    }
+		else //default is iap
+			{
+		    if( aId )
+		        {
+		        TCommDbConnPref iapPrefs ;
+		        iapPrefs.SetIapId( aId );
+				iapPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+				TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::SetDialogPref is FALSE");					
+				//iapPrefs.SetDialogPreference( ECommDbDialogPrefPrompt );					
+		        // Start connecting with IAP
+		        retVal = iConnection.Start(iapPrefs);
+		        TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::StartConnection connection started with iapid %d and preference"), aId));
+		        }
+		    else
+		    	{
+		    	if (iIapId != 0)
+		        	{
+		        	//OpenSocketSever is already called for this iIapId When multiple
+		        	//sendL are calld for the same IAPId StartConnection may be called
+		        	//unintentionaly and may create crash
+		        	//strange case StartConnection must not be called in this case
+		        	TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection StartConnection must not be called as aId == 0 and iIapId != 0");
+		        	}
+		    	else
+		        	{
+		        	//Using Default Connection
+		            TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection started Using Default Connection");
+		        	retVal = iConnection.Start();	            	
+		        	}
+		    	}
+			}
+		}
+	else
+		{
+		if (aSNAP == EFalse)
+			{
+			/* If IAP id is zero, it is interpreted as
+		    * client's request for not requesting any specific IAP.
+		    * Default value is 0.
+		    * 
+		    * If IAP id is set, SNAP id shall be zero.
+		    * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
+		    * If IAP id is set, Connection selection dialog shall be disabled.
+		    * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown.
+		    * If IAP id is set, forced roaming is disabled automatically.
+		    * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
+		    * selection dialog shall be enabled.
+		    */
+		    
+		    TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC with IAP Settings");
+			TConnPrefList prefList;
+			TExtendedConnPref extPrefs;
+			//extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
+			//TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC Silent Connection");
+			//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
+			//extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
+			extPrefs.SetIapId(aId);
+			extPrefs.SetSnapId(0);
+			prefList.AppendL(&extPrefs);
+			retVal = aConnection.Start(prefList);
+			if(retVal == KErrNone)
+			    {
+			    iIapId = aId;
+			    }
+			 else
+			    {
+				TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("IAP ->Start retVal [%d]"), retVal));
+			    }
+		    }
+		else
+		    {
+		    /**
+		    * Sets SNAP id. If SNAP id is zero, it is interpreted as 
+		    * client's request for not requesting any specific SNAP.
+		    * Default value is 0.
+		    *
+		    * If SNAP id is set, IAP id shall be zero.
+		    * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
+		    * If SNAP id is set, Connection selection dialog shall be disabled.
+		    * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
+		    * selection dialog shall be enabled.
+		    */
+			TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC with SNAP Settings");
+			TConnPrefList prefList;
+			TExtendedConnPref extPrefs;
+			//extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
+			//TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC Silent Connection");
+			//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
+			//extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
+			if(aId == 0)
+				{
+				TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting SnapPurpose Internet");
+				if(aDialogPref) //If it fails because of unavailibility of access points
+					{
+					extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+					extPrefs.SetConnSelectionDialog(ETrue);
+					}
+				else
+					{
+					extPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet);
+					//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);					
+					}
+				}
+			else
+				{
+				extPrefs.SetSnapId(aId);
+				extPrefs.SetIapId(0);	
+				extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+				extPrefs.SetConnSelectionDialog(EFalse);
+				}
+			prefList.AppendL(&extPrefs);
+			retVal = aConnection.Start(prefList);							
+		    }
+		}    
+    
+	return retVal;
+	}
+
 // -----------------------------------------------------------------------------
 // CALRObserver::StartConnection
 // -----------------------------------------------------------------------------
@@ -530,49 +730,13 @@
 				TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection closed as new SNAPID for the same connection");				      
 				}
 			}
-		errRet = OpenSocketSever();		
+			
+		errRet = OpenSocketSever();
+		
 		if (!errRet)
 		    {
-			if(aIsSnapId != EFalse && aId)
-                {
-                TConnSnapPref SNAPPrefs;
-                iSnapId = aId ;
-                SNAPPrefs.SetSnap( aId ); 
-                // Start connecting with Snap
-                errRet = iConnection.Start(SNAPPrefs);						
-                TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection Started with SNAP");
-                }
-			else //default is iap
-				{
-	    	    if( aId )
-                    {
-                    TCommDbConnPref iapPrefs ;
-                    iapPrefs.SetIapId( aId );
-					iapPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
-					TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::SetDialogPref is FALSE");					
-					//iapPrefs.SetDialogPreference( ECommDbDialogPrefPrompt );					
-                    // Start connecting with IAP
-                    errRet = iConnection.Start(iapPrefs);
-                    TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::StartConnection connection started with iapid %d and preference"), aId));
-                    }
-	            else
-	            	{
-	            	if (iIapId != 0)
-		            	{
-		            	//OpenSocketSever is already called for this iIapId When multiple
-		            	//sendL are calld for the same IAPId StartConnection may be called
-		            	//unintentionaly and may create crash
-		            	//strange case StartConnection must not be called in this case
-		            	TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection StartConnection must not be called as aId == 0 and iIapId != 0");
-		            	}
-	            	else
-		            	{
-		            	//Using Default Connection
-	                    TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection started Using Default Connection");
-		            	errRet = iConnection.Start();	            	
-		            	}
-	            	}
-				}
+			errRet = SetID(aId, EFalse, iConnection, iSocketServer, aIsSnapId);
+			
 			if (errRet == KErrNone)
     			{	
      			//iConnection.GetIntSetting( _L( "IAP\\Id" ), aId );
--- a/webservices/wshttpchanneltransportplugin/group/senhttpchanneltransportplugin.mmp	Tue Jan 26 13:03:48 2010 +0200
+++ b/webservices/wshttpchanneltransportplugin/group/senhttpchanneltransportplugin.mmp	Tue Feb 02 00:57:16 2010 +0200
@@ -115,6 +115,11 @@
 LIBRARY         HttpFilterCommon.lib
 LIBRARY         netmeta.lib
 
+#ifndef __ENABLE_ALR__
+LIBRARY  		platformver.lib //extendedconnpref.h
+LIBRARY  		extendedconnpref.lib //extendedconnpref.h
+#endif
+
 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES
 // WSF libraries:
 LIBRARY         SenServDesc.lib
--- a/webservices/wshttpchanneltransportplugin/inc/senhttpchannelimpl.h	Tue Jan 26 13:03:48 2010 +0200
+++ b/webservices/wshttpchanneltransportplugin/inc/senhttpchannelimpl.h	Tue Feb 02 00:57:16 2010 +0200
@@ -160,8 +160,10 @@
 private:
     
     // New functions
-    
-    
+
+	TInt SetID(TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer, TBool aSNAP = EFalse);
+	TInt GetS60PlatformVersion(TUint& aMajor, TUint& aMinor);
+	TBool IsOCCImplementedSDK();	
     TPtrC8 SoapActionL(MSenElement& aSoapEnvelope);
     TInt SubmitRequestL(MSenResponseObserver& aObserver,
                         const TDesC8& aUri,
@@ -210,6 +212,9 @@
     TBool iHasHttpContentType;
     SenMultiPartUtils::TMultiPartContentType iMultiPartContentType; // content type of MultiPart response
     RHTTPTransaction iHttpTransaction ;
+#ifndef __ENABLE_ALR__    
+    TBool iOCCenabled ;
+#endif    
     };
 
 #endif //SEN_HTTP_CHANNEL_IMPL_H
--- a/webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp	Tue Jan 26 13:03:48 2010 +0200
+++ b/webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp	Tue Feb 02 00:57:16 2010 +0200
@@ -52,6 +52,11 @@
 #include <httpfiltercommonstringsext.h>
 #include <deflatefilterinterface.h>
 
+#ifndef __ENABLE_ALR__
+#include <versioninfo.h>  // VersionInfo
+#include <extendedconnpref.h>
+#endif
+
 // CONSTANTS
 namespace
     {
@@ -85,7 +90,11 @@
     iProxyHostPort(NULL),
     iXopResponse(EFalse),
     iHasHttpContentType(ETrue)
+#ifndef __ENABLE_ALR__
+    , iOCCenabled(EFalse)
+#endif    
     {
+//    IsOCCImplementedSDK();
     }
 
 CSenHttpChannelImpl* CSenHttpChannelImpl::NewL(MSenIdentityManager& aManager)
@@ -120,6 +129,59 @@
     return pNew;
     }
 
+#ifndef __ENABLE_ALR__
+// On return, aMajor and aMinor contain the version information
+TInt CSenHttpChannelImpl::GetS60PlatformVersion(TUint& aMajor, TUint& aMinor)
+	{   
+	TInt ret = KErrNone;
+	// Connect to the file server session
+	RFs fsSession;
+	TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::GetS60PlatformVersion()")));	
+	ret = fsSession.Connect();
+	if(ret == KErrNone)
+		{
+		CleanupClosePushL(fsSession); // Obtain the version numberTUint major;
+		VersionInfo::TPlatformVersion platformVersion;  
+		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "--- GetS60PlatformVersion getting Version info");		
+		ret = VersionInfo::GetVersion(platformVersion, fsSession);   
+		CleanupStack::PopAndDestroy();  // fsSession		
+		if (ret == KErrNone)       
+			{     
+			aMajor = platformVersion.iMajorVersion;  
+			aMinor = platformVersion.iMinorVersion;   
+		   	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("--- GetS60PlatformVersion Version: Major [%d], Minor[%d]"), aMajor, aMinor));
+			}		
+		}
+	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("--- GetS60PlatformVersion returns [%d]"), ret));
+	return ret;
+	}
+
+// On return, aMajor and aMinor contain the version information
+TBool CSenHttpChannelImpl::IsOCCImplementedSDK()
+	{   
+	TBool occ = EFalse;
+	// Obtain the version number
+	TUint major;
+	TUint minor;	
+	TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::IsOCCImplementedSDK()")));		
+	TInt ret = GetS60PlatformVersion(major, minor);
+	if (ret == KErrNone)
+		{
+		if(major == 5 && minor == 2)
+			{
+			occ = ETrue;
+			iOCCenabled = ETrue;
+			TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("---- IsOCCImplementedSDK() returns TRUE")));
+			}
+		else
+			{
+			TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("---- IsOCCImplementedSDK() returns False")));
+			}
+		}
+	return occ;
+	}
+#endif	
+
 // Ask IAP from user
 void CSenHttpChannelImpl::ConstructL()
     {
@@ -162,6 +224,10 @@
         new (ELeave) CArrayPtrFlat<CSenTxnState>(KMinimumArrayGranularity);
 
     iBasicConnectionTries = 0;
+    
+#ifndef __ENABLE_ALR__
+    IsOCCImplementedSDK();
+#endif    
 
 #ifdef _SENDEBUG
     ListFilters();
@@ -183,6 +249,9 @@
 //    Use local variable (new RSocketServer each time; handle is given to RHTTPSession via RConnectionInfo..)
 //    RSocketServ server; // with "anon" (local) socket servers, should we keep array of open ones in case of pending txns?
 //    SetIapPrefsL(aIapId, iConnection, server);
+#ifndef __ENABLE_ALR__
+	IsOCCImplementedSDK();
+#endif	
 
     const TInt result = SetIapPrefsL(aIapId, ETrue, iConnection, iSockServ);
     User::LeaveIfError( result );
@@ -229,163 +298,9 @@
     TLSLOG_CLOSE(KSenHttpChannelLogChannelBase);
     }
 
-// This function expects that RConnection has been connected
-// and that RConnection has already been opened!
-/*
-void CSenHttpChannelImpl::SetIapPrefsL(TUint32 aIapId, 
-                                       RConnection& aConnection, 
-                                       RSocketServ& aSocketServer)
-    {
-    // Check whether IAP ID is not equal with the one that is currently in effect:
-    if(iExplicitIapDefined && iIapId == aIapId )
-        {
-        return; // nothing to do
-        }
-        
-    LOG_WRITEFORMAT((_L8("- SetIapPrefsL: Re-setting IAP ID (%d)"), aIapId));
-
-    // Check if socket server (connection) is already open..
-    if( iExplicitIapDefined )
-        {
-         // Socket server opened once before for some other IAP
-        LOG_WRITE_L("- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
-        aConnection.Stop();
-        }
-    else
-        {
-        aConnection.Stop(); // prompted from user
-        iSess.DisconnectL();
-        iSess.ConnectL();
-
-        // Connect to a socket server    
-        LOG_WRITE_L("- SetIapPrefsL: Connecting to new socket server");    
-        User::LeaveIfError(aSocketServer.Connect());       
-
-        // Open new connection
-        LOG_WRITE_L("- SetIapPrefsL: Opening new RConnection using the socket server.");       
-        User::LeaveIfError(aConnection.Open(aSocketServer)); 
-        }
-        
-    // Set the IAP selection preferences (IAP ID, do not prompt)
-    TCommDbConnPref pref;
-    pref.SetIapId( aIapId );    
-
-    TCommDbDialogPref dialogPref;
-    dialogPref = ECommDbDialogPrefDoNotPrompt;
-    pref.SetDialogPreference(dialogPref);
-    
-    // Start the connection with the new preferences
-    LOG_WRITE_L("- SetIapPrefsL: Calling RConnection::Start with new IAP prefs");
-    aConnection.Start(pref);
-    
-    // Get the connection "handle" from the HTTP session    
-    RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
-     
-    // Attach socket server
-    connInfo.SetPropertyL(iStringPool.StringF(  HTTP::EHttpSocketServ,
-                                                RHTTPSession::GetTable()),
-                                                THTTPHdrVal(aSocketServer.Handle()));
-    
-    // Attach connection  
-    TInt connPtr = REINTERPRET_CAST(TInt, &aConnection);
-    connInfo.SetPropertyL(iStringPool.StringF(  HTTP::EHttpSocketConnection, 
-                                                RHTTPSession::GetTable()), 
-                                                THTTPHdrVal(connPtr));
-                                                
-    // Remember the IAP id that is being set; there is
-    // no direct API to query effective IAP ID from CommsDB.
-    iExplicitIapDefined = ETrue;
-    iIapId = aIapId;
-    }
-*/
-
-
-/*
-void CSenHttpChannelImpl::SetupConnectionWithIapPrefsL( TUint32 aIapId, 
-                                                        RConnection& aConnection, 
-                                                        RSocketServ& aSocketServer )
-    {
-    // Check whether IAP ID is not equal with the one that is currently in effect:
-    if(iExplicitIapDefined && iIapId == aIapId )
-        {
-        return; // nothing to do
-        }
-        
-    LOG_WRITEFORMAT((_L8("- SetIapPrefsL, IAP ID (%d)"), aIapId));
-
-    // Check if socket server (connection) is already open..
-    if( iExplicitIapDefined )
-        {
-         // Socket server opened once before for some other IAP
-        LOG_WRITE_L("- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
-        aConnection.Stop();
-        }
-    else
-        {
-        // Connect to a socket server    
-        LOG_WRITE_L("- SetIapPrefsL: Connecting to new socket server");    
-        User::LeaveIfError( aSocketServer.Connect() );       
-
-        // Open new connection
-        LOG_WRITE_L("- SetIapPrefsL: Opening new RConnection using the socket server.");       
-        User::LeaveIfError( aConnection.Open(aSocketServer) ); 
-        }
-        
-    // Set the IAP selection preferences (IAP ID, do not prompt)
-    TCommDbConnPref pref;
-    pref.SetIapId( aIapId );    
-
-    TCommDbDialogPref dialogPref;
-    dialogPref = ECommDbDialogPrefDoNotPrompt;
-    pref.SetDialogPreference(dialogPref);
-    
-    // Start the connection with the new preferences
-    LOG_WRITE_L("- SetIapPrefsL: Calling RConnection::Start with new IAP prefs");
-    aConnection.Start(pref);
-    }
-    
-
-void CSenHttpChannelImpl::AttachSocketServerAndConnectionWithHttpSession( TUint32 aIapId, 
-                                                                          RConnection& aConnection, 
-                                                                          RSocketServ& aSocketServer )
-    {
-    if(iExplicitIapDefined && iIapId == aIapId )
-        {
-        return; // nothing to do
-        }
-
-    // Get the connection "handle" from the HTTP session    
-    RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
-     
-    // Attach socket server
-    connInfo.SetPropertyL(iStringPool.StringF(  HTTP::EHttpSocketServ,
-                                                RHTTPSession::GetTable()),
-                                                THTTPHdrVal(aSocketServer.Handle()));
-    
-    // Attach connection  
-    TInt connPtr = REINTERPRET_CAST(TInt, &aConnection);
-    connInfo.SetPropertyL(iStringPool.StringF(  HTTP::EHttpSocketConnection, 
-                                                RHTTPSession::GetTable()), 
-                                                THTTPHdrVal(connPtr));
-                                                
-    // Remember the IAP id that is being set, because *at the moment*,
-    // there is NO direct API to query effective IAP ID from CommsDB.
-    iExplicitIapDefined = ETrue;
-    iIapId = aIapId;
-    }
-    
-
-void CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, RConnection& aConnection, RSocketServ& aSocketServer )
-    {
-    SetupConnectionWithIapPrefsL( aIapId, aConnection, aSocketServer );
-    AttachSocketServerAndConnectionWithHttpSession( aIapId, aConnection, aSocketServer );
-    }        
-*/
-
-
 TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
    	{
-   	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KNormalLogLevel, _L8("- SetIapPrefsL, IAP ID (%d)"), aIapId));
+   	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KNormalLogLevel, _L8("- SetIapPrefsL	, IAP ID (%d)"), aIapId));
    	
     // Check whether IAP ID is not equal with the one that is currently in effect:
     if(iExplicitIapDefined && iIapId == aIapId )
@@ -393,10 +308,10 @@
         TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect");
         return KErrNone;
         }
-		else
-				{
-				TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id different with the currently in effect");
-				}    
+	else
+		{
+		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id different with the currently in effect");
+		}    
     
 
     // Check if socket server (connection) is already open..
@@ -417,39 +332,9 @@
         User::LeaveIfError( aConnection.Open(aSocketServer) ); 
         }
         
-    // Set the IAP selection preferences (IAP ID, do not prompt)
-    /*
-    *Single click connectivity feature has been implemented by CSock (RConnection class).
-    *According to this client no need to set the IAP ID. 
-    *Automatically RConnection will use the suitable IAP
-    */
-    
-
-	    TCommDbConnPref pref;
-    #ifndef __SINGLE_CLICK_CONNECTIVITY_ENABLED__	    
-	    pref.SetIapId( aIapId );
-		#else
-			pref.SetIapId( 0 );	 //By default IAP ID is "0". IAP selection will take care by RConnection
-    #endif //__SINGLE_CLICK_CONNECTIVITY_ENABLED__	    
-	    TCommDbDialogPref dialogPref;
-	    
-	    if (aDialogPref)
-	        {
-	        dialogPref = ECommDbDialogPrefDoNotPrompt;
-	        }
-	    else
-	        {
-	        dialogPref = ECommDbDialogPrefPrompt;
-	        }     
-	    pref.SetDialogPreference(dialogPref);
-    
-  	// Start the connection with the new preferences
-	  TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Calling RConnection::Start with new IAP prefs");
-
-    TInt retVal =aConnection.Start(pref);
-    
-		TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection->Start retVal [%d]"), retVal));
-		        
+    // Set the IAP selection preferences (IAP ID, do not prompt)    
+	TInt retVal = SetID(aIapId, aDialogPref, aConnection, aSocketServer);	        
+	
     // Get the connection "handle" from the HTTP session    
     RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
      
@@ -462,24 +347,160 @@
     TInt connPtr = REINTERPRET_CAST(TInt, &aConnection);
     connInfo.SetPropertyL(iStringPool.StringF(  HTTP::EHttpSocketConnection, 
                                                 RHTTPSession::GetTable()), 
-                                                THTTPHdrVal(connPtr));
-                                                
-    // Remember the IAP id that is being set, because *at the moment*,
-    // there is NO direct API to query effective IAP ID from CommsDB.
+                                                THTTPHdrVal(connPtr));                                                    
+    return retVal;
+    }
+
+TInt CSenHttpChannelImpl::SetID(TUint32 aId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer, TBool aSNAP)
+{
+   /*
+    * Single click connectivity feature has been implemented by CSock (RConnection class).
+    * According to this client no need to set the IAP ID. 
+    * Automatically RConnection will use the suitable IAP
+    */
+    TInt retVal = KErrNone;
+    TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl  called with ID [%d]"), aId));
+	    
+#ifndef __ENABLE_ALR__	    
+	if (iOCCenabled == EFalse)	    
+		{
+#endif		
+		if (aSNAP == EFalse)
+			{
+			TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- SetIAPID");
+		    TCommDbConnPref pref;		
+			pref.SetIapId( aId );
+			TCommDbDialogPref dialogPref;
+		    if (aDialogPref)
+		        {
+		        dialogPref = ECommDbDialogPrefDoNotPrompt;
+		        }
+		    else
+		        {
+		        dialogPref = ECommDbDialogPrefPrompt;
+		        }
+	    	pref.SetDialogPreference(dialogPref);
+	    	retVal = aConnection.Start(pref);
+			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection->Start retVal [%d]"), retVal));
+			}
+		else
+			{
+			TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- SetSNAPID");
+			// Set the SNAP selection preferences (SNAP ID)
+		    TConnSnapPref pref;
+		    pref.SetSnap(aId);		    
+		    // Start the connection with the new preferences
+		    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Calling RConnection::Start with new SNAP prefs");
+		    TInt retVal = aConnection.Start(pref);
+			}
+#ifndef __ENABLE_ALR__			
+		}   
+	else
+		{
+		if (aSNAP == EFalse)
+			{
+			/* If IAP id is zero, it is interpreted as
+		    * client's request for not requesting any specific IAP.
+		    * Default value is 0.
+		    * 
+		    * If IAP id is set, SNAP id shall be zero.
+		    * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
+		    * If IAP id is set, Connection selection dialog shall be disabled.
+		    * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown.
+		    * If IAP id is set, forced roaming is disabled automatically.
+		    * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
+		    * selection dialog shall be enabled.
+		    */
+		    
+		    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC with IAP Settings");
+			TConnPrefList prefList;
+			TExtendedConnPref extPrefs;
+			//extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
+			//TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection");
+			//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
+			//extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
+			extPrefs.SetIapId(aId);
+			extPrefs.SetSnapId(0);
+			prefList.AppendL(&extPrefs);
+			retVal = aConnection.Start(prefList);
+			if(retVal == KErrNone)
+			    {
+			    iIapId = aId;
+			    }
+			 else
+			    {
+				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP ->Start retVal [%d]"), retVal));
+			    }
+		    }
+		else
+		    {
+		    /**
+		    * Sets SNAP id. If SNAP id is zero, it is interpreted as 
+		    * client's request for not requesting any specific SNAP.
+		    * Default value is 0.
+		    *
+		    * If SNAP id is set, IAP id shall be zero.
+		    * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
+		    * If SNAP id is set, Connection selection dialog shall be disabled.
+		    * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
+		    * selection dialog shall be enabled.
+		    */
+			TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC with SNAP Settings");
+			TConnPrefList prefList;
+			TExtendedConnPref extPrefs;
+			//extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
+			//TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection");
+			//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
+			//extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
+			if(aId == 0)
+				{
+				TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting SnapPurpose Internet");
+				if(aDialogPref) //If it fails because of unavailibility of access points
+					{
+					extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+					extPrefs.SetConnSelectionDialog(ETrue);
+					}
+				else
+					{
+					extPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet);
+					//extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);					
+					}
+				}
+			else
+				{
+				extPrefs.SetSnapId(aId);
+				extPrefs.SetIapId(0);	
+				extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
+				extPrefs.SetConnSelectionDialog(EFalse);
+				}
+			prefList.AppendL(&extPrefs);
+			retVal = aConnection.Start(prefList);
+			
+			if(retVal == KErrNone)
+				{
+				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
+			    {
+				TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("SNAP ->Start retVal [%d]"), retVal));
+			    }				
+		    }
+		}    
+#endif    
     if (!retVal)
         {
-        #ifdef __SINGLE_CLICK_CONNECTIVITY_ENABLED__
-        	//Since we are using by default setIapId "0".
-        	//There won't be any explicitly defined Iap Id
-        	iExplicitIapDefined = EFalse;
-        	iIapId = 0;
-				#else        	
-        	iExplicitIapDefined = ETrue;
-        	iIapId = aIapId;
-        #endif //__SINGLE_CLICK_CONNECTIVITY_ENABLED__
-        }
-    return retVal;
-    }
+        iExplicitIapDefined = ETrue;
+        }	
+	return retVal;
+}
+
 TInt CSenHttpChannelImpl::SetSnapPrefsL( TUint32 aSnapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
     {
     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- CSenHttpChannelImpl::SetSnapPrefsL, SNAP ID (%d)"), aSnapId));
@@ -493,7 +514,7 @@
 			{
 			TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is different with currently in effect");
 			}        
-
+	
     // Check if socket server (connection) is already open..
     if( iExplicitIapDefined )
         {
@@ -512,13 +533,10 @@
         User::LeaveIfError( aConnection.Open(aSocketServer) ); 
         }
         
-    // Set the SNAP selection preferences (SNAP ID)
-    TConnSnapPref pref;
-    pref.SetSnap(aSnapId);     
+        
+	// Set the SNAP selection preferences (SNAP ID, do not prompt)    
+	TInt retVal = SetID(aSnapId, aDialogPref, aConnection, aSocketServer, ETrue);
     
-    // Start the connection with the new preferences
-    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Calling RConnection::Start with new SNAP prefs");
-    TInt retVal = aConnection.Start(pref);
     TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetSnapPrefsL, RConnection::Start returned: (%d)"), retVal));
     
     // Get the connection "handle" from the HTTP session    
@@ -669,42 +687,56 @@
     RStringF method;
     TPtrC8 deflate;
     // Set IAP preferences, if such exist in properties (and not already in effect):
-    TUint32 iapId(KErrNone);
-    TBool doNotPrompt(ETrue); 
+    TUint32 id(KErrNone);
+    TBool prompt(ETrue); 
     
-    TInt retVal = aProps.IAPDialogL( doNotPrompt );
+    TInt retVal = aProps.IAPDialogL( prompt );
     if ( retVal != KErrNone )
         {
         // by default, do not prompt (even if property does not exist!) 
         // => only if property is set, and has value "FALSE", show PROMPT            
-        doNotPrompt = ETrue;
+        prompt = ETrue;
         }
 
+#ifndef __ENABLE_ALR__
     // Independent of dialog preference (property's existance), if IAP was predefined, it must be set        
-    if(((aProps.IapIdL(iapId)) == KErrNone))
+    if(((aProps.IapIdL(id)) == KErrNone))
         {
-        retVal = SetIapPrefsL(iapId, doNotPrompt, iConnection, iSockServ);
+        retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
         }
-    else if(((aProps.SnapIdL(iapId)) == KErrNone))
+    else if(((aProps.SnapIdL(id)) == KErrNone))
         {
-        retVal = SetSnapPrefsL(iapId, doNotPrompt, iConnection, iSockServ);
+        retVal = SetSnapPrefsL(id, prompt, iConnection, iSockServ);
         }
     else//to better control RConnection, we have to call Start by ourselve
         {
         retVal = SetSnapPrefsL(0, EFalse, iConnection, iSockServ);
         if(retVal == KErrNotFound)
             {
-            retVal = SetIapPrefsL(0, EFalse, iConnection, iSockServ);
+            if(iOCCenabled == EFalse)
+		        {
+	    	    retVal = SetIapPrefsL(0, EFalse, iConnection, iSockServ);	
+	        	}
+        	else
+	        	{
+	        	retVal = SetSnapPrefsL(0, prompt, iConnection, iSockServ);	
+	        	}
             }
         }
     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);
     // Check transport properties
+    TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));
+#else
+	retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
+	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));	
+	iUsedIapId = id;
+#endif
+    
     CSenLayeredHttpTransportProperties::TSenHttpMethod httpMethod;
-    TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP %d"), iapId));
-    TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("DONT PROMPT %d"), doNotPrompt));
+    TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("PROMPT %d"), prompt));
     TInt retValHttpMethod = aProps.HttpMethodL(httpMethod);
     
     
@@ -1877,17 +1909,20 @@
     {
 	TInt handle = iConnection.SubSessionHandle();
 		if (handle>0)
-	    {
-        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);
+	        if (!err && !connEnum)
+	            {
+	            return EFalse;
+	            }
+		    }
+	    else
+		    {
+		    TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized.");	
+		    }
 
-	TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), iIapId ));
-#ifdef _SENDEBUG
 	if( iExplicitIapDefined )
 		{
 		TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8(" - IAP ID is known: %d"), iIapId ));
@@ -1896,23 +1931,16 @@
 		{
 		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," - IAP ID is not known.");
 		}
-		
-	if( handle < KErrNone )
-		{
-		TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized.");
-		}
-#endif // _SENDEBUG    
-    
+		    
     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 )
 	    	{
-			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): end-user provided IAP(%d)"), iIapId ));
+			TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("---- GetIntSetting(): retuens IAP(%d)"), iIapId ));
 	    	// Treat the end-user selection as "explicit" definition as well(!):
 	    	iExplicitIapDefined = ETrue; 
 	    	}
@@ -1942,5 +1970,3 @@
     return iUsedIapId;
     }
 // END OF FILE
-
-
--- a/webservices/wshttpchanneltransportplugin/src/senhttpchanneltransportplugin.cpp	Tue Jan 26 13:03:48 2010 +0200
+++ b/webservices/wshttpchanneltransportplugin/src/senhttpchanneltransportplugin.cpp	Tue Feb 02 00:57:16 2010 +0200
@@ -608,6 +608,7 @@
 
 TInt CSenHttpChannelTransportPlugin::ResetHttpChannelByIapIdL(TUint32 aIapId)
     {
+    TLSLOG_L(KSenHttpChannelObserverLogChannelBase,KMinLogLevel,"CSenHttpChannelTransportPlugin::ResetHttpChannelByIapIdL()");
     TUint32 effectiveIapId(KErrNone);
     TBool explicitIapIdDefined(EFalse);
     if(iHttpChannel)
@@ -616,7 +617,8 @@
         }
 
     TInt retVal(KErrNone);
-    if(!explicitIapIdDefined || explicitIapIdDefined && effectiveIapId != aIapId)
+    TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KMinLogLevel, _L8("- explicitIapIdDefined[%d], effectiveIapId[%d], aIapId[%d]"), explicitIapIdDefined, effectiveIapId, aIapId));
+    if(!explicitIapIdDefined || (explicitIapIdDefined && (effectiveIapId != aIapId) ))
         {
         TLSLOG_L(KSenHttpChannelObserverLogChannelBase,KMinLogLevel,"CSenHttpChannelTransportPlugin::ResetHttpChannel():");
 
@@ -624,7 +626,7 @@
         iHttpChannel = NULL;
         delete iRequester;
         iRequester = NULL;
-        TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KNormalLogLevel, _L8("- New IAP ID: %d"), aIapId));
+        TLSLOG_FORMAT((KSenHttpChannelObserverLogChannelBase,KMinLogLevel, _L8("- New IAP ID: %d"), aIapId));
         CSenHttpChannel* pHttpChannel = CSenHttpChannelImpl::NewL(iServiceManager, aIapId);
         
         CleanupStack::PushL(pHttpChannel);