cancel
Showing results for 
Search instead for 
Did you mean: 

Problem reading directories with spaces and periods

robmeyer
Champ in-the-making
Champ in-the-making
I am trying to read all the directories (spaces) in Alfresco via Web Services. I am having problems reading directories with certain characters (like periods and spaces). This is the error I get:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
   {http://www.alfresco.org/ws/service/repository/1.0}RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>Error executing xpath:
   xpath: /app:company_home/cm:Community Share</ns1:message>
   {http://xml.apache.org/axis/}exceptionNameSmiley Surprisedrg.alfresco.repo.webservice.repository.RepositoryFault
   {http://xml.apache.org/axis/}stackTrace:
   at org.alfresco.repo.webservice.repository.RepositoryWebService.queryChildren(RepositoryWebService.java:294)
   at sun.reflect.GeneratedMethodAccessor574.invoke(Unknown Source)
   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)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
   at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)

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


   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:104)
   at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:90)
   at org.alfresco.webservice.repository.RepositoryFault.getDeserializer(RepositoryFault.java:146)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.axis.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:154)
   at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:84)
   at org.apache.axis.encoding.DeserializationContext.getDeserializer(DeserializationContext.java:464)
   at org.apache.axis.encoding.DeserializationContext.getDeserializerForType(DeserializationContext.java:547)
   at org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:157)
   at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
   at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
   at javax.xml.parsers.SAXParser.parse(Unknown Source)
   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.repository.RepositoryServiceSoapBindingStub.queryChildren(RepositoryServiceSoapBindingStub.java:821)
   at com.digilore.afrescoDemo.AlfrescoWebService.getResources(AlfrescoWebService.java:67)
   at com.digilore.afrescoDemo.BrowseDialog.refreshTree(BrowseDialog.java:90)
   at com.digilore.afrescoDemo.BrowseDialog.refreshTree(BrowseDialog.java:96)
   at com.digilore.afrescoDemo.BrowseDialog.getRootNode(BrowseDialog.java:280)
   at com.digilore.afrescoDemo.BrowseDialog.getDirectoryTree(BrowseDialog.java:204)
   at com.digilore.afrescoDemo.BrowseDialog.getSplitPane(BrowseDialog.java:218)
   at com.digilore.afrescoDemo.BrowseDialog.getMyContentPane(BrowseDialog.java:157)
   at com.digilore.afrescoDemo.BrowseDialog.initialize(BrowseDialog.java:60)
   at com.digilore.afrescoDemo.BrowseDialog.<init>(BrowseDialog.java:51)
   at com.digilore.afrescoDemo.BrowseDialog.main(BrowseDialog.java:272)

For this error, all I am trying to do is read for the folder, "Community Share". If I change the folder name to "Community_Share" then everything works fine.

Here is some simple code:

      FOLDER_STRING = "/app:company_home/cm:Community Share";
      MY_FOLDER = new Reference(STORE, null,
            FOLDER_STRING);

      ResultSetRow[] resultRows = null;

      AlfrescoWebService.openSession(); //authentication
      try {
         RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();

         QueryResult queryResult = repositoryService
               .queryChildren(MY_FOLDER);
         resultRows = queryResult.getResultSet().getRows();
      } catch (Exception exception) {
         exception.printStackTrace();
         AlfrescoWebService.closeSession();
      }

Any help will be appreciated. Thanks.

Rob
2 REPLIES 2

andy
Champ on-the-rise
Champ on-the-rise
Hi

XPaths require the local name to be ISO9075 encoded.
Space is not valid.


FOLDER_STRING = "/app:company_home/cm:Community_x0020_Share";

There is a utility class to help you out, ISO9075.java.

Regards

Andy

robmeyer
Champ in-the-making
Champ in-the-making
Hello Andy,
    I figured it had to be encoded. I just did not know which encoding. Thanks.

Rob Meyer