Optical Character Recognition (OCR) Processing in webMethods.io using Microsoft Azure Cognitive Services
Tags: azure, tutorial, integration, ocr
Published: 2021-08-06 13:32:05

---
title: Optical Character Recognition (OCR) Processing in webMethods.io using Microsoft Azure Cognitive Services
published: true
date: 2021-03-30 10:42:42 UTC
tags: #azure, #tutorial, #integration, #ocr
canonical_url: https://tech.forums.softwareag.com/t/optical-character-recognition-ocr-processing-in-webmethods-io-using-microsoft-azure-cognitive-services/240137/1
---

## Introduction

This tutorial describes how to integrate [webMethods.io](http://webmethods.io/) with Microsoft Cognitive Services. Here the cognitive service I am using is “Computer Vision” and the functionality I am using is Optical Character Recognition (OCR).

## Prerequisite

• Have access to [webMethods.io](http://webmethods.io/) cloud instance  
• Access to Microsoft Azure with valid subscription – [https://azure.microsoft.com](https://azure.microsoft.com/)

## What is Azure Cognitive Service?

Cognitive Services brings AI within reach of every developer—without requiring machine-learning expertise. All it takes is an API call to embed the ability to see, hear, speak, search, understand and accelerate decision-making into your apps. Enable developers of all skill levels to easily add AI capabilities to their apps. [Read More](https://azure.microsoft.com/en-in/services/cognitive-services)

Microsoft Azure’s Computer Vision is a cognitive service which gives you access to advanced algorithms that process images and return information based on the visual features you’re interested in. For example, Computer Vision can determine whether an image contains adult content, find specific brands or objects, or find human faces. [Read More](https://docs.microsoft.com/en-us/azure/cognitive-services/computer-vision/overview)

## Setup Microsoft Azure Cloud Vision Cognitive Service

- Login to [https://portal.azure.com/](https://portal.azure.com/)
- Search for Computer Vision Cognitive Service in marketplace  
 ![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/a/a3400d285b6c04188e18d16de2dc9f24d1042a4a.png)
- Enter all the required details and click Create to create the service for you. You can select the Free tier F0 for purpose of POC. You can select the paid tier for production applications.  

![image](https://aws1.discourse-cdn.com/techcommunity/optimized/2X/7/778fc78a2832404e3e8963b8dc18d5cc8c2965b0_2_543x499.png)

- To invoke the newly created service, you should have the access keys and end point details. You can get this by accessing Keys and Endpoint tab within the cognitive service  
 ![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/2/2a422ac119bac082597ff345bf16c43b76a27f9e.png)

**APIs supported by Computer Vision Cognitive Service**  
 ![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/c/c05b30087875494d4d7b674efdd722841f594d63.png)

**API swagger URL - [https://westus.dev.cognitive.microsoft.com/docs/services/5d98695995feb7853f67d6a6/export?DocumentFormat=Swagger&ApiName=Computer%20Vision%20API%20(v3.0-preview)](https://westus.dev.cognitive.microsoft.com/docs/services/5d98695995feb7853f67d6a6/export?DocumentFormat=Swagger&ApiName=Computer%20Vision%20API%20(v3.0-preview))**

## Testing the Cognitive Service OCR functionality from Postman

![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/9/949962f07bbc4b44eb1d86a4a6ee3fa5e3e2bf55.png)

**POST URL - https://<yourserviceregion>.api.cognitive.microsoft.com/vision/v3.0/ocr**

**Content-Type : application/json**

**Ocp-Apim-Subscription-Key : <your cognitive service key>**

In the body, pass a Json value **{“url”:”<image URL>”}**  
 ![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/1/1df4c58fbc08bd272d62973d4163a5836eb453f1.png)

The response of this post call would be the text in the image passed

![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/d/d7e9b6836682d9b37642450eaee84e86293f7f6e.png)

## Developing [webMethods.io](http://webMethods.io) workflow to invoke the Cognitive Service

In [webMethods.io](http://webMethods.io), you can use Http Connector to create a Http Request to the cognitive service and receive the response and process further as required.

Sample workflow is as below, where I read all the text output of the cognitive service and write to file within the loops and finally return the complete content to the user to be displayed on browser.

![image](https://aws1.discourse-cdn.com/techcommunity/original/2X/2/22e066c16a005a04243363b74b7ef924de451d3e.png)

[Read full topic](https://tech.forums.softwareag.com/t/optical-character-recognition-ocr-processing-in-webmethods-io-using-microsoft-azure-cognitive-services/240137/1)