Problem:

We recently encountered an interesting problem with a configuration of a SharePoint 2010 farm where the profile sync farm is not the same as the services farm. In the services farm, the BCS models connect to SAP.  In the profile sync farm, the imports occur. The STS's are not the same therefore, the SAP endpoint has to be configured with basic auth. The basic authentication  approach with the STS to SAP fails.

You might see the following error logged in the ULS logs:

OWSTIMER.EXE (0x0A5C) 0x0914 Duet Enterprise ProfileSync h31g Unexpected Finder method call failed.. The exception message is 'Connection manager did not return valid connection. (Proxy creation failed. Default context not found.) Stack Trace: at Microsoft.SharePoint.BusinessData.SystemSpecific.Wcf.WcfSystemUtility.ExecuteStatic(IMethodInstance methodInstance, ILobSystemInstance lobSystemInstance, Object[] args, IExecutionContext context) at Microsoft.SharePoint.BusinessData.Runtime.DataClassRuntime.ExecuteInternalWithAuthNFailureRetry(ISystemUtility systemUtility, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IParameterCollection nonReturnParameters, Object[] overrideArgs) at Microsoft.SharePoint.BusinessData.Runtime.DataClassRuntime.ExecuteInternal(IDataClass thisDataClass, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, IParameterCollection nonReturnParameters, Object[]& overrideArgs) at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.ExecuteInternal(IDataClass thisDataClass, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, IParameterCollection nonReturnParameters, Object[]& overrideArgs, IFilterCollection filters) at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.ExecuteFiltered(IEntity this, IFilterCollection filterCollection, IMethodInstance methodInstanceToExecute, ILobSystemInstance lobSystemInstance) at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.<FindFiltered>b__3(IEntity e, IMethodInstance mi, IFilterCollection fc, ILobSystemInstance lsi) at Microsoft.SharePoint.BusinessData.Runtime.BatchableEntityInstanceEnumerator..ctor(IEntity entity, IMethodInstance methodInstance, IFilterCollection filters, ILobSystemInstance lobSystemInstance, ExecutionCallBack executionCallBack, Boolean isBatchingEnabled) at Microsoft.SharePoint.BusinessData.Runtime.EntityInstanceEnumeratorFactory.CreateEntityInstanceEnumerator(IEntity entity, IMethodInstance methodInstance, IFilterCollection filters, ILobSystemInstance lobSystemInstance, ExecutionCallBack executionCallBack) at Microsoft.SharePoint.BusinessData.MetadataModel.Static.Entity.FindFiltered(IFilterCollection filterCollection, ILobSystemInstance lobSystemInstance) at OBA.Server.ProfileSync.RoleSync.GetUsersPropertiesFromBackend()

Cause:

The service context is not being properly called when using the BCS Finder methods.

Resolution:

The following update will address this issue along with some additional configuration steps that are noted below:

Duet Enterprise for Microsoft SharePoint and SAP hotfix package 2597130 – http://support.microsoft.com/kb/2597130 , contains the fix that resolves this issue.  In addition to applying the fix the following steps need to be performed to resolve the issue:

1.) Reset the SharePoint Timer Job on all servers in the farm
2.) Modify the UserRoles BDC Model that’s exported from the SAP/SCL layer.  The UserRoles model must be altered with the following highlighted changes:

            <Property Name="WcfAuthenticationMode" Type="System.String">Credentials</Property>
            <Property Name="SsoApplicationId" Type="System.String">WSDL</Property>
            <Property Name="SsoProviderImplementation" Type="System.String">Microsoft.Office.SecureStoreService.Server.SecureStoreProvider, Microsoft.Office.SecureStoreService, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Property>
            <Property Name="UseStsIdentityFederation" Type="System.Boolean">false</Property>

3.) Import the manually modified model to the BDC on the Services Farm.