Navigation:


FORUMS > SentryFile Version 5 Topics > SF5 - API Integration / Programming Assistance < refresh >
Topic Title: API: Trouble with Add_CreateRecordAndPutFile() call
Created On Wed February 22, 2012 4:37 PM
Topic View:

View thread in raw text format


ktighe

Posts: 5
Joined: Aug 2010

Wed February 22, 2012 4:37 PM
User is offline

Hi,

I'm working with with the DocuCore API (SentryFile version 5.17), and I'm having trouble getting the Add_CreateRecordAndPutFile() method to work.

I'm expecting to get back the record id of the newly inserted document, but instead I get back "1" each time, and the document does not appear in the cabinet. I don't see any error messages though (the response is 200 OK).

I have tested the alternate method of calling Add_CreateRecord() followed by Add_PutFile(), and this works as expected. I would prefer to use Add_CreateRecordAndPutFile(), however, in order to limit the number of API calls.

Are there any quirks I need to be aware of when calling Add_CreateRecordAndPutFile?

Thanks for your help!

-Kevin
 
Reply
   
Quote
   
Top
   
Bottom
     



SupportRep

Posts: 6587
Joined: Feb 2004

Wed February 22, 2012 7:07 PM
User is offline

Hmm... The documentation on that web service seems to be wrong. It is actually returning a boolean 1 or 0 (1 means successful, 0 means unsuccessful).

You might instead want to use two calls. They would be:

Add_CreateRecord (this will return the document_id)

- and -

Add_PutFile

Would you mind giving this a try?

-------------------------
-SentryFile Support
 
Reply
   
Quote
   
Top
   
Bottom
     



ktighe

Posts: 5
Joined: Aug 2010

Thu February 23, 2012 10:36 AM
User is offline

Ahh, so that function doesn't return the document id after all. That makes sense.

Our code does currently use the two-call method with Add_CreateRecord and Add_PutFile. This works fine most of the time. We've recently started noticing a problem with a small percentage of inserts, however, which is why I wanted to try doing this all in one call:

Occasionally we've noticed cases where multiple calls to Add_CreateRecord from two different processes will return the *same* document_id. This happens when the two calls to Add_CreateRecord happen very close to each other.

So, process A will call Add_CreateRecord and get a document_id. Process B will call Add_CreateRecord milliseconds later, and will get the same document_id. Then both processes will call Add_PutFile with the same document_id, and one of the documents gets lost.

I had hoped to see if Add_CreateRecordAndPutFile would eliminate this problem for us, but we need the document id returned so this is not an option.

Have you run into this concurrency issue before? I wrote a small C# program that will reproduce this issue in our environment. I can provide that if needed.

Thanks,
Kevin
 
Reply
   
Quote
   
Top
   
Bottom
     



SupportRep

Posts: 6587
Joined: Feb 2004

Thu February 23, 2012 10:42 AM
User is offline

Hi,

Are you using the same user account for the calls to add_createrecord? It's best to "single thread" each user account as some of the isolation is done at the user account level.

Let us know if this helps!

-------------------------
-SentryFile Support
 
Reply
   
Quote
   
Top
   
Bottom
     



ktighe

Posts: 5
Joined: Aug 2010

Thu February 23, 2012 10:58 AM
User is offline

Thanks for the quick response!

Yes, we are using the same user accounts for each process. I'll try splitting up the user accounts by process to see if that helps.

Thanks,
Kevin
 
Reply
   
Quote
   
Top
   
Bottom
     



ktighe

Posts: 5
Joined: Aug 2010

Thu February 23, 2012 2:04 PM
User is offline

I updated my test to use a different user account for each thread, and I can no longer reproduce this issue. Looks like that solved the problem!

Thanks again,
Kevin
 
Reply
   
Quote
   
Top
   
Bottom
     

View thread in raw text format
FORUMS > SentryFile Version 5 Topics > SF5 - API Integration / Programming Assistance < refresh >

Navigation:

FuseTalk 4.0 © 1999-2003 FuseTalk Inc.