Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.11.10
|
http://localhost:8080/LeadtoolsServicesHost/OcrService.svc
[XML]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <bindings wsdlLocation="[PATH]\OcrService.svc.wsdl" xmlns="http://java.sun.com/xml/ns/jaxws"> <bindings node="wsdl:definitions/wsdl:types/xs:schema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <globalBindings xmlns="http://java.sun.com/xml/ns/jaxb"> <generateElementProperty xmlns="http://java.sun.com/xml/ns/jaxb/xjc">false</generateElementProperty> </globalBindings> </bindings> </bindings>Important Note: To get the [PATH], go to the project 'OCRImage' directory => 'xml-resources' => 'web-service-references' => 'OcrService.svc'=> 'wsdl' => 'localhost:8080' => 'LeadtoolsServicesHost' then copy the path of the file and replace [PATH] with it.
[Java]
import datacontracts.document.services.leadtools._2009._01.DocumentConvertOptions; import datacontracts.document.services.leadtools._2009._01.OcrDocumentFormatType; import datacontracts.document.services.leadtools._2009._01.OcrEngineType; import datacontracts.services.leadtools._2009._01.FileBinaryData; import servicecontracts.document.services.leadtools._2009._01.*;
[Java]
try { // Call Web Service Operation OcrService service = new OcrService(); IOcrService port = service.getBasicHttpBindingIOcrService(); // TODO initialize WS operation arguments here FileBinaryData sourceFile = new FileBinaryData(); sourceFile.setFileName("\\\\MyMachine\\SharedFolder\\OCR1.TIF"); FileBinaryData destData = new FileBinaryData(); destData.setFileName("\\\\MyMachine \\SharedFolder\\OCR1.txt"); DocumentConvertOptions convertOptions = new DocumentConvertOptions(); convertOptions.setFormat(OcrDocumentFormatType.ASCII_TEXT); convertOptions.setSource(sourceFile); convertOptions.setDestination(destData); RecognizeRequest parameters = new RecognizeRequest(); parameters.setConvertOptions(convertOptions); parameters.setEngineType(OcrEngineType.ADVANTAGE); port.recognize(parameters); } catch (Exception ex) { // TODO handle custom exceptions here }Notes: