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 » Extract Attachment From MIME using ESQL

Post new topic  Reply to topic
 Extract Attachment From MIME using ESQL « View previous topic :: View next topic » 
Author Message
pandug
PostPosted: Mon Apr 14, 2014 4:16 am    Post subject: Extract Attachment From MIME using ESQL Reply with quote

Newbie

Joined: 18 Feb 2010
Posts: 4

I’m struggling to find a solution on my new requirement on MIME. Please find the message flow involved in my design.

Flow 1 :

EmailInputNode -> compute node -> SoapReqnode

I’m polling on mail server and reading the mails which contains the JPG images as attacments. I have to extract the images from MIME domain and create soap request to webservice. Eventually that webservice will write these images into file directory. This is my complete requirement. Till this point everything is working as expected but after that I’m not able to open the image.

I guess I’m doing something wrong in creating SOAP request with attachment extracted from MIME domain.

For your reference please check my ESQL. I have used BASE64ENCODE and DECODE functions as well to ensure xml has proper base64binary data.

I don’t understand how to make use of in esql InputRoot.MIME.Parts.Part[2].Data.BLOB.BLOB. Which is consists of binary security signature.

CALL CopyMessageHeaders();
DECLARE inputData CHARACTER;
DECLARE outRef,outRefEnv,outRefBody,outRef1 REFERENCE TO OutputRoot;
-- CREATE LASTCHILD OF outRef AS outRef DOMAIN 'XMLNSC';
CREATE LASTCHILD OF outRef AS outRefEnv NAMESPACE soapenv NAME 'Envelope';

SET outRefEnv.(XMLNSC.NamespaceDecl)xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/';
SET outRefEnv.(XMLNSC.NamespaceDecl)xmlns:ns24='http://www.bmi.com/Enterprise/Services/Core/Media/V1/';
CREATE LASTCHILD OF outRefEnv AS outRefBody NAMESPACE soapenv NAME 'Header';

CREATE LASTCHILD OF outRefEnv AS outRefBody NAMESPACE soapenv NAME 'Body';

CREATE LASTCHILD OF outRefBody AS outRef1 NAMESPACE ns24 NAME 'SaveMedia';
CREATE LASTCHILD OF outRef1 AS outRef1 NAME 'SaveMediaReq';

CREATE LASTCHILD OF outRef1 AS outRef1 NAME 'messageHeader';
SET outRef1.routingInfo.toSystem.systemName = 'MDM';
MOVE outRef1 PARENT;
CREATE LASTCHILD OF outRef1 AS outRef1 NAME 'mediaGeneric';
CREATE LASTCHILD OF outRef1 AS outRef1 NAME 'image';
SET outRef1.alternateIdentifier.systemName = 'FINANCIAL';
SET outRef1.alternateIdentifier.alternateId = InputRoot.EmailInputHeader.Subject;
SET outRef1.name.displayName = InputRoot.MIME.Parts.Part[2]."Content-Description";

IF InputRoot.EmailInputHeader.Size > 0 THEN
DECLARE encoded CHARACTER BASE64ENCODE(InputRoot.MIME.Parts.Part[1].Data.BLOB.BLOB);
DECLARE decoded BLOB BASE64DECODE(encoded);
--DECLARE attachmentAsChar CHARACTER CAST(InputRoot.MIME.Parts.Part[1].Data.BLOB.BLOB AS CHAR CCSID InputProperties.CodedCharSetId);
SET outRef1.bytes = decoded;
ELSE
THROW USER EXCEPTION VALUES('No attachments to the mail');
END IF;


Note : If I connect EmailInput node out terminal to FileOutputNode In terminal. Image is writing properly and able to open it.

I’m very thankful to you. If you can reply quickly.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Apr 14, 2014 4:30 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

you have an XML namespace declaration for ns24, but no ESQL namespace declaration for it:
Code:
 declare ns24 NAMESPACE 'http:....'
, yet you seem to be using it as an esql namespace declaration..., same for soapenv... Hope this is because you're just not showing the section of code where they've been declared...

FYI shouldn't the blob outref1.bytes be 64bitencoded ?? or at least be a hex representation of the data??
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Extract Attachment From MIME using ESQL
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.