How can I fix the error VMO62002: The argument cannot be null. Parameter name: name when trying to create a basic user?

Hello, I am developing a Java Implementation to call Milestone Management Server Protocol Integration API, but It is throwing the error from the title.

I created all the Java classes from the WSDL link, then i call the end point like this

String endpoint = String.format("%s/ManagementServer/ServerCommandService.svc?wsdl", host);

HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);

ClassLoader classLoader = getClass().getClassLoader();

URL url = classLoader.getResource("ServerCommandService.svc.wsdl");

ServerCommandService service = new ServerCommandService(url);

IServerCommandService iServer = service.getBasicHttpBindingIServerCommandService();

BindingProvider bp = (BindingProvider) iServer;

Map<String, Object> map = bp.getRequestContext();

map.put(BindingProvider.ENDPOINT\_ADDRESS\_PROPERTY, HTTPS + endpoint);

map.put(BindingProvider.USERNAME\_PROPERTY, user);

map.put(BindingProvider.PASSWORD\_PROPERTY, pass);

if (iServer != null) {

  ObjectFactory factory = new ObjectFactory();

  ConfigurationItem item = new ConfigurationItem();

  setItemAttributes(item, factory, "Add new basic user", "AddBasicUser", "/", "/BasicUserFolder");

  // Reuse the property object by resetting its fields for each new property

  Property prop = new Property();

  // ID Property

  setPropertyAttributes(prop, "ID", "Id", 100, "00000000-0000-0000-0000-000000000000", "String", factory, false, "PropertyGeneralId", 1);

  item.getProperties().getValue().getProperty().add(prop);

  // Name Property

  prop = new Property(); // Create a new Property object to avoid reference issues

  setPropertyAttributes(prop, "Name", "Name", 100, user.getUserName(), "String", factory, true, "PropertyGeneralName", 2);

  item.getProperties().getValue().getProperty().add(prop);

  // Description Property

  prop = new Property(); // Create a new Property object to avoid reference issues

  setPropertyAttributes(prop, "Description", "Description", 100, user.getDescription(), "String", factory, true, "PropertyGeneralDescription", 0);

  item.getProperties().getValue().getProperty().add(prop);

  // Can Change Password Property

  prop = new Property(); // Create a new Property object to avoid reference issues

  setPropertyAttributes(prop, "Can change password", "CanChangePassword", 100, "True", "Tick", factory, false, "PropertyBasicUserCanChangePassword", 1);

  item.getProperties().getValue().getProperty().add(prop);

  // Password Property

  prop = new Property(); // Create a new Property object to avoid reference issues

  setPropertyAttributes(prop, "Password", "Password", 100, user.getPassword(), "String", factory, true, "PropertyBasicUserPassword", 4);

  item.getProperties().getValue().getProperty().add(prop);

  ConfigurationItem result = iServer.invokeMethod(item, "AddBasicUser");

}

Where does the error happen (I assume it happen in the code you show here)?

In the last line iServer.invokeMethod(item, “AddBasicUser”);

I assume you have debugged and there is no null value being used.

I wonder if I can persuade you to compare to a sample. We used to have a plugin sample that used the configuration API directly to create a new basic user, the sample was later changed to used the strongly typed classes instead of the API directly. It is important that you do the comparison on a sample 2021R1, not a newer version of the sample.

The sample is AddUserWithConfigApi, and the relevant code to compare is in UserController.cs

https://github.com/milestonesys/mipsdk-samples-plugin/tree/1c77799a021d7d2bec4c13f9414f98b3e0ef802e

Java is not my strong suit, I hope that you find comparing to c# in the sample doable, and that it gives you an idea if something is different.