ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Attaching an Image

Post new topic  Reply to topic
 Attaching an Image « View previous topic :: View next topic » 
Author Message
madrox
PostPosted: Wed Oct 18, 2017 12:48 pm    Post subject: Attaching an Image Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 71

I am creating an application as a test to make a call to a free API available called OCR. OCR requires me to send a image file or a pdf and it converts it to txt, pdf or other text format.
So I have a HTTP Input node that I use to trigger the flow and a File Read node to get the file that I need to send in my request payload.
From reading a few threads on the forum I have made an assumption(maybe wrong on) that I should use MIME to parse the input message. When I do use a MIME parser the message tree does not populate anything for MIME. When I have used xml earlier I see the data in the message tree under XMLNSC, but I am unsure what should be done for PDF's and JPEG's.
I am sure I am doing something wrong could someone please suggest what I should be doing?
Thanks
Back to top
View user's profile Send private message
madrox
PostPosted: Tue Oct 24, 2017 12:41 pm    Post subject: Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 71

update:
I could not figure out how to send a file as an attachment in my request, the API documentation has an option in the Post Paramenter to send the file as base64image. So i read the file from my file input with blob as a input message parser, converted it to base 64 and built my request. But now i get a error after the HTTP request, "414 Request-URI Too Long". See my code below from the compute after the file read.

Code:
      DECLARE var1 CHARACTER BASE64ENCODE(InputRoot.BLOB.BLOB);
      SET OutputLocalEnvironment.Destination.HTTP.RequestURL = 'http://api.ocr.space/parse/image';
      SET OutputLocalEnvironment.Destination.HTTP.QueryString.apikey = 'apidummykey';
      SET OutputLocalEnvironment.Destination.HTTP.QueryString.language ='ENG';
      SET OutputLocalEnvironment.Destination.HTTP.QueryString.isOverlayRequired ='TRUE';
      SET OutputLocalEnvironment.Destination.HTTP.QueryString.base64Image=var1;


In my debug mode i see the local environment overrides but my response header has 414.

Code:
HTTPResponseHeader
   X-Original-HTTP-Status-Line:CHARACTER:HTTP/1.1 414 Request-URI Too Long
   X-Original-HTTP-Status-Code:INTEGER:414
   Content-Type:CHARACTER:text/html; charset=us-ascii
   Server:CHARACTER:Microsoft-HTTPAPI/2.0
   Date:CHARACTER:Tue, 24 Oct 2017 20:36:10 GMT
   Connection:CHARACTER:close
   Content-Length:CHARACTER:329


I am sure that there is something that i am missing or getting wrong. Any help will be appriciated!
Back to top
View user's profile Send private message
timber
PostPosted: Tue Oct 24, 2017 3:16 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Are you sending an image in the query string? Not in the message body?
Back to top
View user's profile Send private message
madrox
PostPosted: Tue Oct 24, 2017 4:46 pm    Post subject: Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 71

Well the API document says it is a post parameter.
https://ocr.space/ocrapi
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Oct 25, 2017 5:04 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

madrox wrote:
Well the API document says it is a post parameter.
https://ocr.space/ocrapi


I find it as odd as my worthy associate that anyone would want a JPG in a query string.

Also interesting is that that URL is on my company's blacklist as an untrustworthy site.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
madrox
PostPosted: Wed Oct 25, 2017 5:20 am    Post subject: Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 71

Hmm that's odd, I thought that it is a legit site, but this is just for a POC that I am building for myself.
Just to reconfirm post parameters are sent as a query string correct?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Attaching an Image
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.