Hi Matheus,

We connect to SharePoint repositories all the time via CMIS. And the CMIS Workbench uses exactly the same libary that you are using in your program. If the CMIS Workbench can connect, your program can connect.

Check the URL, the user and the password again. These are the only variables.

You can also catch the CmisUnauthorizedException and call the getErrorContent() method. It returns the error message sent by the server. It might or might not be something helpful.


- Florian


Florian,

   Again, thank you for the answer, but unfortunately that didn't
solved the problem.
   Bellow the parameters that I used:

                         //Authentication and binding parameters
                         parameter.put(SessionParameter.USER, user);
                         parameter.put(SessionParameter.PASSWORD, password);
                         parameter.put(SessionParameter.ATOMPUB_URL, host);
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

                         //Parameters as in OpenCMIS WorkBench
                         parameter.put(SessionParameter.AUTH_SOAP_USERNAMETOKEN, 
"true");
                         parameter.put(SessionParameter.AUTH_HTTP_BASIC, 
"true");
                         parameter.put(SessionParameter.COMPRESSION, "true");
                         parameter.put(SessionParameter.CLIENT_COMPRESSION, 
"false");
                         parameter.put(SessionParameter.COOKIES, "true");
                        
                         //Workaround parameters
                         parameter.put(SessionParameter.OMIT_CHANGE_TOKENS, 
"true");
                         parameter.put(SessionParameter.ADD_NAME_ON_CHECK_IN, 
"true");

   However, the results are the same:


org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException:
Unauthorized

    Again, I'm trying to connect to a SharePoint 2013 server (that I
sucessfully connect using OpenCMIS Workbench). All the parameters the
Workbench show me in the expert dialog I've already copied into my
code... Also, there is no proxy configuration.

Anyone ever tried this kind of connection? Any more workaround I could try?

Thanks everyone in advance,

Regards,
Matheus Barreto
eMail          math...@foxfly.com.br​
Comercial  +55 11 5503-6710
WebSite     http://www.foxfly.com.br

foxfly IT & Marketing
Av. Das Nações Unidas, 12995 – 10º andar
CEP 04578-000, Brooklin Novo
São Paulo, SP

________________________________________
De: Florian Müller <f...@apache.org>
Enviado: domingo, 10 de maio de 2015 04:22
Para: dev@chemistry.apache.org
Cc: Matheus de Oliveira Barreto
Assunto: Re: CMIS Java Class connection to Microsoft SharePoint 2013 -
Unauthorized

Hi Matheus,

If you can connect with the CMIS Workbench, try the following.

* Connect with the CMIS Workbench.
* Return to the Login dialog and select the Expert tab. Here you should
find the session parameters that were used for this connection.
* Take these session parameters and use them in your Java program.
* If that works, play with the parameters. You probably don't need all
of them for a successful connection.
* If that doesn't work, check if you need additional proxy settings. The CMIS Workbench tries to figure them automatically, but your program doesn't.


When everything works fine, also add the following session parameters:

org.apache.chemistry.opencmis.workaround.omitChangeTokens=true
org.apache.chemistry.opencmis.workaround.addNameOnCheckIn=true

They enable workarounds for bugs in the SharePoint CMIS connector.



- Florian


Hello guys.


Again I send you a message to get some help developing with Apache Chemistry.


So, I got this project where I try to connect to a SharePoint 2013 server using CMIS and to get/"upload" files there.


After the help of Sascha Homeier here on this list, I solved some problems and my project now works with the public Alfresco CMIS services and a instance of Alfresco I have on my environment. However, when I try to use it on SharePoint 2013, I got some problems.


So, my code for connection is:


Session session = CMISServicesImpl.connect(strHost, strUser, strPassword);

Folder root = session.getRootFolder();
         ItemIterable<CmisObject> children = root.getChildren();
System.out.println("Found the following objects in the root folder:-");
         ArrayList documentsArray = new ArrayList();
         for (CmisObject o : children) {
         documentsArray.add(o);
System.out.println(o.getName() + " which is of type " + o.getType().getDisplayName());
         }

Basically, the code we all can get on the getting started examples on the Chemistry webpage. When trying to connect to a SharePoint 2013 that have the CMIS enabled, as well as basic authentication (I can, for example, connect to this repository via CMISSync - a CMIS open source client - or Apache Chemistry CMIS Workbench without problems, so the issue are not the credentials or the url), I get the following exception:

org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException: Unauthorized

I think that this is something in the communication of my application with the SharePoint server... This is a common problem for people that try to connect to SharePoint using CMIS on webpages, but there are not answers on theses pages...

Another important information: I do this connection using https and the server does have a valid certificate.

Also, if I try the same connection inserting a proposital error on the url (like a letter where it should be not), the error changes, what tells me that if I get this "Unauthorized" error, my application are communicating with the SharePoint and the credentials/url data are correct.

Anyone here know how can I solve this, or at least understand this problem better? Any tip or hint?

Thanks all you guys again,


Matheus Barreto
eMail          math...@foxfly.com.br<mailto:j...@foxfly.com.br>?
Comercial  +55 11 5503-6710
WebSite     http://www.foxfly.com.br<http://www.foxfly.com.br/>

foxfly IT & Marketing
Av. Das Nações Unidas, 12995 - 10º andar
CEP 04578-000, Brooklin Novo
São Paulo, SP


Reply via email to