Yes, I get the new object ID after updateProperties : ObjectId oDocNewId = oDocAModif.updateProperties(properties)
Then, I get the new Object : oDocAModif = (Document)oSessionGed.getObject(oDocNewId); and then, after I have create the content with 'createContentStream', I update the content of this object : oDocAModif.setContentStream(contentStream, true); Thank You Julien. -----Message d'origine----- De : Florian Müller [mailto:[email protected]] Envoyé : mardi 14 août 2012 15:11 À : [email protected] Cc : Bittard, Julien Objet : RE: Bad request with ATOMPUB Hi Julien, updateProperties() returns a new object. Do you call setContentStream() on this new object or on the original object? If auto versioning is turned on, updateProperties() creates a new version and Alfresco doesn't allow changing the the content of an old version. - Florian > Hi, > > Thank you for your response. > I corrected the url, but I still have the same problem. > I feel that the problem occurs when I repeatedly updating the same > document. > > In my java class, I updateProperties first, then I update content with > setContentStream on the Document. > > > Here are the logs : > > [14 août 2012 14:35:47 DEBUG] - PUT > > http://alfresco.demo.fr/alfresco/cmisatom/5af46382-f978-4ea1-905f-5be2 > 456ce8e0/content?id=workspace%3A%2F%2FSpacesStore%2F278886c9-08b6-4eaa > -b00a-cf44e25cf971%3B1.0&overwriteFlag=true > [14 août 2012 14:38:09 DEBUG] - PUT > > http://alfresco.demo.fr/alfresco/cmisatom/5af46382-f978-4ea1-905f-5be2 > 456ce8e0/content?id=workspace%3A%2F%2FSpacesStore%2F278886c9-08b6-4eaa > -b00a-cf44e25cf971%3B1.0&overwriteFlag=true > > Headers: {null=[HTTP/1.1 400 Bad Request], Date=[Tue, 14 Aug 2012 > 12:34:10 GMT], Vary=[Accept-Encoding], Content-Length=[308], > Connection=[close], Content-Type=[text/html; charset=iso-8859-1]} > [14 août 2012 14:38:09 ERROR] - erreur lors de la maj: <!DOCTYPE HTML > PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> > <title>400 Bad Request</title> > </head><body> > <h1>Bad Request</h1> > <p>Your browser sent a request that this server could not > understand.<br /> </p> <hr> > <address>Apache/2.2.14 (Ubuntu) Server at alfresco.demo.fr Port > 80</address> </body></html> > > > org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: > Bad Request > at > > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:423) > at > > org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.put(AbstractAtomPubService.java:595) > at > > org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.setContentStream(ObjectServiceImpl.java:618) > at > > org.apache.chemistry.opencmis.client.runtime.DocumentImpl.setContentStream(DocumentImpl.java:351) > at > > org.apache.chemistry.opencmis.client.runtime.DocumentImpl.setContentSt > ream(DocumentImpl.java:331) > > > Thank You. > > Julien. > > -----Message d'origine----- > De : Florian Müller [mailto:[email protected]] Envoyé : mardi 14 août > 2012 12:31 À : [email protected] Cc : Bittard, Julien Objet : > Re: Bad request with ATOMPUB > > Hi Julien, > > You are using the wrong CMIS URL. > Check: http://<host>/alfresco/service/cmis/index.html > > > - Florian > > > >> Hello, >> >> I'm a new French user of OPENCMIS. >> I use it to connect my web application to an Alfresco 4.0. I use >> OpenCMIS 0.7.0 and the alfresco extension 0.3, with tomcat 6.0 and >> jdk >> 1.6 >> My web application store, update, read documents in one and only one >> Folder in the repository. >> Everything works, but sometimes, when the application try to update >> content of a document, it doesn't work, and there is an >> CmisInvalidArgumentException : Bad Request. >> >> Here are the logs : >> try to update : >> [13 août 2012 18:59:46 DEBUG] - PUT >> >> >> http://alfresco.demo.fr:80/alfresco/service/cmis/s/workspace:SpacesSt >> o >> >> re/i/e1ed37ca-fb73-4ed6-81ce-56ce57c7de6c/content.docx?overwriteFlag= >> t >> rue >> But, there is an error : >> [13 août 2012 19:02:07 DEBUG] - PUT >> >> >> http://alfresco.demo.fr:80/alfresco/service/cmis/s/workspace:SpacesSt >> o >> >> re/i/e1ed37ca-fb73-4ed6-81ce-56ce57c7de6c/content.docx?overwriteFlag= >> t >> rue >> > Headers: {null=[HTTP/1.1 400 Bad Request], Date=[Mon, 13 Aug 2012 >> 16:59:17 GMT], Vary=[Accept-Encoding], Content-Length=[308], >> Connection=[close], Content-Type=[text/html; charset=iso-8859-1]} >> [13 août 2012 19:02:07 ERROR] - erreur lors de la maj: <!DOCTYPE HTML >> PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> >> <title>400 Bad Request</title> >> </head><body> >> <h1>Bad Request</h1> >> <p>Your browser sent a request that this server could not >> understand.<br /> </p> <hr> >> <address>Apache/2.2.14 (Ubuntu) Server at alfresco.demo.fr Port >> 80</address> </body></html> >> >> >> >> org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: >> Bad Request >> at >> >> >> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:423) >> at >> >> >> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.put(AbstractAtomPubService.java:595) >> at >> >> >> org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.setContentStream(ObjectServiceImpl.java:618) >> at >> >> >> org.apache.chemistry.opencmis.client.runtime.DocumentImpl.setContentStream(DocumentImpl.java:351) >> at >> >> >> org.apache.chemistry.opencmis.client.runtime.DocumentImpl.setContentS >> t >> ream(DocumentImpl.java:331) >> >> >> If I try again the same update, it works. I don't understand why I >> have sometimes this error. >> I can't reproduce it, this happens from time to time. >> >> >> Have you an idea to resolve this problem ? >> >> Thank You >> >> Julien >> >> >> >> Think green - keep it on the screen. >> >> This e-mail and any attachment is for authorised use by the intended >> recipient(s) only. It may contain proprietary material, confidential >> information and/or be subject to legal privilege. It should not be >> copied, disclosed to, retained or used by, any other party. If you >> are not an intended recipient then please promptly delete this e-mail >> and any attachment and all copies and inform the sender. Thank you. > > > > Think green - keep it on the screen. > > This e-mail and any attachment is for authorised use by the intended > recipient(s) only. It may contain proprietary material, confidential > information and/or be subject to legal privilege. It should not be > copied, disclosed to, retained or used by, any other party. If you are > not an intended recipient then please promptly delete this e-mail and > any attachment and all copies and inform the sender. Thank you. Think green - keep it on the screen. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
