Hi Guys,
Here I am trying to explain how to send MIME (Multipurpose Internet Mail Extensions) emails from Oracle Service Bus 12c using UMS adapter having HTML email body Content and one or more Attachments.
I am assuming you are able to send simple emails from OSB, this requires some configurations. There are many blogs available on this topic. You can refer below blogs if Needed for basic setup:
1. https://blog.sysco.no/osb/messaging/UMS_Adapter_send_email_OSB_12C/
2. http://blog.sysco.no/osb/messaging/UMS_Adapter_send_html_content_email_OSB_12C/
The main purpose of this blog is to highlight usage of MIME or multipart/mixed emails which can have email body with attachments.
A Sample emails like below:
Replace Action:
<ref:message xmlns:opaq="http://xmlns.oracle.com/pcbpel/adapter/opaque/"
xmlns:ref="http://platform.integration.oracle/blocks/adapter/fw/metadata/ref_UMS_Notification">
<opaq:opaqueElement>{$varBase64}</opaq:opaqueElement>
</ref:message>
Business Service tracing Logs for debugging:
[2019-09-16T06:44:18.466-04:00] [osb_server1] [NOTIFICATION] [OSB-398202] [oracle.osb.resources.service.service] [tid: [ACTIVE].ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 76bae70b-d533-4893-adda-a0d78240273b-0005e2b6,1:40787] [APP: Service Bus Routing] [FlowId: 0000Motf5J0Fw025zrH7iW1TU^G70004HD] [[
[OSB Tracing] Outbound request was sent.
Service Ref = DheerajOSB/BusinessServices/ref_UMS_Notification
URI = jca://eis/ums/UMSAdapterOutbound
Request metadata =
<xml-fragment>
<tran:headers xsi:type="jca:JCARequestHeadersXML" xmlns:jca="http://www.bea.com/wli/sb/transports/jca" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<jca:SOAPAction>"SendNotification"</jca:SOAPAction>
<jca:Content-Type>text/xml; charset=utf-8</jca:Content-Type>
<jca:jca.ums.to>dheexxxxxxhra@gmail.com</jca:jca.ums.to>
<jca:jca.ums.subject>POC | OSBSample2 | NOTIFICATION | 2019-09-16T06:44:18.236-04:00</jca:jca.ums.subject>
<jca:jca.ums.msg.content-type>multipart/mixed;boundary="MIME_Boundary"</jca:jca.ums.msg.content-type>
<jca:jca.ums.msg.content-transfer-encoding>7bit</jca:jca.ums.msg.content-transfer-encoding>
<jca:jca.ums.part.content-transfer-encoding>7bit</jca:jca.ums.part.content-transfer-encoding>
</tran:headers>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
</xml-fragment>
Payload =
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ref:message xmlns:opaq="http://xmlns.oracle.com/pcbpel/adapter/opaque/" xmlns:ref="http://platform.integration.oracle/blocks/adapter/fw/metadata/ref_UMS_Notification"><opaq:opaqueElement>LS1NSU1FX0JvdW5kYXJ5IApDb250ZW50LXR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD0idXRmLTgi+Ci0tTUlNRV9Cb3VuZGFyeS0tIAoKCg==</opaq:opaqueElement></ref:message></soapenv:Body></soapenv:Envelope>
]]
[2019-09-16T06:44:18.506-04:00] [osb_server1] [NOTIFICATION] [OSB-398203] [oracle.osb.resources.service.service] [tid: [ACTIVE].ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 76bae70b-d533-4893-adda-a0d78240273b-0005e2b6,1:40787:14] [APP: Service Bus JCA Transport Provider] [FlowId: 0000Motf5J0Fw025zrH7iW1TU^G70004HD] [[
[OSB Tracing] Outbound response was received.
Service Ref = DheerajOSB/BusinessServices/ref_UMS_Notification
URI = jca://eis/ums/UMSAdapterOutbound
Message ID = a008016.2736342f.5.16d25a4109a.N7a1b
Response metadata =
<xml-fragment>
<tran:headers xsi:type="jca:JCAResponseHeadersXML" xmlns:jca="http://www.bea.com/wli/sb/transports/jca" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
</xml-fragment>
Payload =
]]
Here I am trying to explain how to send MIME (Multipurpose Internet Mail Extensions) emails from Oracle Service Bus 12c using UMS adapter having HTML email body Content and one or more Attachments.
I am assuming you are able to send simple emails from OSB, this requires some configurations. There are many blogs available on this topic. You can refer below blogs if Needed for basic setup:
1. https://blog.sysco.no/osb/messaging/UMS_Adapter_send_email_OSB_12C/
2. http://blog.sysco.no/osb/messaging/UMS_Adapter_send_html_content_email_OSB_12C/
The main purpose of this blog is to highlight usage of MIME or multipart/mixed emails which can have email body with attachments.
A Sample emails like below:
STEPS to Achieve this in OSB:
This assumes, you have a working OSB project which is able to send emails. (You can Refer above blogs for this purpose)
Assuming you have transformed the message required for your scenario, which is available in below format before request reaches the Routing node in OSB Pipeline.
<tns:EmailPayload xmlns:tns="http://www.dheerajOSB.com">
<tns:To/>
<tns:Subject>POC| POC| NOTIFICATION | 2019-09-14T06:14:35.266-04:00</tns:Subject>
<MailBody>
<html>
<body>
<table border="1" bordercolor="grey">
<tr>
<td colspan="2" style="background-color:#33339F;color:white">
<Center>
<b>NOTIFICATION DETAILS</b>
</Center>
</td>
</tr>
<tr>
<td style="background-color:#33339F;color:white">INTERFACE NAME</td>
<td/>
</tr>
<tr>
<td style="background-color:#33339F;color:white">ERROR DESCRIPTION</td>
<td>This is custom fault</td>
</tr>
</table>
</body>
</html>
</MailBody>
</tns:EmailPayload>
1. Below actions are required in OSB pipeline to achieve this. There may be other actions in your pipeline as well for purpose of audit/logging/invocations etc.
Transport Header Action:
Java Callout Action:
fn:concat('--MIME_Boundary
Content-type: text/html; charset="utf-8"
',fn-bea:serialize($varUMSPayload//*:MailBody/*),'
--MIME_Boundary
Content-type: text/html; charset="utf-8"
Content-Disposition: attachment; filename=payload.txt;
',fn-bea:serialize($body//*:XMLPayload),'
--MIME_Boundary--
' )
Replace Action:
<ref:message xmlns:opaq="http://xmlns.oracle.com/pcbpel/adapter/opaque/"
xmlns:ref="http://platform.integration.oracle/blocks/adapter/fw/metadata/ref_UMS_Notification">
<opaq:opaqueElement>{$varBase64}</opaq:opaqueElement>
</ref:message>
Business Service tracing Logs for debugging:
[2019-09-16T06:44:18.466-04:00] [osb_server1] [NOTIFICATION] [OSB-398202] [oracle.osb.resources.service.service] [tid: [ACTIVE].ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 76bae70b-d533-4893-adda-a0d78240273b-0005e2b6,1:40787] [APP: Service Bus Routing] [FlowId: 0000Motf5J0Fw025zrH7iW1TU^G70004HD] [[
[OSB Tracing] Outbound request was sent.
Service Ref = DheerajOSB/BusinessServices/ref_UMS_Notification
URI = jca://eis/ums/UMSAdapterOutbound
Request metadata =
<xml-fragment>
<tran:headers xsi:type="jca:JCARequestHeadersXML" xmlns:jca="http://www.bea.com/wli/sb/transports/jca" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<jca:SOAPAction>"SendNotification"</jca:SOAPAction>
<jca:Content-Type>text/xml; charset=utf-8</jca:Content-Type>
<jca:jca.ums.to>dheexxxxxxhra@gmail.com</jca:jca.ums.to>
<jca:jca.ums.subject>POC | OSBSample2 | NOTIFICATION | 2019-09-16T06:44:18.236-04:00</jca:jca.ums.subject>
<jca:jca.ums.msg.content-type>multipart/mixed;boundary="MIME_Boundary"</jca:jca.ums.msg.content-type>
<jca:jca.ums.msg.content-transfer-encoding>7bit</jca:jca.ums.msg.content-transfer-encoding>
<jca:jca.ums.part.content-transfer-encoding>7bit</jca:jca.ums.part.content-transfer-encoding>
</tran:headers>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
</xml-fragment>
Payload =
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ref:message xmlns:opaq="http://xmlns.oracle.com/pcbpel/adapter/opaque/" xmlns:ref="http://platform.integration.oracle/blocks/adapter/fw/metadata/ref_UMS_Notification"><opaq:opaqueElement>LS1NSU1FX0JvdW5kYXJ5IApDb250ZW50LXR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD0idXRmLTgi+Ci0tTUlNRV9Cb3VuZGFyeS0tIAoKCg==</opaq:opaqueElement></ref:message></soapenv:Body></soapenv:Envelope>
]]
[2019-09-16T06:44:18.506-04:00] [osb_server1] [NOTIFICATION] [OSB-398203] [oracle.osb.resources.service.service] [tid: [ACTIVE].ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 76bae70b-d533-4893-adda-a0d78240273b-0005e2b6,1:40787:14] [APP: Service Bus JCA Transport Provider] [FlowId: 0000Motf5J0Fw025zrH7iW1TU^G70004HD] [[
[OSB Tracing] Outbound response was received.
Service Ref = DheerajOSB/BusinessServices/ref_UMS_Notification
URI = jca://eis/ums/UMSAdapterOutbound
Message ID = a008016.2736342f.5.16d25a4109a.N7a1b
Response metadata =
<xml-fragment>
<tran:headers xsi:type="jca:JCAResponseHeadersXML" xmlns:jca="http://www.bea.com/wli/sb/transports/jca" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
</xml-fragment>
Payload =
]]
The main motive of the Big data modernization solutions is to spread the knowledge so that they can give more big data engineers to the world.
ReplyDeleteYour blog has piqued a lot of real interest. I can see why since you have done such a good job of making it interesting. I appreciate your efforts very much. hotmail entrar
ReplyDeleteI found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious... best email extractor software 2019
ReplyDeleteHi there! Nice material, do keep me posted when you post something like this again! I will visit this blog leaps and bounds for more quality posts like it. Thanks... bulk email marketing platform
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHow to pass the attachment name dynamically...??
ReplyDeleteIn these trying times, reaching customers is an even bigger challenge, with the shift to online advertising. When I enrolled in this course, I suddenly got the confidence to advertise my brand as a rising small business. Best Email Extractor
ReplyDeleteCan you please provide the RetriveMsg.jar here...
ReplyDelete