AnsweredAssumed Answered

Problems to create user usi webservice API

Question asked by alfredomuã±ozcobisa on Mar 15, 2007
Problems when I create user, using webservice api. In the method, I get the homeFolder, fixed the characteristics of the user, but when I call to the method administrationService.createUsers (to newUser); the following exception takes place, in the final part of the attached document as much the method that I have created like the exception.

faultDetail: {} faultData: <ns1: errorCode xmlns: ns1= " http://www.alfresco.org/ws/service/action/1.0 " >0</ns1: errorCode><ns2: message xmlns: ns2= " http://www.alfresco.org/ws/service/action/1.0 " >Invalid node ref - does not contain forward slash: e193d727-d151-11db-ad5e-4d1453a05539</ns2: message>.

This one is the method that I use.

public Boolean createUser(User user, String password){
        AdministrationServiceSoapBindingStub administrationService = WebServiceFactory.getAdministrationService();
        // Get the root node reference
        Predicate predicate = new Predicate(null, STORE, null);
        Node[] nodes=null;
        String homeFolder="";
        try {
nodes = WebServiceFactory.getRepositoryService().get(predicate);
             } catch (RepositoryFault e1) {
e1.printStackTrace();
              } catch (RemoteException e1) {
e1.printStackTrace();
              }
        if (nodes.length == 1)
        {
         Reference ref=nodes[0].getReference();
         homeFolder=ref.getUuid();
        }
        else
        {
            System.out.println("Unable to get the root not of the created sotre.");
        }

        UserAlfresco usuario=(UserAlfresco)user;
        NamedValue[] properties = createPersonProperties(homeFolder,
usuario.getFirstName(), usuario.getLastName(), usuario.getEmail(), usuario.getId());
        NewUserDetails[] newUser = new NewUserDetails[]{new NewUserDetails(usuario.getUserName(), password, properties)};
         try {
                   administrationService.createUsers(newUser);
                   return Boolean.TRUE;

               } catch (AdministrationFault e) {
System.out.println("Error creando usuario.");
               } catch (RemoteException e) {
e.printStackTrace();
System.out.println("Error de servicio remoto.");
               }
return Boolean.FALSE;
}


This is the error,

———-
createUser
———-
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
{}faultData:<ns1:errorCode xmlns:ns1="http://www.alfresco.org/ws/service/action/1.0">0</ns1:errorCode><ns2:message xmlns:ns2="http://www.alfresco.org/ws/service/action/1.0">Invalid node ref - does not contain forward slash: e193d727-d151-11db-ad5e-4d1453a05539</ns2:message>
{http://xml.apache.org/axis/}exceptionName:org.alfresco.repo.webservice.action.ActionFault
{http://xml.apache.org/axis/}stackTrace:
at org.alfresco.repo.webservice.administration.AdministrationWebService.createUsers(AdministrationWebService.java:349)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

Outcomes