Observe that the message fails during RMS subscription with above mentioned error. The SoStatusCre message will be of type 'SD' - Stock DeleteĨ. A new SoStatusCre message is published from SIM to RIB with the same transfer number and modified details. Again open the transfer created in step 2 in SIM and make some updates, such as remove some quantity for existing item and delete an existing item.ħ. Wait one or two days, so that System Date in SIM and VDATE in RMS are advanced (for example: 04-APR-12).Ħ. Delivery Date (TSFHEAD.DELIVERY_DATE) was updated.ĥ. SoStatusCre message with status 'SI' from SIM will reach RMS through RIB.Ĥ. Create transfers in SIM for 3 items, with quantity 10 each.ģ. Check the VDATE in RMS and the System Date in Store Inventory Management (SIM) system (for example: 02-APR-12).Ģ. SOStatus messages are failing in Retail Merchandising System (RMS) - Retail Integration Bus (RIB) Error Hospital with the following error:ġ. Information in this document applies to any platform. Oracle Retail Integration Bus - Version 13.0.5 and later Oracle Retail Store Inventory Management - Version 13.0.5.3 and later Oracle Retail Merchandising System - Version 13.0.5.4 and later WindowsImpersonationContext wic = doImpersonation(svcUserName, domain, password) ĮrrorLog.ErrorRoutine(new Exception("getWic() Error: " ex.ToString()), ErrorMessage.SOStatus Messages are Failing in RIB RMS Hospital password = RSAEncrypt.DecryptData(password, keyLength, keyLocation) Get Password: Convert from Base-64 String to decrypted string String svcUser = userNameStringFromTextbox Public static WindowsImpersonationContext getWic(string userNameStringFromTextbox, string password) WindowsImpersonationContext impersonatedUser = newId.Impersonate() NewId = new WindowsIdentity(dupeTokenHandle) (int)SecurityImpersonation, ref dupeTokenHandle) Throw new Exception("Exception thrown in trying to duplicate token.") īool bRetVal = DuplicateToken(tokenHandle, Throw new Exception("LogonUser failed with error code : " GetError(ret)) īool retVal = DuplicateToken(tokenHandle, SecurityImpersonation, ref dupeTokenHandle) LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_WINNT50, ref tokenHandle) Call LogonUser to obtain a handle to an access tokenīool returnValue = LogonUser(svcUserName, domainName, password, Public static WindowsImpersonationContext doImpersonation(string svcUserName, string domainName, string password) Private static IntPtr dupeTokenHandle = new IntPtr(0) Private static IntPtr tokenHandle = new IntPtr(0) Declare the Impersonation Levels as constants Declare the Logon Providers as constants Public extern static bool CloseHandle(IntPtr handle) Ĭonst int LOGON32_LOGON_NETWORK_CLEARTEXT = 8 // Win2K or higherĬonst int LOGON32_LOGON_NEW_CREDENTIALS = 9 // Win2K or higher Int SECURITY_IMPERSONATION_LEVEL, ref IntPtr DuplicateTokenHandle) Public extern static bool DuplicateToken(IntPtr ExistingTokenHandle, Both return a WindowsImpersonationContext. It has 2 main entry points, getWic() and doImpersonation() - getWic() will take a username that looks like domain\user or machinename\user and split them up into their component parts before handing it off to doImpersonation(), while doImpersonation() accepts the parts already split, if you have it like that and don't need the code in getWic(). if (tokenHandle != IntPtr.Zero) CloseHandle(tokenHandle) The above line just basically does this on the tokens. WindowsImpersonationContext adminContext = Impersonation.getWic(userName, password) Ĭ("\nUnable to set profile to Mandatory:\n\t" ex.Message) if brought in by a text box, it would be just domain\user but you have to escape it if hard-coding. Otherwise, as it has been mentioned in another comment, you would likely have to set this up with impersonation if the account you are running under does not have admin privileges on that machine, like so: string userName = "domain\\user" // there's really just one slash, Sc.Status.Equals(ServiceControllerStatus.StopPending)) If (sc.Status.Equals(ServiceControllerStatus.Stopped) || ServiceController sc = new ServiceController("YourService", "MachineName") If you DO have admin privileges on that machine, this code will work perfectly fine: using System.ServiceProcess
0 Comments
Leave a Reply. |