You are viewing limited content. For full access, please sign in.

Question

Question

MalformedDataException: Received bad response from the server.

asked on January 3, 2022 Show version history

Good Evening Everyone,

 

I'm getting the following error when trying to call the Create method on a DocumentInfo objects:

LaserficheRepositoryException Laserfiche.RepositoryAccess.MalformedDataException: Received bad response from the server.
at Laserfiche.RepositoryAccess.EntryLock.ParseLockResponse(HttpResponse response)
at Laserfiche.RepositoryAccess.EntryLock.LockInternal(HttpUrl url, LockType type, Dictionary`2 additionalHeaders, String etag)
at Laserfiche.RepositoryAccess.EntryLock..ctor(EntryInfo info, EntryNameOption options)
at Laserfiche.RepositoryAccess.Entry.MakeDocFolderWithLock(EntryInfo info, EntryNameOption options)
at Laserfiche.RepositoryAccess.DocumentInfo.Create(FolderInfo parent, String name, EntryNameOption options)

 

I have a sample harness and our actual application that's using the same test code. It works fine in the sample harness; however, in our application, the test code fails. Both are running on the same server. Any ideas what could cause this? Again, this is hard coded test code, and every thing is the same between both. Below is the code. Any help would be really appreciated. Thank you.

 

Session session = new Session();
try
{
   session.IsSecure = true;
   var repositoryRegistration = new RepositoryRegistration("CompanyWebsiteRemovedForSecurity.com", "companyRepositoryRemovedForSecurity", 80, 443);
	session.LogIn("UsernameRemovedForSecurity", "PasswordRemovedForSecurity", repositoryRegistration);
	var pdfBytes = File.ReadAllBytes("c:\\temp\\sample.pdf");
	var documentInfo = new DocumentInfo(session);
	var myFolder = Folder.GetFolderInfo("\\Customer Files\\Client Services", session);
	documentInfo.Create(myFolder, "Create By Document Builder", EntryNameOption.AutoRename);
	string documentHeader = "application/pdf";
	string documentExtension = "pdf";

	using (MemoryStream buffer = new MemoryStream(pdfBytes))
	{
		using (Stream eDocStream = documentInfo.WriteEdoc(documentHeader, buffer.ToArray().LongLength))
		{
			documentInfo.Extension = documentExtension;
			documentInfo.Comment = "Comment added here";

			eDocStream.Write(buffer.ToArray(), 0, buffer.ToArray().Length);
		}
	}
	documentInfo.Save();
}
catch (LaserficheRepositoryException ex)
{
	LogInfo($"LaserficheRepositoryException {ex}");
	session.LogOut();
	session.Close();
}
1 0

Replies

replied on January 4, 2022

What version of Laserfiche.RepositoryAccess.dll are you using? This might be fixed in a newer build. I found one potential bug (#218167) that is fixed in 10.4.2.59 and newer.

2 0
replied on January 6, 2022

Thanks Robert. It did appear we were on an older version of Laserfiche.RepositoryAccess.dll. Unfortunately, updating to the latest version (10.4.2.103) produces the same MalformedDataException result. :(

 

Is there a way to actually capture the response that's returned from Laserfiche? Maybe that would give more insight on what's going on. 

0 0
replied on January 6, 2022

It sounds like a proxy or firewall might be interfering with the request. You can use winhttp tracing to see the traffic. The logs might show that the request is being intercepted by something other than the Laserfiche server. You can open a support case if you need help with this.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.