Kofax Mobile SDK API Reference
Public Member Functions | List of all members
CaptureServer Class Reference
Inheritance diagram for CaptureServer:
ICaptureServer

Public Member Functions

 CaptureServer (String serverURL, SourceServer sourceServer)
 
void setCertificateValidatorListener (CertificateValidatorListener certificateValidatorListener)
 
void setServerTimeout (int timeout)
 Change the connection timeout. More...
 
int getServerTimeout ()
 Get the connection timeout (in seconds). More...
 
void registerDevice (final ICompletionListener< Void > completionListener)
 Register a mobile device with the server and obtain a license, if available. More...
 
void login (UserProfile userProfile, final ICompletionListener< List< String >> completionListener)
 Login to the server using credentials from the UserProfile object. More...
 
void loginAnonymously (final ICompletionListener< List< String >> completionListener)
 Fetches the device profile shortcuts from the server. More...
 
void logout (final ICompletionListener< Void > completionListener)
 Logout from the Server if logged in. More...
 
void getDocumentType (String documentTypeName, final ICompletionListener< DocumentType > completionListener)
 Returns the DocumentType object which corresponds to the documentTypeName Specified. More...
 
void startJobService (final ICompletionListener< String > completionListener)
 This will start a new document submission job on the server. More...
 
void sendImageService (Document document, String jobID, Image image, int ImageIndex, boolean lastImage, final ICompletionListener< Void > completionListener)
 Sends an Image to the server. More...
 
void submitDocument (Document document, IProgressListener iProgressListener, final ICompletionListener iCompletionListener)
 
ErrorInfo cancelSubmission (String submitJobID)
 
- Public Member Functions inherited from ICaptureServer
void registerDevice (ICompletionListener< Void > completionListener)
 
void login (UserProfile userProfile, ICompletionListener< List< String >> completionListener)
 
void loginAnonymously (ICompletionListener< List< String >> completionListener)
 
void logout (ICompletionListener< Void > completionListener)
 
void getDocumentType (String documentTypeName, ICompletionListener< DocumentType > completionListener)
 
void startJobService (ICompletionListener< String > completionListener)
 
void sendImageService (Document document, String jobID, Image image, int ImageIndex, boolean lastImage, ICompletionListener< Void > completionListener)
 
void submitDocument (Document document, IProgressListener iProgressListener, ICompletionListener iCompletionListener)
 

Detailed Description

A reference implementation of ICaptureServer that allows you to login, download a list of Document Types from the server and submit application-created documents to the server. Server communication requires a valid license to be set.

Constructor & Destructor Documentation

CaptureServer ( String  serverURL,
SourceServer  sourceServer 
)

Create a new CaptureServer using the given server URL and SourceServer.

Parameters
serverURLThe URL of the server.
sourceServerType of the Server
Exceptions
KmcRuntimeException(KMC_UT_LICENSE_LOGISTICS)
IllegalArgumentException("server url is null")
IllegalArgumentException("SourceServer is null")

Member Function Documentation

ErrorInfo cancelSubmission ( String  submitJobID)

The only operation that is currently cancellable is the submitDocument method.

Parameters
submitJobIDJobID of the submission operation from progress listener results.
Returns
An ErrorInfo result indicating whether the cancel task was successfully started.

Implements ICaptureServer.

void getDocumentType ( String  documentTypeName,
final ICompletionListener< DocumentType completionListener 
)

Returns the DocumentType object which corresponds to the documentTypeName Specified.

The DocumentType object is created based on the corresponding DocumentType downloaded from Server. The documentTypeName indicates which DocumentType to download from Server. Returns the DocumentType object, and is fired once the DocumentType object has been successfully downloaded from Server.

Parameters
documentTypeNameThis indicates which DocumentType to download.
completionListenerA completion listener, return results as well as any Exceptions.
Exceptions
IllegalArgumentException("CompletionListener cannot be null")
int getServerTimeout ( )

Get the connection timeout (in seconds).

Timeout defaults to 20 seconds.

See also
setServerTimeout(int)
void login ( UserProfile  userProfile,
final ICompletionListener< List< String >>  completionListener 
)

Login to the server using credentials from the UserProfile object.

The login() method returns List of document type names. You must first call registerDevice() to obtain a license, before calling login(). You may need to register your device after login, if registration requires authentication. The UserProfile object passed in as a parameter must contain valid user credentials, in order for the login() method to succeed.

Parameters
userProfileThis contains the login credentials of the user.
completionListenerA completion listener, return results as well as any Exceptions.
Exceptions
IllegalArgumentException("CompletionListener cannot be null")
void loginAnonymously ( final ICompletionListener< List< String >>  completionListener)

Fetches the device profile shortcuts from the server.

loginAnonymously() returns list of document names. You can only fetch the shortcuts if you have previously registered your device. You may need to register your device after login, if registration requires authentication.

Parameters
completionListenerA completion listener, return results as well as any Exceptions.
Exceptions
IllegalArgumentException("CompletionListener cannot be null")
void logout ( final ICompletionListener< Void >  completionListener)

Logout from the Server if logged in.

The logout() method can only be called after calling the login() method.

Parameters
completionListenerA completion listener, return results as well as any Exceptions.
Exceptions
IllegalArgumentException("CompletionListener cannot be null")
void registerDevice ( final ICompletionListener< Void >  completionListener)

Register a mobile device with the server and obtain a license, if available.

The registerDevice() method must be called prior to calling login() or any other methods in the CaptureServer object which initiate communication with the server. If device registration fails then the listener is called with KmcRuntimeException. If the Require Authentication for Registration setting is enabled on the KFS or KTA server, then the following response code is returned after registerDevice(); ErrorInfo#KMC_LO_REGISTER_REQUIRES_AUTH. Therefore the recommended procedure is to call registerDevice() and if successful then login(). If registerDevice() returns ErrorInfo#KMC_LO_REGISTER_REQUIRES_AUTH then login() and run registerDevice() again.

sample code to call register device :


ICaptureServer captureServer = new CaptureServer("http:sampleServer.com/path", serverType);

captureServer.registerDevice(new ICompletionListener<Void>(){
@literal @Override
public void onComplete(Void ignore, Exception e) {
if(e != null) {
ErrorInfo info = ((KmcRuntimeException)e).getErrorInfo();
if (info == ErrorInfo.KMC_LO_REGISTER_REQUIRES_AUTH) {
// call login() and run registerDevice() again.
}
} else {
// device registered successfully.
}
}
});

Parameters
completionListenerA completion listener, return results as well as any Exceptions.
Exceptions
IllegalArgumentException("CompletionListener cannot be null")
void sendImageService ( Document  document,
String  jobID,
Image  image,
int  ImageIndex,
boolean  lastImage,
final ICompletionListener< Void >  completionListener 
)

Sends an Image to the server.

SendImageService method will be used to send the single image to the server using the given JobID.

Parameters
documentThis contains the document data.
jobIDThe unique ID of the document submission job.
imageThe image field.
ImageIndexThe image index in the document submission job, should start with 0.
lastImageThis indicates the last image in the job submission.
completionListenerA completion listener, return results as well as any Exceptions.
Exceptions
IllegalArgumentException("CompletionListener cannot be null")
void setCertificateValidatorListener ( CertificateValidatorListener  certificateValidatorListener)

Setter for certificate validator listener. The listener receives certificate validation challenge in response to an authentication request from the remote server.

Parameters
certificateValidatorListener
See also
CertificateValidatorListener
void setServerTimeout ( int  timeout)

Change the connection timeout.

This parameter corresponds to all connection timeouts, specified in seconds: connect, read, and write. If any operation exceeds the timeout, the process is cancelled, and an exception will be raised.

Timeout defaults to 20 seconds. Note that providing an invalid value (such as 0 or any negative number) will reset the timeout to the default value.

void startJobService ( final ICompletionListener< String >  completionListener)

This will start a new document submission job on the server.

This will start a new document submission job by calling the startJob method on the server. This will return a unique job ID, which can be used to concurrently submit documents. Submit the images in the document by calling the sendImageService() after getting the job ID.

Parameters
completionListenerA completion listener, return results as well as any Exceptions.
Exceptions
IllegalArgumentException("CompletionListener cannot be null")
void submitDocument ( Document  document,
IProgressListener  iProgressListener,
final ICompletionListener  iCompletionListener 
)

The submitDocument method submits a Document to KFS/KTA, including all fields and pages. Within each page, only the image indicated by the property currentImageIndex is included in the Document submission.

Parameters
documentthis contains the docuement data.
iProgressListenerA progress listener, return progress results and submitJobID.
iCompletionListenerA completion listener, return results as well as any Exceptions.

The documentation for this class was generated from the following file:
Untitled Document © 2018 Kofax, Inc. All rights reserved. Use is subject to license terms.