Re: getDocument() issues for some records (369 Views)
Reply
Occasional Contributor
DanGNB
Posts: 7
Registered: ‎10-10-2013
Message 1 of 6 (434 Views)
Accepted Solution

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

 

 

 

Honored Contributor
EWillsey
Posts: 1,870
Registered: ‎04-20-2010
Message 2 of 6 (416 Views)

Re: getDocument() issues for some records

Can you open/extract the document from within the client without issue?
HP Expert
Jason Boswell
Posts: 284
Registered: ‎03-26-2009
Message 3 of 6 (395 Views)

Re: getDocument() issues for some records

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

Occasional Contributor
DanGNB
Posts: 7
Registered: ‎10-10-2013
Message 4 of 6 (388 Views)

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. 

Regular Advisor
Ralf_Wegener
Posts: 131
Registered: ‎08-21-2010
Message 5 of 6 (369 Views)

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




Occasional Contributor
DanGNB
Posts: 7
Registered: ‎10-10-2013
Message 6 of 6 (354 Views)

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. 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.