Indeed the XML generation done in old Chemistry doesn't really know about the content model for xsi:type so doesn't generate proper namespaces.
This explicit typing stuff when there's already a schema available is a PITA :/ Can someone remind me why we need the xsi:type in the generated XML again? Mixing data and content schema is really bad... Florent On Mon, Jul 5, 2010 at 5:36 PM, Florian Müller <[email protected]> wrote: > That is correct. All Chemistry based servers suffer from this problem. > > That other clients do some more relaxed XML parsing doesn't change the fact > that returned XML is invalid. CMIS is using a XML construct here that is not > often used. So simpler XML parsers probably just ignore it. > > The question now is if we want to start introducing workarounds for faulty > servers... > > > - Florian > > -----Original Message----- > From: Stefane Fermigier [mailto:[email protected]] > Sent: Montag, 5. Juli 2010 17:08 > To: Florian Müller > Cc: [email protected] > Subject: Re: Problems with opencmis-client > > > On Jul 1, 2010, at 6:04 PM, Stefane Fermigier wrote: > >> On Jul 1, 2010, at 5:09 PM, Florian Müller wrote: >> >>> Hi Stefane, >>> >>> Re 1: It is not complaining about the service document, it fails to read a >>> type definition. >>> Could you provide a public URL of the server? I will checks what's >>> going on here. >> >> Yes, it was in the code: >> >> static String URL = >> "http://cmis.demo.nuxeo.org/nuxeo/site/cmis/repository"; >> static String LOGIN = "Administrator"; >> static String PASSWD = "Administrator"; > > I have run the opencmis client test again, this time against the old > chemistry test server (started by running from the chemistry root: java -jar > chemistry-tests/target/chemistry-tests-0.5-SNAPSHOT-jar-with-dependencies.jar > ), and with parameters: > > static String URL = "http://localhost:8082/cmis/repository"; > static String LOGIN = ""; > static String PASSWD = ""; > static String REPO_NAME = "test"; > > I now get the following exception: > > Jul 5, 2010 3:26:38 PM > org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl <init> > INFO: Session Parameters: > {org.apache.chemistry.opencmis.binding.spi.type=atompub, > org.apache.chemistry.opencmis.user=, > org.apache.chemistry.opencmis.binding.atompub.url=http://localhost:8082/cmis/repository, > org.apache.chemistry.opencmis.session.repository.id=test, > org.apache.chemistry.opencmis.password=} > Jul 5, 2010 3:26:38 PM > org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl <init> > INFO: Session Locale: en_US > Jul 5, 2010 3:26:38 PM > org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl <init> > INFO: Session Cache Size: 1000 > Exception in thread "main" > org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: > Parsing exception! > at > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:460) > at > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getTypeDefinitionInternal(AbstractAtomPubService.java:740) > at > org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:104) > at > org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:137) > at > org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.getTypeDefinition(PersistentSessionImpl.java:558) > at > org.apache.chemistry.opencmis.client.runtime.repository.PersistentObjectFactoryImpl.getTypeFromObjectData(PersistentObjectFactoryImpl.java:260) > at > org.apache.chemistry.opencmis.client.runtime.repository.PersistentObjectFactoryImpl.convertObject(PersistentObjectFactoryImpl.java:565) > at > org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.getObject(PersistentSessionImpl.java:403) > at > org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.getRootFolder(PersistentSessionImpl.java:508) > at > org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.getRootFolder(PersistentSessionImpl.java:483) > at test2.getRootFolder(test2.java:50) > at test2.main(test2.java:65) > Caused by: java.lang.IllegalArgumentException: prefix cmis is not bound to a > namespace > at > com.sun.xml.bind.DatatypeConverterImpl._parseQName(DatatypeConverterImpl.java:341) > at > com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.parseXsiType(XsiTypeLoader.java:89) > at > com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:67) > at > com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:55) > at > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:481) > at > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:459) > at > com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242) > at > com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176) > at > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360) > at > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339) > at > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.unmarshalElement(AtomPubParser.java:333) > at > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parseElement(AtomPubParser.java:308) > at > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parseEntry(AtomPubParser.java:249) > at > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parse(AtomPubParser.java:91) > at > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:458) > ... 11 more > > Process finished with exit code 1 > > So, we get the same problem with the Chemistry test server implementation, > which means that the opencmis client will probably have the same problem with > all the Chemistry-based server implementations (which were considered correct > after several interoperability experiences, involving the Alfresco TCK, the > cmislib Python library, Objective-C client code, etc.). > > S. > >> >>> Re 2: CMIS has no notion of a default repository. All repositories are >>> equal. >> >> Maybe, there is a getDefaultRepository() call in Chemistry Client and in >> cmislib so people think probably that it is useful, see: >> >> http://www.google.fr/search?num=100&hl=en&q=chemistry+%22getDefaultRepository%22&aq=f&aqi=&aql=&oq=&gs_rfai= >> >>> To get a list all available repositories call: List<Repository> r = >>> sessionFactory.getRepositories(parameter); >>> To connect to the first repository in the list try this: Session s = >>> sessionFactory.getRepositories(parameter).get(0).createSession(); >> >> OK, thanks. >> >> S. >> >>> >>> >>> - Florian >>> >>> >>> -----Original Message----- >>> From: Stefane Fermigier [mailto:[email protected]] >>> Sent: Donnerstag, 1. Juli 2010 16:56 >>> To: [email protected] >>> Subject: Problems with opencmis-client >>> >>> Hi, >>> >>> I'm string to play with opencmis-client against our repository, using the >>> documentation on >>> http://incubator.apache.org/chemistry/opencmis-client-api.html as a starter. >>> >>> I'm starting with the code below, I have two questions: >>> >>> 1. I get an exception when trying to connect >>> "java.lang.IllegalArgumentException: prefix cmis is not bound to a >>> namespace". >>> >>> Our service document starts with "<service >>> xmlns="http://www.w3.org/2007/app" >>> xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" >>> xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">" so I'm >>> a bit puzzled, specially since this is code generated by Chemistry. >>> >>> Has the opencmis client code been tested agains the chemistry server code >>> already ? >>> >>> 2. The session factory asks me to give a repository id, I used to not need >>> this information and go with the default repository. How can I get the >>> default repository, or the list of provided repositories ? >>> >>> Thanks, >>> >>> S. >>> >>> -- >>> >>> import org.apache.chemistry.opencmis.client.api.CmisObject; >>> import org.apache.chemistry.opencmis.client.api.Folder; >>> import org.apache.chemistry.opencmis.client.api.ItemIterable; >>> import org.apache.chemistry.opencmis.client.api.Session; >>> import org.apache.chemistry.opencmis.client.api.SessionFactory; >>> import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl; >>> import org.apache.chemistry.opencmis.commons.SessionParameter; >>> import org.apache.chemistry.opencmis.commons.enums.BindingType; >>> >>> import java.util.HashMap; >>> import java.util.Map; >>> >>> public class test2 { >>> >>> //static String URL = "http://localhost:8080/nuxeo/site/cmis/repository"; >>> static String URL = >>> "http://cmis.demo.nuxeo.org/nuxeo/site/cmis/repository"; >>> static String LOGIN = "Administrator"; >>> static String PASSWD = "Administrator"; >>> >>> public static Session getSession(String url, String login, String passwd) >>> { >>> // default factory implementation of client runtime >>> SessionFactory f = SessionFactoryImpl.newInstance(); >>> Map<String, String> parameter = new HashMap<String, String>(); >>> >>> // user credentials >>> parameter.put(SessionParameter.USER, login); >>> parameter.put(SessionParameter.PASSWORD, passwd); >>> >>> // connection settings >>> parameter.put(SessionParameter.ATOMPUB_URL, url); >>> parameter.put(SessionParameter.BINDING_TYPE, >>> BindingType.ATOMPUB.value()); >>> parameter.put(SessionParameter.REPOSITORY_ID, "default"); >>> >>> // session locale >>> //parameter.put(SessionParameter.LOCALE_ISO3166_COUNTRY, ""); >>> //parameter.put(SessionParameter.LOCALE_ISO639_LANGUAGE, "de"); >>> //parameter.put(SessionParameter.LOCALE_VARIANT, ""); >>> >>> // create session >>> Session s = f.createSession(parameter); >>> return s; >>> } >>> >>> public static Folder getRootFolder(String serviceUrl, String login, >>> String password) { >>> Folder rootFolder = getSession(serviceUrl, login, >>> password).getRootFolder(); >>> return rootFolder; >>> } >>> >>> public static void walk(Folder folder, int level) { >>> ItemIterable<CmisObject> children = folder.getChildren(); >>> for (CmisObject child : children) { >>> System.out.println(child.getName()); >>> if >>> (child.getPropertyValue("cmis:baseTypeId").equals("cmis:folder")) { >>> walk((Folder) child, level + 1); >>> } >>> } >>> } >>> >>> public static void main(String argv[]) { >>> Folder rootFolder = getRootFolder(URL, LOGIN, PASSWD); >>> walk(rootFolder, 0); >>> } >>> >>> } >>> >>> -- >>> >>> Exception in thread "main" >>> org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: >>> Parsing exception! >>> at >>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:460) >>> at >>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getTypeDefinitionInternal(AbstractAtomPubService.java:740) >>> at >>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:104) >>> at >>> org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:137) >>> at >>> org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.getTypeDefinition(PersistentSessionImpl.java:558) >>> at >>> org.apache.chemistry.opencmis.client.runtime.repository.PersistentObjectFactoryImpl.getTypeFromObjectData(PersistentObjectFactoryImpl.java:260) >>> at >>> org.apache.chemistry.opencmis.client.runtime.repository.PersistentObjectFactoryImpl.convertObject(PersistentObjectFactoryImpl.java:565) >>> at >>> org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.getObject(PersistentSessionImpl.java:403) >>> at >>> org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.getRootFolder(PersistentSessionImpl.java:508) >>> at >>> org.apache.chemistry.opencmis.client.runtime.PersistentSessionImpl.getRootFolder(PersistentSessionImpl.java:483) >>> at test2.getRootFolder(test2.java:45) >>> at test2.main(test2.java:60) >>> Caused by: java.lang.IllegalArgumentException: prefix cmis is not bound to >>> a namespace >>> at >>> com.sun.xml.bind.DatatypeConverterImpl._parseQName(DatatypeConverterImpl.java:341) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.parseXsiType(XsiTypeLoader.java:89) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:67) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:55) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:481) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:459) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360) >>> at >>> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339) >>> at >>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.unmarshalElement(AtomPubParser.java:333) >>> at >>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parseElement(AtomPubParser.java:308) >>> at >>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parseEntry(AtomPubParser.java:249) >>> at >>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parse(AtomPubParser.java:91) >>> at >>> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:458) >>> ... 11 more >>> >>> Process finished with exit code 1 >>> >>> -- >>> Stefane Fermigier, Founder and Chairman, Nuxeo >>> Open Source, Java EE based, Enterprise Content Management (ECM) >>> Web: http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87 >>> Twitter: http://twitter.com/sfermigier >>> "Knowing is not enough; we must apply. Being willing is not enough; we must >>> do." - Leonardo da Vinci >>> >> >> -- >> Stefane Fermigier, Founder and Chairman, Nuxeo >> Open Source, Java EE based, Enterprise Content Management (ECM) >> Web: http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87 >> Twitter: http://twitter.com/sfermigier >> "Knowing is not enough; we must apply. Being willing is not enough; we must >> do." - Leonardo da Vinci >> > > -- > Stefane Fermigier, Founder and Chairman, Nuxeo > Open Source, Java EE based, Enterprise Content Management (ECM) > Web: http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87 > Twitter: http://twitter.com/sfermigier > "Knowing is not enough; we must apply. Being willing is not enough; we must > do." - Leonardo da Vinci > > -- Florent Guillaume, Director of R&D, Nuxeo Open Source, Java EE based, Enterprise Content Management (ECM) http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
