You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Tom DeBruycker <to...@gmail.com> on 2014/02/24 18:01:47 UTC

"Bad Request" exception when attempting to create unfiled document in Apache Chemistry 0.10.0

Hi,

I am attempting to create an unfiled document in an IBM FileNet
repository.  I am passing null for the folder ID and invoking the
createDocument() method form my session object.  I do specify an object id
for the new document in the HashMap of passed properties.

The exception I am getting from session.createDocument()

org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException:
Bad Request
    at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:458)
    at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:629)
    at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:119)
    at
org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:751)
    at
com.engagepoint.CMIS.CmisUtil.createUnfiledTextDocument(CmisUtil.java:532)
    at com.engagepoint.CMIS.FileNetClient.uploadFile(FileNetClient.java:123)
    at com.engagepoint.CMIS.FileNetClient.main(FileNetClient.java:68)

I am tracing the Apache Chemistry code using the Jad decompiler.  The
exception that I see in
org.apache.chemistry.opencmis.runtime.SessionImpl.createDocument is:

com.ibm.ecm.cmis.exceptions.InvalidArgumentException: CIL1144: The service
cannot be completed because the required input parameter, objectId, was not
specified.
Explanation: No additional explanation is required.
Action: Specify the required input parameter.
 For more information about implementing the service, see the OASIS CMIS
API specification.



com.ibm.ecm.cmis.exceptions.InvalidArgumentException: CIL1144: The service
cannot be completed because the required input parameter, objectId, was not
specified.
Explanation: No additional explanation is required.
Action: Specify the required input parameter.
 For more information about implementing the service, see the OASIS CMIS
API specification.
    at
com.ibm.ecm.cmis.app.datasource.UnfiledSource.removeFromFolder(UnfiledSource.java:131)
    at com.ibm.ecm.cmis.app.beans.Unfiled.doPost(Unfiled.java:69)
    at
com.ibm.ecm.cmis.app.beans.BaseCollection.post(BaseCollection.java:552)
    at com.ibm.ecm.cmis.app.servlet.CMISServlet.doPost(CMISServlet.java:188)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at
com.ibm.ecm.cmis.app.servlet.CMISServlet.service(CMISServlet.java:426)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
    at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
    at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
    at
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
    at
com.ibm.ecm.integration.common.compression.CompressionFilter.doFilter(CompressionFilter.java:55)
    at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
    at
com.ibm.ecm.integration.common.nls.servlet.LocaleFilter.doFilter(LocaleFilter.java:57)
    at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
    at
com.ibm.ecm.integration.common.messageTrace.servlet.MessageTraceFilter.doFilter(MessageTraceFilter.java:84)
    at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
    at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
    at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)
    at
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
    at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
    at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1814)


In my test code I set three properties in the property HashMap that I pass
to session.createDocument().  Those properties are
PropertyIds.OBJECT_TYPE_ID, PropertyIds.NAME and PropertyIds.OBJECT_ID.
SessionImpl.createDocument() calls the method
     getBinding().getObjectService().createDocument(getRepositoryId(),
this.objectFactory.convertProperties(properties, null, null,
(versioningState == VersioningState.CHECKEDOUT) ?
CREATE_AND_CHECKOUT_UPDATABILITY : CREATE_UPDATABILITY), (folderId == null)
? null : folderId.getId(),
this.objectFactory.convertContentStream(contentStream), versioningState,
this.objectFactory.convertPolicies(policies),
this.objectFactory.convertAces(addAces),
this.objectFactory.convertAces(removeAces), null);


When I step through the code, the method
this.objectFactory.convertProperties() does not copy the property
PropertyIds.OBJECT_ID to the new list of properties.  This results in the
exception listed above.

So, after that long explanation, my question is, what am I missing in
trying to create an unfiled document?  I am calling the createDocument()
from the session object.  I am passing in null for the Folder attribute of
the createDocument() call.

Any help would be greatly appreciated.

Thanks,
Tom DeBruycker

Re: "Bad Request" exception when attempting to create unfiled document in Apache Chemistry 0.10.0

Posted by Jay Brown <ja...@us.ibm.com>.
Unfortunately to remain fully compliant with CMIS 1.0 there is no way to
create an unfiled document when using the AtomPub binding.

You would have to just designate a folder somewhere to use as your unfiled
target.   There is no substantial additional performance overhead to doing
this in FileNet.

If it is really important for some reason that this document not be linked
to any folder you can either unfile with the client or have an event action
on the folder that will just automatically unfile anything that gets filed
to that folder.    I know this is not optimal, but we are bound to the spec
on this.


Jay Brown
Senior Engineer, ECM Development
IBM Software Group
jay.brown@us.ibm.com


                                                                                                                                         
  From:       Tom DeBruycker <to...@gmail.com>                                                                                  
                                                                                                                                         
  To:         dev@chemistry.apache.org,                                                                                                  
                                                                                                                                         
  Date:       02/24/2014 09:03 AM                                                                                                        
                                                                                                                                         
  Subject:    "Bad Request" exception when attempting to create unfiled document in Apache Chemistry 0.10.0                              
                                                                                                                                         





Hi,

I am attempting to create an unfiled document in an IBM FileNet
repository.  I am passing null for the folder ID and invoking the
createDocument() method form my session object.  I do specify an object id
for the new document in the HashMap of passed properties.

The exception I am getting from session.createDocument()

org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException:

Bad Request
    at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode
(AbstractAtomPubService.java:458)
    at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post
(AbstractAtomPubService.java:629)
    at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument
(ObjectServiceImpl.java:119)
    at
org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument
(SessionImpl.java:751)
    at
com.engagepoint.CMIS.CmisUtil.createUnfiledTextDocument(CmisUtil.java:532)
    at com.engagepoint.CMIS.FileNetClient.uploadFile
(FileNetClient.java:123)
    at com.engagepoint.CMIS.FileNetClient.main(FileNetClient.java:68)

I am tracing the Apache Chemistry code using the Jad decompiler.  The
exception that I see in
org.apache.chemistry.opencmis.runtime.SessionImpl.createDocument is:

com.ibm.ecm.cmis.exceptions.InvalidArgumentException: CIL1144: The service
cannot be completed because the required input parameter, objectId, was not
specified.
Explanation: No additional explanation is required.
Action: Specify the required input parameter.
 For more information about implementing the service, see the OASIS CMIS
API specification.



com.ibm.ecm.cmis.exceptions.InvalidArgumentException: CIL1144: The service
cannot be completed because the required input parameter, objectId, was not
specified.
Explanation: No additional explanation is required.
Action: Specify the required input parameter.
 For more information about implementing the service, see the OASIS CMIS
API specification.
    at
com.ibm.ecm.cmis.app.datasource.UnfiledSource.removeFromFolder
(UnfiledSource.java:131)
    at com.ibm.ecm.cmis.app.beans.Unfiled.doPost(Unfiled.java:69)
    at
com.ibm.ecm.cmis.app.beans.BaseCollection.post(BaseCollection.java:552)
    at com.ibm.ecm.cmis.app.servlet.CMISServlet.doPost
(CMISServlet.java:188)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at
com.ibm.ecm.cmis.app.servlet.CMISServlet.service(CMISServlet.java:426)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service
(ServletWrapper.java:1224)
    at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest
(ServletWrapper.java:774)
    at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest
(ServletWrapper.java:456)
    at
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest
(ServletWrapperImpl.java:178)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget
(WebAppFilterChain.java:136)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter
(WebAppFilterChain.java:97)
    at
com.ibm.ecm.integration.common.compression.CompressionFilter.doFilter
(CompressionFilter.java:55)
    at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter
(FilterInstanceWrapper.java:195)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter
(WebAppFilterChain.java:91)
    at
com.ibm.ecm.integration.common.nls.servlet.LocaleFilter.doFilter
(LocaleFilter.java:57)
    at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter
(FilterInstanceWrapper.java:195)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter
(WebAppFilterChain.java:91)
    at
com.ibm.ecm.integration.common.messageTrace.servlet.MessageTraceFilter.doFilter
(MessageTraceFilter.java:84)
    at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter
(FilterInstanceWrapper.java:195)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter
(WebAppFilterChain.java:91)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter
(WebAppFilterManager.java:928)
    at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters
(WebAppFilterManager.java:1025)
    at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest
(CacheServletWrapper.java:87)
    at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)
    at
com.ibm.ws.webcontainer.WSWebContainer.handleRequest
(WSWebContainer.java:1662)
    at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination
(HttpInboundLink.java:459)
    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest
(HttpInboundLink.java:526)
    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest
(HttpInboundLink.java:312)
    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready
(HttpInboundLink.java:283)
    at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators
(NewConnectionInitialReadCallback.java:214)
    at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete
(NewConnectionInitialReadCallback.java:113)
    at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted
(AioReadCompletionListener.java:165)
    at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback
(AbstractAsyncFuture.java:217)
    at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions
(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at
com.ibm.io.async.ResultHandler.runEventProcessingLoop
(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1814)


In my test code I set three properties in the property HashMap that I pass
to session.createDocument().  Those properties are
PropertyIds.OBJECT_TYPE_ID, PropertyIds.NAME and PropertyIds.OBJECT_ID.
SessionImpl.createDocument() calls the method
     getBinding().getObjectService().createDocument(getRepositoryId(),
this.objectFactory.convertProperties(properties, null, null,
(versioningState == VersioningState.CHECKEDOUT) ?
CREATE_AND_CHECKOUT_UPDATABILITY : CREATE_UPDATABILITY), (folderId == null)
? null : folderId.getId(),
this.objectFactory.convertContentStream(contentStream), versioningState,
this.objectFactory.convertPolicies(policies),
this.objectFactory.convertAces(addAces),
this.objectFactory.convertAces(removeAces), null);


When I step through the code, the method
this.objectFactory.convertProperties() does not copy the property
PropertyIds.OBJECT_ID to the new list of properties.  This results in the
exception listed above.

So, after that long explanation, my question is, what am I missing in
trying to create an unfiled document?  I am calling the createDocument()
from the session object.  I am passing in null for the Folder attribute of
the createDocument() call.

Any help would be greatly appreciated.

Thanks,
Tom DeBruycker