Tuesday, May 17, 2011

Sending an email from BPEL

Sending an email message from a BPEL Component is described in the Oracle BPEL guide [ref. Oracle® BPEL Process Manager Developer’s Guide 10g (10.1.3.1.0) B28981-03 January 2007]. But here are two different methods described: sending an email with a body and sending an email with two attachments. How to send an email with both a body and an attachment? The solution here is to use the second method (two attachments) and empty the BodyPartName of the first attachment, this attachment will then become the body of the email:
xmlns:notifsrvc="http://xmlns.oracle.com/ias/pcbpel/NotificationService"

<partnerLinks>
  <partnerLink name="NotificationService" partnerRole="NotificationServiceProvider" partnerLinkType="notifsrvc:NotificationServiceLink"/>
</partnerLinks>

... (population of varNotificationReq/EmailPayload)

<assign name="Remove_BodyPartName">
  <copy>
    <from expression="string('')"/>
    <to variable="varNotificationReq" part="EmailPayload" query="/EmailPayload/notifsrvc:Content/notifsrvc:ContentBody/notifsrvc:MultiPart/notifsrvc:BodyPart[1]/notifsrvc:BodyPartName"/>
  </copy>
</assign>

<invoke name="InvokeNotificationService" partnerLink="NotificationService" portType="notifsrvc:NotificationService" operation="sendEmailNotification" inputVariable="varNotificationReq" outputVariable="varNotificationResponse"/>

No comments:

Post a Comment