CMIS 1.1 Java API call shows BadRequest error after upgrade to Alfresco 6.2

cancel
Showing results for 
Search instead for 
Did you mean: 
the-farmer
Member II

CMIS 1.1 Java API call shows BadRequest error after upgrade to Alfresco 6.2

Hi,

I developed an interface to Alfresco Community Edition using CMIS 1.1 API which worked fine.

Recently our company upgraded the Alfresco Server to version 6.2 (not sure from which version) and now any call on the org.apache.chemistry.opencmis.client.api.Session object throws this error: org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Bad request

I discussed with our Alfresco administrator and there is no error in alfresco.log when this event happens.

My code is something like:

SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> parameters = new HashMap<String, String>();
parameters.put(SessionParameter.USER, "<user>");
parameters.put(SessionParameter.PASSWORD, "<pwd>");

// Connection settings.
parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameters.put(SessionParameter.ATOMPUB_URL, "https://<ALFRESCO HOST>/alfresco/api/-default-/public/cmis/versions/1.1/atom");
parameters.put(SessionParameter.AUTH_HTTP_BASIC, "true");
parameters.put(SessionParameter.COOKIES, "true");

// Create session.
// Alfresco only provides one repository.
Repository repository = sessionFactory.getRepositories(parameters).get(0);
Session session = repository.createSession();

Folder root = session.getRootFolder();  // throws ....CmisInvalidArgumentException: Bad request

The session object seems to be created, but I get the error mentioned above whichever call I try to execute on the session object (i.e. list or upload).

 

Thanks

 

2 Replies
jpotts
Professional

Re: CMIS 1.1 Java API call shows BadRequest error after upgrade to Alfresco 6.2

Your code works fine for me running 6.2.2 Enterprise Edition via the Alfresco SDK.

If you are going through a proxy, check the CMIS URL Settings in your alfresco-global.properties file. You might need to override your opencmis.server.value if you are going through a proxy.

For example:

### CMIS URL Settings ###
opencmis.context.override=false
opencmis.context.value=
opencmis.servletpath.override=false
opencmis.servletpath.value=
opencmis.server.override=true
opencmis.server.value=https://alfresco.somehost.com:443
the-farmer
Member II

Re: CMIS 1.1 Java API call shows BadRequest error after upgrade to Alfresco 6.2

Hi Jeff,

Thanks for the reply.

We don't use a proxy.

 

Regards,