PU L1 - Assignment 2 - Run the process


#82

@quentin_prev
You can see the events log on the page with the business processes list.

In order to update OCR, you need to install a new version of RPA Express.
Which version are you using?


#83

@ashapkina, I am currently using version 1.1.5


#84

@quentin_prev the OCR license for this version has expired. You need to update to version 2.0 to be able to use it. You should be able to use the link that was sent to you when you registered for RPA Express.


#85

When followed every step as provided in this solution by you, my business process is throwing errors :slight_smile:

05.30.2018 09:47:14
ERROR
105193
Step name ‘Task - looking for the document at the OCR cache - BP OCR’ has failed. Reason: ‘Host name may not be null’
05.30.2018 09:47:14
ERROR
105191
Step name ‘Task - looking for the document at the OCR cache - BP OCR’ has failed. Reason: ‘Host name may not be null’
05.30.2018 09:47:14
ERROR
105195
Step name ‘Task - looking for the document at the OCR cache - BP OCR’ has failed. Reason: ‘Host name may not be null’

What might be the issue here?


#86

Unable to Create Process via - Import (ing ZIP file).

Error : Input file cannot be parsed:invalid format or not CSV file.

Please check snapshot for details.


#87

Hi, Manish! Please write the version of RPA Express you are working with.


#88

Hi,

I have followed the instructions a few times now and come to a halt when I run the process. The following message keeps coming up on every line item in the file.

I’ve also tried to manually access the link where the invoices are and was successful in opening. Is it perhaps something that I’m doing wrong?

2018-06-07 09:50:01 ERROR 64 Step name ‘Transform invoice image to HTML page (OCR)’ has failed. Reason: ‘IO error during HTTP execution for URL: https://s3.amazonaws.com/wf-vr-training/trainings/invoices_scan/invoice1_scan.png

NOTE: I did however, pick up this message when I imported the BP.

The package was exported in WorkFusion version 8.4.2-RPAX r.924abccb. This environment has WorkFusion version 8.5.1 r.594e6623

Not sure if this is adding to my nightmare.

Thanks in advance for your guidance.


#89

Hi, Nico! Could You, please, provide screenshots of your BP, error message and programming code of the 1st bot.


#90

Hi Abrakovich,

Below is the error message.

BP

Code for the BOT

<?xml version="1.0" encoding="UTF-8"?>
<!--
     Input parameters:
         doc_uuid: Optional (can be empty): Document UUID
         image_link: URL to document
         custom_regions: Optional (can be empty): [{"left":0, "top":1000, "right":100000, "bottom": 100000}]
         format: txt, html
     Output:
         ocrMap: {contentUrl, content, htmlContent} - the last one will be empty if format is txt
-->
<function name="performOcr">
	<var-def name="ocrUrl">localhost:15580/api/v1/cloud/</var-def>

	<!-- for an unknown reason without var http-extended does not send the body -->
	<!--
	<var-def name="j">{"username":"workfusion","password":"workfusion"}</var-def>
	<var-def name="tokenJson">
		<http-extended url="localhost:15280/workfusion/api/login" method="POST" charset="UTF-8" content-type="application/json">
			<var name="j"/>
		</http-extended>
  </var-def>-->
<!--
  <var-def name="token">
      <json expression="$.token"><var name="tokenJson"/></json>
  </var-def>
  -->
  	<var-def name="document_uuid">
    	<var name="doc_uuid"/>
	</var-def>
	<case>
    	<if condition="${document_uuid.toString().length() == 0}">
        	<var-def name="document_uuid">
            	<template>${java.util.UUID.randomUUID().toString()}</template>
        	</var-def>
    	</if>
	</case>

	<var-def name="document_image_link">
		<var name="image_link"/>
	</var-def>
	<var-def name="customRegions">
        <var name="custom_regions"/>
	</var-def>

	<case>
    	<if condition="${customRegions.toString().length() == 0}">
        	<var-def name="customRegions">
            	[{"left":0, "top":0, "right":2000, "bottom":2000}]
        	</var-def>
    	</if>
	</case>

	<function name="checkForErrors">
		<var-def name="status">
			<xpath expression="//task/@status">
				<var name="response" />
			</xpath>
		</var-def>
		<script><![CDATA[
       		// "OCR Status: " + status                              
			positiveStatusList = ["Submitted","Queued","InProgress","Completed"]
			if (!positiveStatusList.any {it.equals(status.toString())}) {
				throw new RuntimeException("OCR task has error status. Details:\n" + response);
			}
		]]></script>
	</function>

	<var-def name="processResponse">	
	   	<http url="${ocrUrl}/processImage" method="post" multipart="true">
			<!--<http-header name="Authorization"><script return="'Bearer ' + token.get(0).wrappedObject.asText()"/></http-header>-->
			<http-param name="file" isfile="true"><http url="${document_image_link}"/></http-param>
	       	<http-param name="profile">documentConversion</http-param>
	       	<http-param name="exportFormat"><var name="format"/></http-param>
	       	<http-param name="language">English</http-param>
	       	<http-param name="engine">abbyy</http-param>
			<http-param name="customRegions"><template>${customRegions}</template></http-param>
			<http-param name="useOnlyCustomRegions">true</http-param>
	       	<http-param name="correctSkew">true</http-param>
	       	<http-param name="xml:writeRecognitionVariants">true</http-param>
	       	<http-param name="correctOrientation">true</http-param>
		</http>
	</var-def>

	<call name="checkForErrors">
	   <call-param name="response">
	      <template>${processResponse}</template>
	   </call-param>
	</call>
	
	<var-def name="taskId">
		<xpath expression="//response/task/@id">
			<template>${processResponse}</template>
		</xpath>
	</var-def>

	<var-def name="taskStatus">Unknown</var-def>

	<while condition="${!taskStatus.toString().equals('Completed')}" maxloops="300">
		<script>Thread.sleep(5000)</script>
		
		<var-def name="statusResponse">
			<http url="${ocrUrl}/getTaskStatus?taskId=${taskId}" method="get">
				<!--<http-header name="Authorization"><script return="'Bearer ' + token.get(0).wrappedObject.asText()"/></http-header>-->
			</http>
	    </var-def>
	    
	    <call name="checkForErrors">
			<call-param name="response">
				<template>${statusResponse}</template>
			</call-param>
	    </call>
	    
	    <var-def name="taskStatus">
			<xpath expression="string(//response/task/@status)">
				<var name="statusResponse"/>
			</xpath>
	    </var-def>
	</while>

	<var-def name="resultUrl">
    	<xpath expression="string(//response/task/@resultUrl)">
        	<var name="statusResponse" />
    	</xpath>
	</var-def>

	<var-def name="resultContent">
		<http url="${resultUrl}" method="get">
			<!--<http-header name="Authorization"><script return="'Bearer ' + token.get(0).wrappedObject.asText()"/></http-header>-->
		</http>
	</var-def>
	
	<var-def name="resultHtml">
	    <case>
    		<if condition='${"html".equals(format.toString())}'>
				<html-to-xml>
	        		<script return="res"><![CDATA[
	            		// Removing BOM and DOCTYPE
	            		res = resultContent.toString().replaceAll("^\uFEFF", "")
	            		res = res.replaceAll("<!DOCTYPE[^>]*>", "")
	            		// "OCR results: " + res                              
	           		]]> </script>
				</html-to-xml>
    		</if>
    		<else>
    		</else>
		</case>
	</var-def>

    <return>
        <script return="ocrMap"><![CDATA[
           Map resultMap = new HashMap();
           resultMap.put("contentUrl", resultUrl.toString());
           resultMap.put("content", resultContent.toString()); // May give wrong results if PDF is requested but this case is not in our scenario
           resultMap.put("htmlContent", resultHtml.toString());
           ocrMap = resultMap;
        ]]></script>
    </return>
    
</function>	
<required name="s3_invoice_link"/>

<var-def name="ocrResultsPart">
    <call name="performOcr">
     	<call-param name="image_link"><var name="s3_invoice_link"/></call-param>
    	<call-param name="doc_uuid"></call-param>
        <call-param name="custom_regions"></call-param>
        <call-param name="format">html</call-param>
    </call>
</var-def>

<var-def name="partUrl">
	<template>${ocrResultsPart.getWrappedObject().get(0).getWrappedObject().get("contentUrl")}</template>
</var-def>

<var-def name="partContent">
	<template>${ocrResultsPart.getWrappedObject().get(0).getWrappedObject().get("content")}</template>
</var-def>

<var-def name="partContentHtml">
	<template>${ocrResultsPart.getWrappedObject().get(0).getWrappedObject().get("htmlContent")}</template>
</var-def>
<export include-original-data="true">
	<single-column name="content_url" value="${partUrl}"/>
	<single-column name="content" value="${partContent}"/>
	<single-column name="html_content" value="${partContentHtml}"/>
</export>

#91

Here is the problem with execution. Event log is attached to this post.


#92

Same issue happened to me :joy:


#93

@dakhmetov you need to update to a newer version of RPA express.


#94

Hi all,
I use the newest RPA Express version but I got an issue during running this exercise:

I changed //task/@status -> //response/task/@status but it also didn’t solve the issue.

Could someone assist with this issue?


#95

I have the same issue, I don’t know how to fix it. waiting the solution , thanks.


#96

Hi tedbihina, Did you have any idea? Does it still not work ?


#97

Hi

I suppose there is OCR step issue. I commented internal details of checkForErrors function and I got an issue with extracting task id.

Unfortunately, I can’t figure out how to fix it for now


#98

@nico_makgato and @josephbei have you had any luck with your errors? I have the exact same issue and have tried multiple browsers. Yet if I click the link on the data file the invoice opens.


#99

I tried many times, but same issue, sometimes it prompt "
Step name ‘Transform invoice image to HTML page (OCR)’ has failed. Reason: ‘Error parsing XPath expression (XPath = [//task/@status])!’"

no idea for the issue


#100

I got the same issue both latest Control Tower and Workfusion Studio (2.0.3)
[ERROR] Error parsing XPath expression (XPath = [//task/@status])!


#101

Does anybody know how to fix this issue:
Step name ‘Transform invoice image to HTML page (OCR)’ has failed. Reason: ‘Error parsing XPath expression (XPath = [//task/@status])!’

I get this error in the first step every time I try to run this process. Any help would be appreciated.