SDK / API Support
Showing results for 
Search instead for 
Do you mean 

getDocument() issues for some records

SOLVED
Go to Solution
Occasional Advisor

getDocument() issues for some records

Hi guys,

 

 I have a WCF service, part of which is to allow documents to be linked via email to users who do not have a TRIM client install.

 

For example, the link http://myserver/service/Documents.aspx?RecordNumber=00001 would allow the user to download the document attached to record with record number '00001'. 

 

This works great in most cases. The issue is that, for some documents, this call never returns. The calling user sees the following exception:

 

"This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details."

 

The server logs suggest that the service has thrown an unhandled exception and was terminated by the server. 

 

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at <Module>.RECimp.getDocumentEx(RECimp*, APPerror*, EDMextractTaskData*, sstring*, IStream**, stringArray*)
at HP.HPTRIM.SDK.Record.GetDocument(System.String, Boolean, System.String, System.String)

 

 

 

For most documents, the call works as expected and downloads a copy of the document for the user.

For invalid record numbers or records with no documents, the call returns an appropriate exception from TRIM.

The "corrupt" documents which fail to download fail consistently; but they all worked when they were initially saved to TRIM. When looked at through the TRIM client, these documents open and seem perfectly fine.

 

The relevant C# code is below:

 

 

try
{
_logger.Info(@"I write successfully");

var record = new Record(TrimDB, RecordNumber);

_logger.Info(@"Still successful");

docLoc = record.GetDocument(TempFileLocation + @"\" + record.SuggestedFileName, false, "", TempFileLocation);

 _logger.Info(@"I am never reached for corrupt documents.");

}
Catch(Exception e)
{
 _logger.Info(@"Exception; this line is never reached for corrupt documents");
throw e;
}

 

Any thoughts or insight would be extremely appreciated, even if it's basically a shot in the dark. 

 

Cheers,

 Dan

 

 

 

5 REPLIES
Honored Contributor

Re: getDocument() issues for some records

Can you open/extract the document from within the client without issue?
HPE Expert

Re: getDocument() issues for some records

I would turn on workgroup server logging and check for any details in there.

Occasional Advisor

Re: getDocument() issues for some records


EWillsey wrote:
Can you open/extract the document from within the client without issue?

Yes, I can open the documents fine through client. 

Highlighted
Regular Advisor

Re: getDocument() issues for some records

[ Edited ]

A few points:

1. Are you setting TrimApplication.servicestype = service or webservice when instating TRIM database
2. Verify the appdata/localappdata paths for webservice application is configured correctly with full read/write permissions for impersonated user or dedicated user.
3. handle webservice recycling conditions when an IIS worker process is being re-initialized/recycled
4. Not ideal, trap the error/exception and re-generate same webservice request again.
5. Explicitly purge local cached documents either through code, schedule task, TRIM System options or if your web services app can be configured to run on its own workgroup server is another option or basesobject.refreshcarche
6. try baseobject.extract or baseobject.getextractdoc ....etc





**My opinions are my own personal opinions.


kapish.com.au
Occasional Advisor

Re: getDocument() issues for some records


Ralf_Wegener wrote:

A few points:

1. Are you setting TrimApplication.servicestype = service or webservice when instating TRIM database


This solved my issue; really appreciate your help.