How to use OCR web service in android application. How can we send request and get response?

試著忘記壹切 提交于 2020-01-03 05:41:08

问题


How can we use OCR web service in android application I have use this webservice. How can i pass data using soap base web service and get response back. How can i pass request for nested XML tags ?

http://www.ocrwebservice.com/services/OCRWebService.asmx?op=OCRWebServiceRecognize

Please help..


回答1:


Please check this library for Android: kSoap2.

Also, check this similar question, that offers a few other solutions: "How to call web service with Android"

Hope it helps!




回答2:


Actually i got the correct answer. For nested request i wrote the below code and it worked.

   SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

  // Add input values to SOAPObject object - request
        request.addProperty("user_name", "test");
        request.addProperty("license_code",
                "test");
 // Add property for nested tags        
        PropertyInfo pi = new PropertyInfo();

        pi.setName("OCRWSSetting");
        pi.setValue(new SoapObject(NAMESPACE, "OCRWSSettings")
        .addProperty("ocrLanguages", "ENGLISH")
        .addProperty("outputDocumentFormat", "TXT")
        .addProperty("convertToBW", false)
        .addProperty("getOCRText", true)
        .addProperty("createOutputDocument", false)
        .addProperty("multiPageDoc", false)
        .addProperty("ocrWords", false));

        request.addProperty(pi);

    // Add property for another nested tags 

        pi = new PropertyInfo();
        pi.setName("OCRWSInputImage");
        pi.setValue(new SoapObject(NAMESPACE, "OCRWSInputImage")
        .addProperty("fileName", getString(R.string.file_name))
        .addProperty("fileData",base64String)
        );

        request.addProperty(pi);


来源:https://stackoverflow.com/questions/4171352/how-to-use-ocr-web-service-in-android-application-how-can-we-send-request-and-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!