cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS getRepositories exception - Cannot access WSDL: http://******/alfresco/cmis/RepositoryService

mikerawlins
Champ in-the-making
Champ in-the-making
We're developing a new client application using CMIS and Alfresco. (Sorry - don't have access to server logs or even know what version we're running - set up by a different group).

My code works fine with using the Atom Pub binding, but we are having a lot of performance problems. In poking around I came across one article where a user said he got a 50% performance improvement using a web services binding instead of Atom Pub. So I decided to try it. Here's a relevant code snippet (URL masked)



                // Web Services binding - test for performance
                String webservicesUrl = "http://******/alfresco/cmis";
                final String BINDING_TYPE = BindingType.WEBSERVICES.value();
                parameter.put(SessionParameter.BINDING_TYPE, BINDING_TYPE);
                parameter.put(SessionParameter.WEBSERVICES_ACL_SERVICE, webservicesUrl + "/ACLService");
                parameter.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, webservicesUrl + "/DiscoveryService");
                parameter.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, webservicesUrl + "/MultiFilingService");
                parameter.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, webservicesUrl + "/NavigationService");
                parameter.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, webservicesUrl + "/ObjectService");
                parameter.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, webservicesUrl + "/PolicyService");
                parameter.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, webservicesUrl + "/RelationshipService");
                parameter.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, webservicesUrl + "/RepositoryService");
                parameter.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, webservicesUrl + "/VersioningService");

                SessionFactory factory = SessionFactoryImpl.newInstance();
                List<Repository> repositories = factory.getRepositories(parameter);
                m_session = repositories.get(0).createSession();




getRepositories worked fine with Atom Pub, but I get an exception using the above code. cmisBaseException.getErrorContent() returns (URL masked):

<blockcode>
Cannot access WSDL: http://********/alfresco/cmis/RepositoryService
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsseSmiley Frustratedecurity xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-1076305078">
<wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2014-06-12T20:56:00.503Z</wsu:Created>
<wsu:Expires xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2014-06-12T21:01:00.503Z</wsu:Expires>
</wsu:Timestamp>
</wsseSmiley Frustratedecurity>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soapSmiley Frustratederver</faultcode>
<faultstring>Fault occurred while processing.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
</blockcode>

Edited - I did figure out how to get info from the repository:

<blockcode>
         <cmisSmiley TongueroductName>Alfresco Repository (Enterprise)</cmisSmiley TongueroductName>
         <cmisSmiley TongueroductVersion>4.1.3 (97)</cmisSmiley TongueroductVersion>
</blockcode>



Any ideas?

Thanks,
7 REPLIES 7

kaynezhang
World-Class Innovator
World-Class Innovator
RepositoryService's wsdl address is
http://localhost:8080/alfresco/cmisws/cmis/RepositoryService?wsdl
,you should appedn the "?wsdl" to it.
It is the same with other services wsdl.

From CMIS workbench I tried connecting to URL

http://XXX.XX.XX/alfresco/cmisws/cmis/RepositoryService?wsdl

I get:

Exception: CmisConnectionException Cannot access WSDL: http://XXX.XX.XX.XX/alfresco/cmisws/cmis/RepositoryService?wsdl

  Check the URL, the binding, and the credentials.

The login credentials are correct.

I also tried specifying port 8080. I get a slightly different exception, but it also doesn't work.

Ideas?

mrogers
Star Contributor
Star Contributor
For me on enterprise 4.1 the URL to use is

http://localhost:8080/alfresco/cmisws/RepositoryService?wsdl

That works as the URL in chemistry cmis workbench too.

mikerawlins
Champ in-the-making
Champ in-the-making
mrogers - Thanks!

Incremental progress - I can connect to the server from CMIS workbench using that form of URL the web services binding. When using it in my application I get an exception. Here's the code:

<java>
        try {
            if (m_session == null) {
                Map<String, String> parameter = new HashMap<String, String>();
                // Can also try org.apache.chemistry.opencmis.client.runtime.repository.ObjectFactoryImpl
                final String FACTORY_CLASS = "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl";
                parameter.put(SessionParameter.USER, userName);
                parameter.put(SessionParameter.PASSWORD, password);
                final String BINDING_TYPE = BindingType.WEBSERVICES.value();
                parameter.put(SessionParameter.BINDING_TYPE, BINDING_TYPE);


                // from      http://chemistry.apache.org/java/examples/example-create-session.html
                parameter.put(SessionParameter.WEBSERVICES_ACL_SERVICE, webservicesUrl + "/ACLService?wsdl");
                parameter.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, webservicesUrl + "/DiscoveryService?wsdl");
                parameter.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, webservicesUrl + "/MultiFilingService?wsdl");
                parameter.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, webservicesUrl + "/NavigationService?wsdl");
                parameter.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, webservicesUrl + "/ObjectService?wsdl");
                parameter.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, webservicesUrl + "/PolicyService?wsdl");
                parameter.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, webservicesUrl + "/RelationshipService?wsdl");
                parameter.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, webservicesUrl + "/RepositoryService?wsdl");
                parameter.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, webservicesUrl + "/VersioningService?wsdl");
                // parameter.put(SessionParameter.REPOSITORY_ID, "Main Repository");
                /*
                    <cmis:repositoryId>3d4aca1d-ac30-46e8-ae2c-26bae0b0629b</cmis:repositoryId>
                    <cmis:repositoryName>Main Repository</cmis:repositoryName>
                 */

                SessionFactory factory = SessionFactoryImpl.newInstance();
                List<Repository> repositories = factory.getRepositories(parameter);
                m_session = repositories.get(0).createSession();
            }
        }
</java>

And the exception in the getRepositories call:


Exception in thread "main" java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
   at org.apache.chemistry.opencmis.commons.impl.XMLUtils.newDocumentBuilder(XMLUtils.java:306)
   at org.apache.chemistry.opencmis.commons.impl.XMLUtils.parseDomDocument(XMLUtils.java:332)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getEndpointUrlFromWsdl(AbstractPortProvider.java:574)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.initServiceObject(AbstractPortProvider.java:500)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getPortObject(AbstractPortProvider.java:454)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getRepositoryServicePort(AbstractPortProvider.java:280)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:69)
   at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:85)
   at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:109)
   at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:96)
   at com.harbinger.mek.vm.repository.alfresco.AlfrescoRepositoryHelperImpl.repositoryLoginWS(AlfrescoRepositoryHelperImpl.java:226)
   at com.harbinger.mek.vm.repository.alfresco.ECMRepositoryTestHarness.main(ECMRepositoryTestHarness.java:45)
Disconnected from the target VM, address: '127.0.0.1:62695', transport: 'socket'



I can see that my repository supports WSDL, so the problem is in my code. I don't see what's wrong with the code. The credentials are OK, and the webservicesUrl getting passed to the method is in the form:

http://XXXXXX.XXX.XXX.net/alfresco/cmisws

More?

kaynezhang
World-Class Innovator
World-Class Innovator
It seems it is a jar collision problem ,maybe there are more than one versions of xml parsing lib(for example xerces ) in your classpath ,and JDK is not choosing the right one.

I had xml-apis.jar and xerces.jar in library path. Commenting out xml-apis.jar had no effect. Commenting out xerces.jar changed the exception to this:


Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/ws/developer/WSBindingProvider
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.SunRIPortProvider.createPortObject(SunRIPortProvider.java:84)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getPortObject(AbstractPortProvider.java:458)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getRepositoryServicePort(AbstractPortProvider.java:280)
   at org.apache.chemistry.opencmis.client.bindings.spi.webservices.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:69)
   at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:85)
   at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:109)
   at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:96)
   at com.harbinger.mek.vm.repository.alfresco.AlfrescoRepositoryHelperImpl.repositoryLoginWS(AlfrescoRepositoryHelperImpl.java:226)
   at com.harbinger.mek.vm.repository.alfresco.ECMRepositoryTestHarness.main(ECMRepositoryTestHarness.java:45)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.developer.WSBindingProvider
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
   … 9 more


Leaves me to wonder if I am missing some jar files for WSDL support. Any guesses or pointers? I looked around here but couldn't find what I was looking for:

https://chemistry.apache.org/java/0.9.0/maven/project-info.html

kaynezhang
World-Class Innovator
World-Class Innovator
Try to add “jaxws-rt.jar" into your classpath,you can download it here https://jax-ws.java.net/