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";

> 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

Reply via email to