cancel
Showing results for 
Search instead for 
Did you mean: 

Error creating MDM user with .Net API

Former Member
0 Kudos

Below is the .net code i am using to try to create an MDM user. On the cmd.execute(); I get this error below.

Does the code look correct? Any ideas on the error?

Also, of note, UserId uid = cmd.getNewUserId(); returns null, so I'm not setting it.

ERROR:

InnerException: com.sap.mdm.intern.protocol.manual.ServerException

Message="MDM repository data is out-of-date or is locked by another MDM Server. Refresh the data and try the operation again. If the error persists, contact the system administrator. [0xffab4128]"

Source="MdmDotNetApi"

ErrorCode=-5553880

StackTrace:

at com.sap.mdm.intern.protocol.manual.AbstractProtocolCommand.execute(PassportSupport passportSupport)

at com.sap.mdm.security.commands.CreateUserCommand.execute()

CODE:


            RepositorySessionContext repSessionCtx = new RepositorySessionContext("SERVER", "REPOSITORY", "USERID");

            UserSessionContext UserSessionCtx = new UserSessionContext("SERVER", "REPOSITORY", "USERID");            
            UserSessionCtx.ApplicationName = "APPLICATION";

            string repsessiontext = SessionManager.Instance.createSession(repSessionCtx, SessionTypes.REPOSITORY_SESSION_TYPE, "PASSWORD");
            
            CreateUserCommand cmd = new CreateUserCommand(repSessionCtx);
            cmd.Session = repsessiontext;

            cmd.User = new UserProperties();

            UserId uid = cmd.getNewUserId();

            //cmd.User.Id = uid;
            cmd.User.Description = "Test";
            cmd.User.Emails = new String[1] {"TestATtest.com"};
            cmd.User.FullName = "TEST TEST";
            cmd.User.Locked = false;
            cmd.User.Name = "TEST";
            cmd.User.PasswordChangeRequired = false;
            cmd.User.PasswordNeverExpires = true;
            cmd.User.setPassword("asdf1234!@#$");

            cmd.InChangeStamp = -1;

            cmd.execute();

Edited by: Wardell Castles on Jul 27, 2010 5:44 PM - was missing this line 'cmd.Session = repsessiontext;'

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I think the problem is with...


cmd.InChangeStamp = -1;

Try doing this...


GetUserListCommand userListCmd = new GetUserListCommand(repSessionCtx);
userListCmd.execute();

cmd.InChangeStamp = userListCmd.InChangeStamp;

Hope this will work.

Former Member
0 Kudos

Thank you Shailesh!

That was exactly what was needed.

Answers (1)

Answers (1)

former_member206388
Contributor
0 Kudos

Hi Wardell

Also, of note, UserId uid = cmd.getNewUserId(); returns null, so I'm not setting it.

After CreateUserCommand is executed successfully, it returns the new userID. So before executing the command it will return only NULL.

In your case you are trying to get the value before calling the execute method of CreateUserCommand.

Also the exception message says "MDM repository data is out-of-date or is locked by another MDM Server"

Can you reload once your repository and if possible restart the MDM server(a wild guess to check if it is not locked) and let me know if it works?

Regards

Bala