Transcription

Captiva 7 Web Services OutputTutorialM. Scott RothDirector of TechnologyMay 2014

ARMEDIA WHITEPAPERContents123Introduction . 1Environment. 2Web Services . 23.1Web Service Design. 33.2Web Service Implementation . 43.2.1IncomingCaseDocsWS Interface Class . 53.2.2IncomingCaseDocs Implementation Class . 63.2.2.1 getCaseInfo Method . 73.2.2.2 validateCaseID Method . 83.2.2.3 importFileToCMS Method. 83.2.3IncomingCaseDocs Result Classes (POD) . 93.2.3.1 WSOCaseInfoResult Data Class . 103.2.3.2 WSOValidateIdResult Data Class. 113.2.3.3 WSOImportResult Data Class . 123.3Web Services Deployment . 133.4WSDL . 134 Captiva Designer Project . 144.1CaptureFlow . 144.1.1Flow . 144.1.2Custom Values . 164.1.3IA Value Assignments . 164.2Profiles . 184.2.1Image Processor Profile . 184.2.2Document Type . 194.2.3Standard Export Profile . 204.3Module Configurations . 224.3.1ScanPlus . 234.3.2ReadBarCode (Image Processor). 234.3.3Desktop . 234.3.4NuanceOCR . 244.3.5LogResults (Standard Export) . 254.3.6WebService Output . 254.3.6.1 GetCaseInfo . 264.3.6.2 ValidateCaseInfo . 284.3.6.3 ImportToCMS . 294.4Deployment. 305 Testing and Results . 30CaptIva 7 Web ServIces Output TutorIal

ARMEDIA WHITEPAPER5.1Test Harness . 305.2Storm. 305.3Standard Out . 315.4IA Administrator . 325.5Complete Run Through . 326 Conclusion . 357 References . 378 Acknowledgements. 37CaptIva 7 Web ServIces Output TutorIal

ARMEDIA WHITEPAPERPrefaceI was recently asked to create a simple Captiva solution that allowed a client to scan documents, verifythe value of a barcode with a database, and export the scanned images to a content managementsystem. This is a capture process I have created many times using a combination of output modules andenterprise export modules. However, the catch this time around was that all database and contentmanagement system interaction had to be accomplished through web services and not the ODBC Exportmodule or an enterprise export module. In addition, it had be accomplished with no or minimal clientside scripting.Having never used the Captiva web service modules, nor created web services for Captiva to consume, Istarted reading the Captiva documentation, the WSOutputScan sample Captiva Designer project, theonline Captiva forums, and Google hoping to find a comprehensive example. It didn’t take long toexhaust these resources and gain no useable knowledge to help me get started.This tutorial lays out, in a step-by-step fashion, my successful experience with Captiva’s Web ServiceOutput module. It is my contribution to the Captiva community to fill the need for a simple, web servicesstarter project. Hopefully you will find it helpful.CaptIva 7 Web ServIces Output TutorIal

ARMEDIA WHITEPAPER1 IntroductionCaptiva 7 (as well as Captiva 6) includes the Web Services Output (WSO) module which allows Captivacapture processes (a.k.a., CaptureFlows) to interface with external systems using SOAP-based webservices. This tutorial documents my experience using Captiva 7’s WSO module. In particular, itprovides examples and best practices, and examines nuances for using web services and WSO.The scenario for this tutorial is that of a law office that scans documents related to cases, verifies theindex data retrieved from an external system, and releases the scanned documents to a contentmanagement system. The hardcopy documents are received by the office and barcode labels are affixedto the documents to identify their case number in a pre-processing step. Captiva is used to scan thedocuments, read the case number from the barcode, and retrieve case information from an externalcase management system via web services. Case information is displayed to the Scan Operator forverification. If it is incorrect, the Scan Operator can change the case number and retrieve the caseinformation again. After the case information is verified, Captiva exports the scanned documents to thefirm’s case management system and updates a simple log file recording the date and time of the scan.Figure 1 depicts the high-level flow of this scenario.Figure 1Incoming Case Document Process FlowThe web services employed in this scenario simulate the actions they imply and simply returnreasonable values to the Captiva WSO module. What the web services do is irrelevant; the importantaspects of the tutorial are how to design, build, and configure the web services to be consumed by theCaptiva WSO module and how to configure the WSO module in the CaptureFlow.This tutorial assumes competency with Eclipse, Java, Captiva modules, and Captiva Designer. I do notexplain how to use these tools other than to highlight important aspects or nuances concerningimplementation of the solution.CaptIva 7 Web ServIces Output TutorIal1

ARMEDIA WHITEPAPER2 EnvironmentThe computing environment I used to develop and test this tutorial consisted of a single, virtualizedserver running: Windows 2008 Server, Microsoft SQL Server 2008, Captiva 7, Apache TomEE 1.6, Java1.7, and Eclipse for Java EE developers 4.3 (Kepler).Captiva was installed in an out-of-the-box configuration using SQL Server for its database. The followingCaptiva modules were installed: EMC Captiva DesignerEMC Captiva ScanPlusEMC Captiva DesktopEMC Captiva AdministratorEMC Captiva InputAccel Server EMC Captiva Image ProcessorEMC Captiva NuanceOCREMC Captiva Web Services OutputEMC Captiva Standard ExportI used Apache TomEE as my application server for web services hosting. TomEE is Apache Tomcatpre-configured to host web services and dynamic web applications. See the References section for linksto more information regarding TomEE .3 Web ServicesWhen designing web services to use with Captiva WSO, there are a few important things to keep inmind. First, Captiva WSO can only consume SOAP web services; RESTful web services are not supported.Second, you need to know that the Captiva WSO module can only consume anonymous web servicesthat do not require Basic or Windows authentication before accessing the service. This does not meanyou can’t send credentials as input parameters to web services and have the service logic doauthentication. I simulate this idea later in the tutorial. Anonymous access web services mean anyuser/process can request access to the web service. Think of it like allowing access to a public webpage. You have used anonymous web services and probably haven’t even realized it. For example,anonymous web services can be used to report weather conditions and look up ZIP codes. Many of theapps on your smartphone use these kinds of services to find nearby restaurants and movie listings.You can safeguard your web services to some degree by using network security techniques like IPfiltering, so only connections from the Captiva WSO server are accepted by the web services server. Seethe References section for more information regarding anonymous web services, and secureconnections using SSL. By default, TomEE hosts anonymous web services that do not requireauthentication.Lastly, the Captiva WSO module has no problem consuming web services that return primitive types:Boolean, String, int. However, it does not seem to consume collections well, which can present aproblem if your services return something more complex than a primitive type. For example, in myCaptIva 7 Web ServIces Output TutorIal2

ARMEDIA WHITEPAPERscenario, the getCaseInfo() web method1 returns an array of Strings containing a case’s ID,name, plaintiffs, and defendants. Returning these Strings as a List String (which is a validJAX-WS type), results in the WSO module’s inability to even map the result to IA values. My solution tothis limitation is to wrap all web methods that return a complex type in a Plain Old Data class2.By having all of my web methods return an object, I can return multiple variable types to the CaptivaWSO module from a single web method. As noted above, the getCaseInfo() method returnsseveral Strings, one of which is a status message from the web service that can be mapped to an IAvalue. For example, if the method encounters an error and can’t return the case info, instead of“silently failing”, it returns a message that is mapped to an IA value that can be discovered by the scanoperator or the Captiva administrator.The following sections discuss the web services I built for this tutorial to simulate interaction withexternal systems. They all return an object as a result. The importFileToCMS() method evensimulates sending the scanned documents to a case management system using MTOM (MessageTransmission Optimization Mechanism).3.1 Web Service DesignTable 1 defines the web method interfaces designed to meet the requirements of the scenario.Table 1IncomingCaseDocs Web Services DefinitionsWeb MethodgetCaseInfoInput ArgumentsString caseIdReturn ValuesWSOCaseInfoResultvalidateCaseIdString StringStringString