%PCD_UPDATE_VERSION problems in OpenText DM 5.3.1

I recompiled for DM server 5.3.1 some code which is correctly working with Hummingbird 5.1.0.5.
Everything is working the same way except the replacement of the content of a document by setting

lobjPCDDoc.SetProperty ("%VERSION_DIRECTIVE","%PCD_UPDATE_VERSION");

In this case I always get an error with
ErrNumber -2147220925
ErrDescription Failed to authenticate you as a DM user. Please verify information and try again.

or
ErrNumber -2147220712
ErrDescription "Your request cannot be done at this time. Please try again later."

Is there any known bug or issue about it ?

The user provided for acquiring a dst is correctly working for all other functionalities.
Here below, I provide some sample c# code to replicate the problem, thanks in advance for any kind of reply .

// 1) checkout document
PCDDocObject pClient= new PCDDocObject();
pClient.SetDST(aParams.dst);
pClient.SetObjectType(aParams.search_object); 
pClient.SetProperty("%TARGET_LIBRARY", aParams.library); 

pClient.SetProperty("%OBJECT_IDENTIFIER",  asDocNumber);
pClient.SetProperty("%VERSION_ID", asVersionId  );
pClient.SetProperty("%STATUS", "%LOCK");
pClient.Update();
if (pClient.ErrNumber == -2147221041)
{
    //ok
}

// here verify if error ...

// 2) set some properties
PCDDocObject lobjPCDDoc =new PCDDocObject();


lobjPCDDoc.SetDST(aParams.dst);
lobjPCDDoc.SetObjectType(aParams.search_object); 
lobjPCDDoc.SetProperty("%TARGET_LIBRARY", aParams.library); 

lobjPCDDoc.SetProperty("%OBJECT_IDENTIFIER",  asDocNumber);
lobjPCDDoc.SetProperty("%VERSION_ID", asVersionId   );

lobjPCDDoc.Fetch();
// first, set existing properties
    {
        PCDPropertyList lobjRetProps= lobjPCDDoc.GetReturnProperties();
        int liPropCount= lobjRetProps.GetSize();
        for (int liProp = 0; liProp<liPropCount ; liProp++ )
        {
            lobjRetProps.NextProperty();
            string lsPropNom = lobjRetProps.GetCurrentPropertyName();
            string lsPropVal = lobjRetProps.GetCurrentPropertyValue().ToString();
            try
            {
                lobjPCDDoc.SetProperty(lsPropNom,lsPropVal);
            }
            catch(Exception exSetProp)
            {
                m_logger.Error("fallito SetProperty("+lsPropNom+","+lsPropVal+") : " + exSetProp.Message);
            }
        }

    }
// set new property values
{

    TipologiaDocumentaleBase lDatiBase = aDatiProfilo.tipologiaBase;
    MetadatiTavolare lDatiSpecifici = aDatiProfilo.metadatiTavolare;


    lobjPCDDoc.SetProperty("ABSTRACT",lDatiBase.ABSTRACT);
    lobjPCDDoc.SetProperty("DOCNAME",lDatiBase.DOCNAME);
    lobjPCDDoc.SetProperty("AUTHOR_ID",lDatiBase.AUTHOR);
    lobjPCDDoc.SetProperty("TYPIST_ID",lDatiBase.AUTHOR);
    lobjPCDDoc.SetProperty("APP_ID",lDatiBase.APPLICATION);//"ACROBAT");
    lobjPCDDoc.SetProperty("DOCUMENTTYPE",lDatiBase.DOCUMENTTYPE);
    if(lDatiBase.STORAGETYPE != null) lobjPCDDoc.SetProperty("STORAGE",lDatiBase.STORAGETYPE);

    //---------- here add some more application-specific properties


//verify if properties are consistent (try .Update vith "%VERIFY_ONLY","%YES" flag set)
lobjPCDDoc.SetProperty ("%VERSION_DIRECTIVE","%PCD_UPDATE_VERSION");
lobjPCDDoc.SetProperty("%VERIFY_ONLY","%YES");
lobjPCDDoc.Update();
if (lobjPCDDoc.ErrNumber !=0)
{
    **HERE I ALWAYS GET THE MENTIONED ERROR  !!**
    //HANDLE ERROR
}



// 3) replace content
        PCDPutDoc pPutDoc = new PCDPutDoc(); 
    pPutDoc.SetDST(aParams.dst);
    pPutDoc.AddSearchCriteria("%TARGET_LIBRARY",aParams.library);
    pPutDoc.AddSearchCriteria("%DOCUMENT_NUMBER",asDocNumber);
    pPutDoc.AddSearchCriteria("%VERSION_ID",asVersionId);
    pPutDoc.Execute();
    if (pPutDoc.ErrNumber != 0)
    {
        //HANDLE ERROR
    }
    pPutDoc.SetRow(1);
    PCDPutStream pPutStream = (PCDPutStream)pPutDoc.GetPropertyValue("%CONTENT");
    if (pPutDoc.ErrNumber != 0) 
    {
        //HANDLE ERROR
    }
    using ( System.IO.FileStream lfs =
                new System.IO.FileStream(aFilePathName, System.IO.FileMode.Open, System.IO.FileAccess.Read))
    {
        bool lbresult=true;
        int iMaxWrite= 16383;
        int iWriteBytes= 0;
        long totalWrittenBytes= 0;
        long totalReadBytes= 0;
        byte[] lb = new byte[iMaxWrite];//new byte[lub];


        int liReadCount = lfs.Read(lb,0,1024);
        while ( liReadCount  > 0 ) 
        {
            totalReadBytes += liReadCount;
            pPutStream.Write(lb,liReadCount,out iWriteBytes);
            if ((pPutStream.ErrNumber != 0)) 
            {
                //handle error
            }
            else 
            {
                if (iWriteBytes != pPutStream.BytesWritten) 
                {
                            //handle error
                            }
                totalWrittenBytes = (totalWrittenBytes + iWriteBytes);
            }
            liReadCount = lfs.Read(lb,0,1024);
        }
        pPutStream.SetComplete();
        if (totalReadBytes == totalWrittenBytes)
        {
            //ok
        }
        else
        { 
            //handle this
        }
        //  return lbresult;
    }//using (System.IO.FileStream lfs



// 4) commit (USING lobjPCDDoc variable initialized in pont 2)
lobjPCDDoc.SetProperty("%VERIFY_ONLY","%NO");
lobjPCDDoc.Update();
if (lobjPCDDoc.ErrNumber !=0)
{
    **HERE I ALWAYS GET THE MENTIONED ERROR  !!**

    //HANDLE ERROR

}

// 5) check-in
// omissis rebus
Tagged: