Account


Earned badges

Achievement: Latest Unlocked

Topic Started

Topics

Hi 

I want to retrieve api key, flow is as 

Replies Created

Reply to: Exception "Could not create a new package one step"

0 votes

Hi 

I am also getting same issue in creating prototype sample 

OneSpanSign.Sdk.OssException: 'Could not create a new package one step. Exception: Object reference not set to an instance of an object.'

NullReferenceException: Object reference not set to an instance of an object.
 

OssClient ossClient = new OssClient(API_KEY, API_URL);

FileStream fs = File.OpenRead(documentId);

 DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("Test Package .NET")
                    .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings())

.....

 

 PackageId packageId = ossClient.CreatePackageOneStep(superDuperPackage);

 

When I tried to use this, it is giving below error - 

string applicationVersion = ossClient.SystemService.GetApplicationVersion();

OneSpanSign.Sdk.OssServerException: 'Could not get application version. Exception: The remote server returned an error: (401) Unauthorized. HTTP GET on URI https://sandbox.esignlive.com/api/sysinfo. Optional details: {"messageKey":"error.unauthorised.noSession","message":"Failed to retrieve Session","code":401,"name":"Unauthorized"}'
 

OssServerException: The remote server returned an error: (401) Unauthorized. HTTP GET on URI https://sandbox.esignlive.com/api/sysinfo. Optional details: {"messageKey":"error.unauthorised.noSession","message":"Failed to retrieve Session","code":401,"name":"Unauthorized"}
 


Reply to:

0 votes

Thanks Duo, it is executed and that file in sandbox. 

ossClient.SendPackage(packageId);

I have few questions - 

1- How I can view that document in new tab? Just after clicking a event from UI - Ui call api and that method is executed.

2. Signers are not notified with email, how to notify them? 

3. When they click any link from email it shd open that document. 

 

Thanks

Shyam


Reply to: Exception "Could not create a new package one step"

0 votes

Hi Duo, 

Thanks, I am able to open in new tab but blank, how can I view that document (Details_001_20210426_184456PM.pdf) which require sign? 

documentPath = @"D:\Details_001_20210426_184456PM.pdf"

FileStream fs = File.OpenRead(documentPath); 

PackageId - g-m1MPcRcHb8V2f3ecpvKKoPHTA=

now I am trying to fetch GetSigningUrl

//string signingUrl = ossClient.PackageService.GetSigningUrl(package, signerId);

Could not get a signing url. Exception: The remote server returned an error: (403) Forbidden. HTTP GET on URI https://sandbox.esignlive.com/api/packages/xxxxxxxxxxxxxxxxxx=/roles/Signer1/signingUrl. Optional details: {"technical":"Cannot access a package that can be edited xxxxxxxxxxxxx=","messageKey":"error.forbidden.cannotAccessEditablePkg","message":"Cannot access an editable package.","code":403,"name":"Access Denied"}

//string signerAuthToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationToken(new PackageId(package.Id), signerId);

This package is in an invalid state for requested action.

Could not create a signer authentication token. Exception: The remote server returned an error: (400) Bad Request. HTTP POST on URI https://sandbox.esignlive.com/api/authenticationTokens/signer/multiUse. Optional details: {"messageKey":"error.validation.packageManagement.invalidState","message":"This package is in an invalid state for requested action.","code":400,"name":"Validation Error"}


//string singleUseToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationTokenForSingleUse(package, signerId, signerSessionFields);

Here what will be signer session fields here?

 

Thanks

Shyam

 

 

 

 


Attachments

Reply to:

0 votes

Hi Duo

Thanks, I will follow those. 

I want to achieve this - From Code I will send path of my document(d:shyam_agreement.pdf) to OneSpan with Signatories (A,B,C,D along with email id) naming it template. It will create package and form texbox where need to put sign once package will create it will notify all users(A,B,C,D) if flow is parallel, if flow is sequence only to A.

Now A will come to my application with proper login - I will provide a link to sign that document, on that link, I want to open a page(d:shyam_agreement.pdf with sign texbox) in new tab. It can open that in onespan or in my application (1st preference). 

A will sign or reject, it will notify others and send a result to my application in response. 

Once that flow in complete, I want to download that signed document in my local for further reference. 

My users (A,B,C,D) will not check or login in OneSpan, they will click and view document. When they will click through email it will open direct OneSpan and when they will click through my application, it will open new page in my application in new tab.

It will be great if you share any doc sdk for such flow or provide steps. 

Every time it is creating a new Transaction name so there Transaction name mean document sent for signing?

Hope I am able to clear my flow. 

 

Thanks

Shyam

 


Reply to:

0 votes

Hi Duo

Thanks for quick response, now I making step by step 

- Creating document package

Error - Could not send the package. Exception: The remote server returned an error: (400) Bad Request. HTTP POST on URI https://sandbox.esignlive.com/api/packages/NfLxVMo7zVbdOBc1AWJw-Qa1WcI=. Optional details: {"messageKey":"error.validation.sendPackage.noApprovals","message":"Cannot send package without approvals.","code":400,"name":"Validation Error"}

and when I am using my email it is showing this message but it is first in signer, in every transaction it is also adding my email id in Signor list who create that account.

{"messageKey":"error.validation.userAddition.duplicateEmailUsage","message":"The email is already in use for this package.","code":400,"name":"Validation Error"}'
 

Here is code snippet 

public List<PackageDto> InitiateESign(int recordId, List<ESignDto> eSignDtos)
        {
            OssClient ossClient = new OssClient(API_KEY, API_URL);
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //TLS 1.2

            List<PackageDto> packageDtos = new List<PackageDto>();
            foreach (var item in eSignDtos)
            {
                PackageDto packageDto = new PackageDto();

                FileStream fs = File.OpenRead(item.DocumentPath);
                string packageName = item.DocumentName + "_" + item.FeatureId + "_" + item.RecordNumber + "_" + item.RecordId;
                              

                DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed(packageName)
                        .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings())                                    
                        .Build();

                PackageId package = ossClient.CreatePackageOneStep(superDuperPackage);
                

                List<SignerDto> signers = item.Signer;
                for (int i = 0; i < item.Signer.Count; i++)
                {
                    SignerDto tempSigner = new SignerDto();
                    tempSigner = item.Signer[i];

                    Signer signer = SignerBuilder.NewSignerWithEmail(tempSigner.Email)
                        .WithFirstName(tempSigner.FirstName)
                        .WithLastName(tempSigner.LastName)
                        .WithCustomId(i.ToString()).SigningOrder(tempSigner.Order)
                        .Build();
                    tempSigner.SignerId = ossClient.PackageService.AddSigner(package, signer);

 

// please suggest how to incorporate this also

                    //Signature signature = SignatureBuilder.SignatureFor(tempSigner.Email)
                    //  .OnPage(0)
                    //  .AtPosition(215, 510)
                    //  .WithSize(200, 50)
                    //  .WithId(new SignatureId("signature1"))
                    //  .Build();
                    //ossClient.ApprovalService.AddApproval(package, documentId, signature);

                    //tempSigner.SigningUrl = ossClient.PackageService.GetSigningUrl(package, tempSigner.SignerId);
                    //tempSigner.SignerAuthToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationToken(new PackageId(package.Id), tempSigner.SignerId);

                    //signers.Add(tempSigner);
                }
                ossClient.SendPackage(package);

                for (int i = 0; i < item.Signer.Count; i++)
                {
                    SignerDto tempSigner = new SignerDto();
                    tempSigner = item.Signer[i];
                    tempSigner.SigningUrl = ossClient.PackageService.GetSigningUrl(package, tempSigner.SignerId);
                    tempSigner.SignerAuthToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationToken(new PackageId(package.Id), tempSigner.SignerId);

                    signers.Add(tempSigner);
                }

                packageDto.Signer = signers;              
                packageDto.PackageId = package.Id;
                packageDto.DocumentPath = item.DocumentPath;
                packageDto.DocumentName = item.DocumentName;
                packageDto.DocumentId = item.DocumentId.ToString();
                packageDtos.Add(packageDto);
            }


            return packageDtos;
        }

Am I missing any point or making it in wrong way.

How to add SignatureBuilder dynamic per signatory 
like Signor1 - page (0) position ( bottom of page) 
Signor 2 - page (0) position(bottom of page but below signor1), please revert as I need to close this sample prototype today. 

 


Subscriptions

Topics Replies Freshness Views Users

Hi 

I want to retrieve api key, flow is as 

3 1 year 1 month ago 106
Hi, I am getting the exception. Exception "Could not create a new package one step: Object reference not set to an instance of an object". I am on .NET version 4.7 and Newtonsoft 12.
23 1 year ago 252

Code Share

This user has not submitted any code shares.