1

I'm at a loss with the KTA SDK. My intention is to pass a scanned document in PDF format with a few headers to KTA's jobs queue. As I'm still going through the documentation, my best guess right now is to use the Document class as a DTO then I need to call a method to pass that Document as a parameter:

...

[HttpPost]
public HttpResponseMessage Upload()
{
  var httpRequest = System.Web.HttpContext.Current.Request;

  var DocType = httpRequest.Headers["X-DocType"];
  var Pages = httpRequest.Headers["X-DocPages"];
  var Title = httpRequest.Headers["X-DocTitle"];

  Agility.Sdk.Model.Capture.Document doc = new Agility.Sdk.Model.Capture.Document();
  // doc.DocumentType = DocType; // Type DocumentTypeSummary
  doc.NumberOfPages = Convert.ToInt32(Pages);
  doc.FileName = Title;

...
  • I'm just wondering if I'm on the right track in doing this?
  • My other question is where can we store data from a custom header? In this example, I need to store custom header called Comments and AccountNumber.
  • Lastly, what service needs to be called to send this document to KTA jobs queue? Would CaptureDocumentService be the right one?

I'd greatly appreciate any help on this.

msharp
  • 57
  • 1
  • 1
  • 6

1 Answers1

2

Start with the details laid out in the Sample App example. It shows what to add to your app.config, but what it doesn’t call out explicitly enough is that you should change the SdkServicesLocation value for your environment. You will simply call the functions in the services within the TotalAgility.Sdk namespaces and it will handle the webservice calls.

The CaptureDocumentService might be part of what you need, and there is a set of samples dedicated to the functions on that service. It refers to the Sample Processes folder, which by default is here:

C:\Program Files\Kofax\TotalAgility\Sample Processes\Capture SDK Sample Package

However what you will definitely need are the functions on the JobService. There are different functions with different options, but CreateJobWithDocuments is probably what you want to start with. You can see that this is creating document(s) and a job together in one step.

There is similarity with the parameters on CaptureDocumentService.CreateDocument3, so you might cross-reference with that to best understand the parameters. The difference is that CreateDocument3 just creates a document in the abstract: you want to actually use it as an input to create a job, so use the combined function.

Finally, to pass fields in, you will be setting RuntimeField objects as part of the RuntimeDocument objects going into your CreateJobWithDocuments call.

Stephen Klancher
  • 1,374
  • 15
  • 24
  • 1
    Thank you for your help again. I would have not known there's an example buried in one of those folders if you did not tell me. I will have to review your information and give a try. Thanks Stephen! – msharp Jun 18 '20 at 20:37
  • Sure enough I hit that SdkServicesLocation and got it fixed. But I ran into another error: ~ System.ServiceModel.EndpointNotFoundException: 'There was no endpoint listening at http://localhost/TotalAgility/Services/SDK/CaptureDocumentService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.' ~ Is there additional endpoint I need to setup other than the defaults? – msharp Jun 21 '20 at 22:18
  • 1
    Make sure the value is accurate for your environment: localhost makes sense if you are developing on an all-in-one install of KTA (easiest approach), or at least on a KTA web server. Otherwise point to the correct value for your environment, knowing also that the Windows user you are logged on as needs to be able to properly authenticate when hitting that address. – Stephen Klancher Jun 22 '20 at 15:18
  • It's definitely not localhost. But I have tripled check the value it was correct except the "https", but it throws an error expecting a http instead of https. SdkServicesLocation = https://kofaxdev.net/TotalAgility/Services/SDK. Once I used regular http, it's back to the "no endpoint listening" error. – msharp Jun 22 '20 at 17:26
  • I solved this problem by changing the from . Not sure if that's the right option, but at least I see a different error message for a field that's not found. – msharp Jun 22 '20 at 18:29