Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Extracting MIME attachment from email using OSB proxy service - email transport

user8760467Apr 11 2015 — edited Jun 24 2015

Hi,

I'm reading email messages(multipart/mixed) with attachments(pdf, zip, xml and csv) from MS Exchange Server 2010 using OSB proxy service email transport.I need to save the attachments to a local folder and process one of the attachments, an XML file. Below is the proxy service config.

Proxy Service Configuration (Test1/Proxy Services/GetEmail)

Actions: 

General Configuration

Service Type   Messaging Service

Message Type Configuration

Request Message Type 

Text     

Response Message Type 

None     

Transport Configuration

Protocol   email

Endpoint URI   mailfrom:mailserver.net:143

Get All Headers   No

Headers   

EMAIL Transport Configuration

Email Protocol   imap

Service Account   Test1/Proxy Services/email_acc

Managed Server   WLS_OSB1

Polling Interval   30

Read Limit   2

Pass By Reference   false

Pass Attachments By Reference   false

Post Read Action   move

IMAP Move Folder   processed

Attachments   archive

Download Directory   \\soasup-stor01\Vacancy\test\download

Archive Directory   \\soasup-stor01\Vacancy\test\archive

Error Directory   \\soasup-stor01\Vacancy\test\error

Request Encoding   iso-8859-1

Message Handling Configuration

Transaction Required   Disabled

Same Transaction For Response   Disabled

Content Streaming   Disabled

The polling is working fine. I've encoded the attachment variable to Base64 using a java callout.$attachments/ctx:attachment/ctx:body/ctx:binary-content has been passed as the byte[] input to the java method and the response is captured in $encodedAttachment. I've created a SaveFile BS(file type) with Request Message Type = Binary and Response Message Type = None. I've tried replacing the node ./ctx:binary-content in body variable with encodedAttachment in the request action of the Publish action to call the BS. One file is getting created with contents of the entire email, MIME headers and boundary parts along with the base64 encoded attachments.

<Contents from the created file>

MIME-Version: 1.0

Content-Type: multipart/related; boundary=MIME_Boundary;

  type="binary/octet-stream"

--MIME_Boundary

Content-Type: binary/octet-stream

Content-Transfer-Encoding: 8bit

Thanks &amp; Regards,

Samyajit Talukdar

: samyajit.talukdar@company.co.uk

-----Original Message-----

From: Samyajit Talukdar

Sent: 10 April 2015 14:11

To: MS MLRP Returns

Subject: FW: 22222

Thanks &amp; Regards,

Samyajit Talukdar

: samyajit.talukdar@company.co.uk

--MIME_Boundary

Content-Type: application/vnd.ms-excel; name="soainfra_v$session.xls"

Content-Transfer-Encoding: base64

Content-Description: soainfra_v$session.xls

Content-Disposition: attachment; filename="soainfra_v$session.xls";

  size=25618; creation-date="Thu, 27 Nov 2014 09:56:35 GMT";

  modification-date="Fri, 10 Apr 2015 09:28:23 GMT"

0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAA

EAAAJgAAAAEAAAD+////AAAAAAAAAAD/////////////////////////////////////////////

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAA=

--MIME_Boundary--

If I put a delete action in the request to Publish action for SaveFile BS to delete the $attachments, the created file contains only the email body part and the attachment boundary part is missing.

I've uploaded the OSB log with full trace enabled.

How can I pass the  encodedAttachment to the BS for saving the files?

Would iterating through the $aatachment/ctx:attachment give me the individual attachments for saving and processing, as there are separate binary-content refs in them?

Any help to achieve my requirement is highly appreciated.

Thanks in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2015
Added on Apr 11 2015
2 comments
1,324 views