Florian,
I was able to figure out the root cause of this error. It boils down to
the java artifacts generated by JAX-WS RI versus CXF wsdl2java.
Apache CXF wsdl2java generates below version of query method in
DiscoveryServicePort.java -
public QueryResponse query(Query parameters) throws CmisException;
The current 0.7.0 version of the query method is as follows :
public CmisObjectListType query(String repositoryId, String statement,
Boolean searchAllVersions, Boolean includeAllowableActions,
EnumIncludeRelationships includeRelationships,
String renditionFilter, BigInteger maxItems, BigInteger skipCount,
CmisExtensionType extension) throws CmisException;
This _article_ <https://cwiki.apache.org/CXF20DOC/wsdl-to-java.html>
explains behavior of CXF when it comes to code generation styles.
Especially the statement below in the article causes Apache CXF to
generate the query method as above.
*"**Also, note the wrapper style is not always available, the WSDL
criteria specified in Section 2.3.1.2 ("Wrapper Style") of the
specification must be met or only non-wrapper style will be generated.**"*
JAX-WS RI has a bug, as in - it does not strictly follow Section 2.3.1.2
("Wrapper Style") of the specification, and hence generates the query
method differently.
Anyways, I had to change the code for DiscoveryServiceImpl.java to
accommodate this change in the java artifacts. My modified code for the
query method is as shown below. This also breaks the
chemistry-opencmis-server-bindings code. (DiscoveryService.java now
needs to accommodate the new query method as defined by the new
DiscoveryServicePort.java.). I was able to comment out the
server-bindings component from the parent POM (as well as the FITs,
since they depend on the server bindings), and recompile rest of the
Chemsitry codebase with CXF successfully.
I was also able to test all the functionality including query features
successfully. On the workbench, I was able to run the Test Compatibility
Kit, and the test report is attached.
*IMPORTANT: **Can you please tell me if the TCK is actually a test of
the Chemistry code base, or more of a test of the repository and it’s
capabilities and compatibility with CMIS standard ?****If you can
quickly look at the test report (attach**ed) and let me know if you see
any glaring issues with the test results, that would be awesome.*
My modified code for DiscoveryServiceImpl is as shown below -
*public*ObjectList query(String repositoryId, String statement, Boolean
searchAllVersions,
Boolean includeAllowableActions, IncludeRelationships
includeRelationships, String renditionFilter,
BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
_DiscoveryServicePort_ port = portProvider._get__DiscoveryServicePort_();
_Query_ query = *new* _ObjectFactory_().createQuery();
query.setRepositoryId(repositoryId);
query.setStatement(statement);
query.setSearchAllVersions(searchAllVersions);
query.setIncludeAllowableActions(includeAllowableActions);
query.setIncludeRelationships(/_convert_/(_EnumIncludeRelationships_.*class*,includeRelationships));
query.setRenditionFilter(renditionFilter);
query.setMaxItems(maxItems);
query.setSkipCount(skipCount);
_CmisExtensionType_ extensionType = *new* _CmisExtensionType_();
/convertExtension/(extension, extensionType);
query.setExtension(extensionType);
*try* {
_QueryResponse_ queryResponse = port.query(query);
*return* /convert/(queryResponse.getObjects());
/*
return convert(port.query(repositoryId, statement, searchAllVersions,
includeAllowableActions,
convert(EnumIncludeRelationships.class, includeRelationships),
renditionFilter, maxItems,
skipCount, convert(extension)));
*/
} *catch* (_CmisException_ e) {
*throw* convertException(e);
} *catch* (Exception e) {
*throw* *new* CmisRuntimeException("Error: " + e.getMessage(), e);
} *finally* {
portProvider.endCall(port);
}
}
Regards
Ashish
-----Original Message-----
From: Florian Müller [mailto:[email protected]]
Sent: Thursday, August 23, 2012 2:32 PM
To: Desai, Ashish (CGI Federal)
Cc: [email protected]
Subject: Re: Apache Chemistry - compatibility with Apache CXF
Ashish,
That is strange. A query call is not different to all the other calls.
Would it be possible to record the request and response messages with
Fiddler or a similar tool? That might give us a hint where we have to look.
Florian
Florian,
I was able to get past the that hurdle. With the CXF version, I need
to pass the WSDL URL and include the "?wsdl" part of it. If I do not
include the ?wsdl in the URL, it fails with the exception I had
mentioned in the previous thread.
Anyways, I was able to test most of the Workbench functionality except
for the Query tab on the work bench.
The Query tab is throwing the below exception - ( I tested this with
the original 0.7.0 workbench, and the query feature works fine.)
> 13:07:49 DEBUG nt.bindings.spi.webservices.PortProvider: Creating Web
> Service port object of
> {http://docs.oasis-open.org/ns/cmis/ws/200908/}DiscoveryService...
> 13:07:49 ERROR hemistry.opencmis.workbench.ClientHelper:
> CmisInvalidArgumentException: Repository Id must be set!
org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException:
Repository Id must be set!
at
org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractWebServicesService.convertException(AbstractWebServicesService.java:105)
at
org.apache.chemistry.opencmis.client.bindings.spi.webservices.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:87)
at
org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
at
org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
at
org.apache.chemistry.opencmis.client.runtime.util.CollectionPageIterator.hasNext(CollectionPageIterator.java:48)
at
org.apache.chemistry.opencmis.workbench.QueryFrame.doQuery(QueryFrame.java:243)
at
org.apache.chemistry.opencmis.workbench.QueryFrame.access$000(QueryFrame.java:59)
at
org.apache.chemistry.opencmis.workbench.QueryFrame$1.actionPerformed(QueryFrame.java:109)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
Source)
at java.awt.Component.processMouseEvent(Unknown Source)
> 13:07:49 ERROR hemistry.opencmis.workbench.ClientHelper: Error code: 0
> 13:07:49 ERROR hemistry.opencmis.workbench.ClientHelper: Error
> content:<stacktrace:stacktrace
> xmlns:stacktrace="http://chemistry.apache.org/opencmis/exception"
> xmlns="http://chemistry.apache.org/opencmis/exception"
>
xmlns:ns2="http://docs.oasis-open.org/ns/cmis/messaging/200908/">org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException:
>
> Repository Id must be set!
at
org.apache.chemistry.opencmis.server.support.CmisServiceWrapper.checkId(CmisServiceWrapper.java:148)
at
org.apache.chemistry.opencmis.server.support.CmisServiceWrapper.checkRepositoryId(CmisServiceWrapper.java:185)
at
org.apache.chemistry.opencmis.server.support.CmisServiceWrapper.query(CmisServiceWrapper.java:1021)
at
org.apache.chemistry.opencmis.server.impl.webservices.DiscoveryService.query(DiscoveryService.java:82)
at sun.reflect.GeneratedMethodAccessor408.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at
com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at
com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:679)
</stacktrace:stacktrace>
-----Original Message-----
From: Florian Müller [mailto:[email protected]]
<mailto:[mailto:[email protected]]>
Sent: Thursday, August 23, 2012 5:18 AM
To: [email protected] <mailto:[email protected]>
Cc: Desai, Ashish (CGI Federal)
Subject: RE: Apache Chemistry - compatibility with Apache CXF
Hi Ashish,
That's a really good starting point! The Workbench is a good benchmark.
Unfortunately, the exception doesn't provide any details.
Could you increase the log level (in the Workbench Log window)? Maybe
there is more information in CXF debug messages.
Maybe a CXF library is missing?!?
You can also try adding a log message in the catch block of the port
provider.
Cheers,
Florian
> Florian,
> Thanks for your response.
>
> Today, I successfully recompiled the chemistry source (from tag -
> 0.7.0)using the CXFPortProvider implementation that was left in there
> from the past. I mimicked the
> chemistry-opencmis-client-bindings-websphere POM artifact and created
> a chemistry-opencmis-client-bindings-cxf POM. I tried the following
> successfully using the CXF client bindings -
>
> Folder creation - (session.getObjectByPath followed by
> Folder.createFolder)
> Document creation - (Folder.createDocument)
> Type tree retrieval - (session.getTypeDescendants)
>
> We haven't really used much functionality within Alfresco yet. So I do
> not have a really strong test suite beyond the above, unless I write
> more test cases. I thought the opencmis-workbench would be a good
> benchmark to shake out. Let me know if you agree.
>
> Anyways, I tried to test the newly compiled workbench (with the cxf
> bindings and cxf jars in the classpath, and the jax-ws-rt-2.1.7.jar
> removed from the workbench\lib folder). However I get the following
> error during workbench login ( SessionFactoryImpl.getRepositories) -
>
>
>
>> 17:31:02 DEBUG dings.spi.webservices.CmisWebServicesSpi:
>> Initializing Web Services SPI...
>> 17:31:02 DEBUG ngs.spi.webservices.AbstractPortProvider:
>> Initializing Web Service
>> org.apache.chemistry.opencmis.binding.webservices.RepositoryService...
>> 17:31:02 ERROR hemistry.opencmis.workbench.ClientHelper:
>> CmisConnectionException: Cannot initalize Web Services service object
>> [org.apache.chemistry.opencmis.binding.webservices.RepositoryService]:
>> org.apache.cxf.service.factory.ServiceConstructionException: Failed
>> to create service.
> org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException:
>
>
> Cannot initalize Web Services service object
>
> [org.apache.chemistry.opencmis.binding.webservices.RepositoryService]:
> org.apache.cxf.service.factory.ServiceConstructionException: Failed to
> create service.
> at
>
>
org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.initServiceObject(AbstractPortProvider.java:288)
>
>
> at
>
>
org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getPortObject(AbstractPortProvider.java:206)
>
>
> at
>
>
org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getRepositoryServicePort(AbstractPortProvider.java:109)
>
>
> at
>
>
org.apache.chemistry.opencmis.client.bindings.spi.webservices.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:57)
>
>
> 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
>
>
org.apache.chemistry.opencmis.workbench.model.ClientSession.connect(ClientSession.java:184)
>
>
> at
>
>
org.apache.chemistry.opencmis.workbench.model.ClientSession.<init>(ClientSession.java:103)
>
>
> at
>
>
org.apache.chemistry.opencmis.workbench.LoginDialog.createClientSession(LoginDialog.java:535)
>
>
> at
>
>
org.apache.chemistry.opencmis.workbench.LoginDialog$1.actionPerformed(LoginDialog.java:199)
>
>
> at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
> at javax.swing.AbstractButton$Handler.actionPerformed(Unknown
> Source)
> at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
> Source)
>> 17:31:02 ERROR hemistry.opencmis.workbench.ClientHelper: Error code:
>> 0
>> 17:51:13 DEBUG dings.spi.webservices.CmisWebServicesSpi:
>> Initializing Web Services SPI...
>> 17:51:13 DEBUG ngs.spi.webservices.AbstractPortProvider:
>> Initializing Web Service
>> org.apache.chemistry.opencmis.binding.webservices.RepositoryService...
>> 17:51:13 ERROR hemistry.opencmis.workbench.ClientHelper:
>> CmisConnectionException: Cannot initalize Web Services service object
>> [org.apache.chemistry.opencmis.binding.webservices.RepositoryService]:
>> org.apache.cxf.service.factory.ServiceConstructionException: Failed
>> to create service.
> org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException:
>
>
> Cannot initalize Web Services service object
>
> [org.apache.chemistry.opencmis.binding.webservices.RepositoryService]:
> org.apache.cxf.service.factory.ServiceConstructionException: Failed to
> create service.
> at
>
>
org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.initServiceObject(AbstractPortProvider.java:288)
>
>
> at
>
>
org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getPortObject(AbstractPortProvider.java:206)
>
>
> at
>
>
org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider.getRepositoryServicePort(AbstractPortProvider.java:109)
>
>
> at
>
>
org.apache.chemistry.opencmis.client.bindings.spi.webservices.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:57)
>
>
> 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
>
>
org.apache.chemistry.opencmis.workbench.model.ClientSession.connect(ClientSession.java:184)
>
>
> at
>
>
org.apache.chemistry.opencmis.workbench.model.ClientSession.<init>(ClientSession.java:103)
>
>
> at
>
>
org.apache.chemistry.opencmis.workbench.LoginDialog.createClientSession(LoginDialog.java:535)
>
>
> at
>
>
org.apache.chemistry.opencmis.workbench.LoginDialog$1.actionPerformed(LoginDialog.java:199)
>
>
> at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
> at javax.swing.AbstractButton$Handler.actionPerformed(Unknown
> Source)
> at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
> Source)
>> 17:51:13 ERROR hemistry.opencmis.workbench.ClientHelper: Error code:
>> 0
>
>
>
>
> -----Original Message-----
> From: Florian Müller [mailto:[email protected]]
<mailto:[mailto:[email protected]]>
> Sent: Wednesday, August 22, 2012 7:53 AM
> To: [email protected] <mailto:[email protected]>
> Cc: Desai, Ashish (CGI Federal)
> Subject: Re: Apache Chemistry - compatibility with Apache CXF
>
> Hi Ashish,
>
> Nothing has changed since the conversations you have mentioned.
> There is code, but it is unfinished and untested. Since there is no
> driver for the CXF support, I don't expect that is going to change any
> time soon.
> If you want to pick it up, I'm happy to assist you. But I don't want
> to touch a complex feature like this without demand.
>
>
> Florian
>
>
>> Hello,
>>
>> We are currently using Apache Chemistry(0.6.0) to communicate with
>> Alfresco (4.0.1).
>> Chemistry internally seems to use JAX-WS Reference Implementation
>> (jax-ws-rt-2.1.7.jar) as the WS service provider.
>> Our project architecture is using Apache CXF elsewhere in the
>> architecture. We are starting to run into issues because of this
>> usage of two different stacks (Apache CXF and jax-ws-rt.2.1.7.jar),
>> when it comes to using them in the same Java container.
>>
>> I was wondering if there was any way to make Apache Chemistry work
>> with Apache CXF?
>>
>> I tried changing the SPI using the system property
>> -Djavax.xml.ws.spi.Provider=org.apache.cxf.jaxws.spi.ProviderImpl,
>> but soon found out that the chemistry source code is specifically
>> looking for Sun implementation classes like -
>> com.sun.xml.ws.developer.WSBindingProvider
>>
>>
>> I see the following posts from Florian Muller that indicate that some
>> work has been done, but it looks like a point in time fix that was
>> provided for that specific scenario.
>>
>>
>>
>> http://dev.day.com/discussion-groups/content/lists/cmis-chemistry/201
>> 1 -01/2011-01-14__OpenCMIS_Incompatibility_with_CXF_kmvgejegno.html
>>
>>
>>
>> http://mail-archives.apache.org/mod_mbox/chemistry-dev/201101.mbox/%3
>> C
>> [email protected]%3E
<mailto:[email protected]%3E>
>>
>>
>> Please let me know if any further pointers are available that I may
>> have missed.