CreateSimpleDocument return error 400 (Bad request) when I try to upload file bigger than 750KB
Using CWS web serices the method reateSimpleDocument() return error 400 (Bad Request) when I try to upload file bigger than 750 KB .
Instead if I use CreateDocumentContext(), all works fine I can archive in CS any kind of file without size limitation.
Her below the C# code.
long sDocContext = 0;
// Store the information for the local file
ZetaLongPaths.ZlpFileInfo zfileInfo = null;
try
{
//fileInfo = new FileInfo(sDocument);
zfileInfo = new ZetaLongPaths.ZlpFileInfo(sDocument);
}
catch (Exception ex)
{
sError = "[+] " + sParent + "-" + sDocument + "-" + ex.Message;
}
// Create the DocumentManagement service client
DocumentManagementClient docManClient = new DocumentManagementClient();
// Create the OTAuthentication object and set the authentication token
OTAuthentication otAuth = new OTAuthentication();
otAuth.AuthenticationToken = sToken;
Attachment ot_Att = new Attachment();
try
{
// Create the FileAtts object to send in the upload call
ot_Att.CreatedDate = zfileInfo.CreationTime;
ot_Att.FileName = zfileInfo.Name;
ot_Att.FileSize = zfileInfo.Length;
ot_Att.ModifiedDate = zfileInfo.LastWriteTime;
//ot_Att.Contents = File.ReadAllBytes(sDocument);
ot_Att.Contents = zfileInfo.ReadAllBytes();
sMessage += "[+] FileSize =" + zfileInfo.Length + Environment.NewLine + "[+] CreatedDate =" + zfileInfo.CreationTime + Environment.NewLine + "[+] Name =" + zfileInfo.Name + "[+] LastWriteTime =" + zfileInfo.LastWriteTime + Environment.NewLine + Environment.NewLine;
sMessage += "[+] sParent =>" + sParent + "<=" + Environment.NewLine;
// *****************************************************************************************************
sDocContext = docManClient.CreateSimpleDocument(ref otAuth, sParent, zfileInfo.Name, ot_Att);
// *****************************************************************************************************
sMessage = " [+] Context ID created:" + sDocContext.ToString() + Environment.NewLine;
return sDocContext.ToString();
}
Comments
-
Thanks Appu,
I know there is a method CreateSimpleDocument which is used to have higher performance and it is the reason I would to use it! The problem is that seems there is a sort of block on the size only when I use this method. Anyway, I've found the problem in the CWS configuration: Web.congig --> maxReceivedMessageSize was only 1024000
<binding name="DocumentManagementBinding" maxReceivedMessageSize="2147483647"
messageEncoding="Text" transferMode="Buffered">
<security mode="None">
<transport clientCredentialType="None"/>
</security>
</binding>
What is weird, the wrong configuration doesn't affect to the method CreateDocument .
0
Categories
- All Categories
- 122 Developer Announcements
- 53 Articles
- 151 General Questions
- 146 Thrust Services
- 56 OpenText Hackathon
- 35 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 917 Cloud Fax and Notifications
- 84 Digital Asset Management
- 9.4K Documentum
- 31 eDOCS
- 179 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 9 XM Fax
- Follow Categories