<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error downloading word, excel files using webservices in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/error-downloading-word-excel-files-using-webservices/m-p/213425#M166555</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been using Alfresco Labs 3 Full Setup for Document Management integrated with my application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any file of Microsoft word or excel format gets uploaded into Alfresco repository.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When i try to open it using Alfresco Web client, It opens properly.&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when i try to open the uploaded file through my application, it gives me "unknown file format" error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have debugged my application and realised that the content downloaded from alfresco is corrupted.&amp;nbsp; :cry: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The byte array obtained contains corrupted data due to which i get the above error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code for downloading is given below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");&lt;BR /&gt;Content[] contentResultArr = WebServiceFactory.getContentService().read(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new Predicate(new Reference[] { new Reference(storeRef, nodeId, null) }, storeRef, null),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Constants.PROP_CONTENT);&lt;BR /&gt;&lt;BR /&gt;Content content = contentResultArr[0];&lt;BR /&gt;InputStream outFileContent = ContentUtils.getContentAsInputStream(content);&lt;BR /&gt;byte [] contentByteArr = ContentUtils.convertToByteArray(outFileContent);&lt;BR /&gt;outFileContent.close();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Kindly help me out with this issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Sep 2009 05:41:34 GMT</pubDate>
    <dc:creator>sharon</dc:creator>
    <dc:date>2009-09-07T05:41:34Z</dc:date>
    <item>
      <title>Error downloading word, excel files using webservices</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/error-downloading-word-excel-files-using-webservices/m-p/213425#M166555</link>
      <description>Hi,I have been using Alfresco Labs 3 Full Setup for Document Management integrated with my application.Any file of Microsoft word or excel format gets uploaded into Alfresco repository.When i try to open it using Alfresco Web client, It opens properly.&amp;nbsp; &lt;IMG id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://migration33.stage.lithium.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; However, when i try to open the uploaded fi</description>
      <pubDate>Mon, 07 Sep 2009 05:41:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/error-downloading-word-excel-files-using-webservices/m-p/213425#M166555</guid>
      <dc:creator>sharon</dc:creator>
      <dc:date>2009-09-07T05:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error downloading word, excel files using webservices</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/error-downloading-word-excel-files-using-webservices/m-p/213426#M166556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;what do you get instead ? I used to work with a Firefox Plugin "PDF Download", but could not download PDFs with this plugin, which were coming from Alfresco. The authentification information got lost on the way and I always got a document with the correct name &amp;amp; extension, but with the "HTML Login.jsp" sourcecode as real content. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My only solution was to not use "PDF Download" so far.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Norgan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 15:36:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/error-downloading-word-excel-files-using-webservices/m-p/213426#M166556</guid>
      <dc:creator>norgan</dc:creator>
      <dc:date>2009-09-09T15:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error downloading word, excel files using webservices</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/error-downloading-word-excel-files-using-webservices/m-p/213427#M166557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem arises when i try to download my content using the convertToByteArray() metohd of ContentUtils:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;Content content = contentResultArr[0];&lt;BR /&gt;InputStream inputSteam= ContentUtils.getContentAsInputStream(content);&lt;BR /&gt;byte [] contentByteArr = ContentUtils.convertToByteArray(inputSteam);&lt;BR /&gt;outFileContent.close();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;The InputStream that i receive is perfect (with say length=18k bytes) , but when i try to convert the input stream to byte array, the total byte size reduces to 16K. This happens with all the file formats(word/excel/pdf) with size greater than 16k bytes since the inputSteam.isAvailable() function used internally in convertToByteArray() return only 16k bytes at a time. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I got this rectified by using the getContentAsString() line :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;Content content = contentResultArr[0];&lt;BR /&gt;String contentString= ContentUtils.getContentAsString(content);&lt;BR /&gt;byte [] contentByteArr = contentString.getBytes();&lt;BR /&gt;outFileContent.close();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;This solves the byte size prob.&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, now when trying to view the file, it gives memory error.&amp;nbsp; :cry: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Temporarily, as a solution, I write the content onto the local system using&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ContentUtils.copyContentToFile(content, file);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and read the content from the file using I/O stream.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If any one can help me read out the content directly from alfresco repository, through any other way besides ContentUtils let me know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sharon.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 05:17:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/error-downloading-word-excel-files-using-webservices/m-p/213427#M166557</guid>
      <dc:creator>sharon</dc:creator>
      <dc:date>2009-09-10T05:17:52Z</dc:date>
    </item>
  </channel>
</rss>

