08-05-2014 07:28 AM
Hi folks,
could someone tell me the possible reasons why i get the OleDbException with error code E_FAIL(0x80004005)? For the purpose of merging account we created a wrapper method as business rule called MergeAccounts(AccountID, EntityIDs) on server A. On server B i want to merge accounts per SData/SDataServiceOperationRequest like that: (based on Mike LaSpina's example )
try { SDataServiceOperationRequest sreq = new SDataServiceOperationRequest(SDataServant) { ResourceKind = SDataResourceKind.Accounts, OperationName = OpName }; sreq.Entry = new AtomEntry(); sreq.Entry.SetSDataPayload( new SDataPayload { ResourceName = "Account" + sreq.OperationName, Namespace = "http://schemas.sage.com/dynamic/2007", Values = { {"request",new SDataPayload { Values = { {"AccountID", headerAccountId}, {"EntityIDs", DuplicateIds} } } } } } ); AtomEntry result = sreq.Create(); var res = (SDataPayload)result.GetSDataPayload().Values["response"]; retVal = res.Values["Result"].ToString().ToLower().Equals("true"); }
sreq.Create() causes the OleDbException with the error code E_FAIL(0x80004005). According to RRaebiger's suggestion i've already grant the needed access right to the dir. C:\Windows\SysWOW64\config\systemprofile. But that it not the solution. Trying to see what is going on with SLXProfiler on server A is unsuccessful, i cant see anything there. Debugging our own business rule MergeAccounts(AccountID, EntityIDs) on server A comes to nothing, because the break point could not be reached.
Both servers are Windows 2008/R2/64 bits. SDataService works fine. I can confirm it, because of account updating is successfull before account merging.
I'm very glad to hear from your idee, what is going wrong in this case and thank a lot for your help in adv!
Solved! Go to Solution.
08-07-2014 08:40 AM
Hi,
the problem i described is not solved yet, but i known now where the exception is really on the spot. The invoked business rule (OpName, mentioned above) causes the problem:
try { string[] DuplicateIDs = EntityIDs.Split(new char[] { ',' }); Type mergeType = typeof(Sage.Entity.Interfaces.IAccount); //bool success = false; if (DuplicateIDs != null) { foreach (string sourceEntityId in DuplicateIDs) { MergeProvider sessionMergeProvider = null; MergeArguments SessionMergeArguments = new MergeArguments(); SessionMergeArguments.SourceEntityId = sourceEntityId; SessionMergeArguments.SourceEntityType = mergeType; SessionMergeArguments.TargetEntityId = AccountID; SessionMergeArguments.TargetEntityType = mergeType; SessionMergeArguments.MergeProviderType = mergeType; if (SessionMergeArguments.MergeProvider == null) { sessionMergeProvider = (MergeProvider)MergeArguments.GetMergeProvider(SessionMergeArguments); sessionMergeProvider.RecordOverwrite = MergeOverwrite.targetWins; IAccount myaccount = (IAccount)SessionMergeArguments.MergeProvider.Target.EntityData; if (myaccount.MergeAccount(SessionMergeArguments.MergeProvider)) { using (ISession session = new Sage.Platform.Orm.SessionScopeWrapper(true)) { string entityId = SessionMergeArguments.MergeProvider.Source.EntityId; IPersistentEntity duplicateAccount = Sage.Platform.EntityFactory.GetById(mergeType, entityId) as IPersistentEntity; duplicateAccount.Delete(); } result = "Success"; } } } } }
sessionMergeProvider = (MergeProvider)MergeArguments.GetMergeProvider(SessionMergeArguments) causes the exception with the error code E_FAIL(0x80004005). Looking after MergeRecords (thank a lot to apfingstl of your tip) you do it the same and it works, but my business not.
Maybe someone could tell me why, or where the problem is.
Thanks & Regards
11-13-2014 08:24 AM
. . . now we've solved it with implementing a job with passing params. This required upgrade to slx 8.1! Calling the job per SData works fine.