AnsweredAssumed Answered

Exception in writing ACE to a reference for new user

Question asked by sergio on Dec 4, 2006
Latest reply on Dec 5, 2006 by sergio
Hi all.

I have the following piece of code:

Store store = new Store (schema, address);
         UserDetails[] userDetails = administrationService.createUsers(new NewUserDetails[]{newUser});
         Reference ref = new Reference();
         ref.setStore(store);
         ref.setUuid(homeFolderId);
         Predicate pred = new Predicate();
         pred.setStore(store);
         pred.setNodes(new Reference[]{ref});

The code works well: a new user is created and the entry point reference is well defined.

I have to give the user only read rights to that reference, so I tried the following piece of code:

ACE[] user_ace = new ACE[]{new ACE(homeFolderId, Constants.READ, AccessStatus.acepted)};
accessControlService.addACEs(pred, user_ace);

The user is correctly created but the following exception is thrown:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
faultActor:
faultNode:
faultDetail:
   {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Premature end of file.
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
   at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:230)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
   at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
   at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
   at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
   at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
   at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
   at org.apache.axis.client.Call.invoke(Call.java:2767)
   at org.apache.axis.client.Call.invoke(Call.java:2443)
   at org.apache.axis.client.Call.invoke(Call.java:2366)
   at org.apache.axis.client.Call.invoke(Call.java:1812)
   at org.alfresco.webservice.accesscontrol.AccessControlServiceSoapBindingStub.addACEs(AccessControlServiceSoapBindingStub.java:602)
   at it.nsi.alfresco.ws.test.FrmMain.wsCreateUser(FrmMain.java:1246)
   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 it.nsi.alfresco.ws.test.FrmMain.executeMethod(FrmMain.java:1562)
   at it.nsi.alfresco.ws.test.FrmMain$1.mouseClicked(FrmMain.java:226)
   at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
   at java.awt.Component.processMouseEvent(Component.java:5491)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
   at java.awt.Component.processEvent(Component.java:5253)
   at java.awt.Container.processEvent(Container.java:1966)
   at java.awt.Component.dispatchEventImpl(Component.java:3955)
   at java.awt.Container.dispatchEventImpl(Container.java:2024)
   at java.awt.Component.dispatchEvent(Component.java:3803)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
   at java.awt.Container.dispatchEventImpl(Container.java:2010)
   at java.awt.Window.dispatchEventImpl(Window.java:1778)
   at java.awt.Component.dispatchEvent(Component.java:3803)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

   {http://xml.apache.org/axis/}hostname:pulcino

org.xml.sax.SAXParseException: Premature end of file.
   at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
   at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
   at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
   at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
   at org.apache.axis.client.Call.invoke(Call.java:2767)
   at org.apache.axis.client.Call.invoke(Call.java:2443)
   at org.apache.axis.client.Call.invoke(Call.java:2366)
   at org.apache.axis.client.Call.invoke(Call.java:1812)
   at org.alfresco.webservice.accesscontrol.AccessControlServiceSoapBindingStub.addACEs(AccessControlServiceSoapBindingStub.java:602)
   at it.nsi.alfresco.ws.test.FrmMain.wsCreateUser(FrmMain.java:1246)
   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 it.nsi.alfresco.ws.test.FrmMain.executeMethod(FrmMain.java:1562)
   at it.nsi.alfresco.ws.test.FrmMain$1.mouseClicked(FrmMain.java:226)
   at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
   at java.awt.Component.processMouseEvent(Component.java:5491)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
   at java.awt.Component.processEvent(Component.java:5253)
   at java.awt.Container.processEvent(Container.java:1966)
   at java.awt.Component.dispatchEventImpl(Component.java:3955)
   at java.awt.Container.dispatchEventImpl(Container.java:2024)
   at java.awt.Component.dispatchEvent(Component.java:3803)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
   at java.awt.Container.dispatchEventImpl(Container.java:2010)
   at java.awt.Window.dispatchEventImpl(Window.java:1778)
   at java.awt.Component.dispatchEvent(Component.java:3803)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
   at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:230)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
   at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
   at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
   at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
   … 36 more

The line of code that throws the exception is the following:
accessControlService.addACEs(pred, user_ace);

Why?
And what is exactly the meanin of these tgwo lines of code?
How can I invite a the new user to another reference (folder) with the role consumer?

Many thanks to all.

All the best,

Sergio

Outcomes