Table of Contents

Search

  1. Preface
  2. Part 1: Using Process Developer
  3. Part 2: Creating and Modifying Processes
  4. Part 3: Functions, Events, Errors, and Correlation
  5. Part 4: Testing and Deployment
  6. Part 5: Process Central and Process Server (On-Premises)

Process Developer

Process Developer

Email Service

Email Service

Process Server supports an email service. This means you can create a process that sends email messages to a list of recipients via an invoke activity. Many types of processes can benefit from an email delivery activity, including use an Alert Service.
Any BPEL process that implements email-based activities imports the WSDL provided with the Process
Server. The name of the WSDL is
email.wsdl
, and in the Participants view wizards, it is a System Service named
send email
. The WSDL contains a send operation that can be used in an invoke activity as follows:
<invoke inputVariable="emailMessage" operation="send" outputVariable="resultMessage" partnerLink="emailProvider"/>
To create a BPEL process that sends an email:
  1. In the Project Explorer, create a new orchestration project.
  2. Select
    File > New > BPEL Process
    .
  3. Name the process and click Finish.
  4. In the Participants view, create a new Partner Service Provider.
  5. Select System Services.
  6. Select
    Email
    .
  7. From Participants view, drag the
    send
    operation to the canvas to create an invoke activity. This activity sends the email message to people in your identity service enabled on the Process Server.
  8. Add additional programming logic. For example:
    1. Add a receive activity that receives the input to be associated with the email.
    2. Use the input tab of the invoke to assign data to the variable. See the examples below.
  9. Use the send operation's fault message to catch communication errors with your email service.
Example to initialize the emailMessage variable
:
  1. In the
    Input
    tab of the invoke, select XPaths as the Assignment Type.
  2. Select
    Add
    .
  3. In the
    E/L
    panel, select Literal.
  4. In the From column, select the dialog button and generate literal contents. Process Developer automatically finds the correct schema for the selected single-part element-based variable and generates a literal template for you as shown:
    Generated Template
    <aem:emailMessage xmlns:aem="http://schemas.active-endpoints.com/email/2007/01/email.xsd"> <aem:from>string</aem:from> <aem:replyTo>string</aem:replyTo> <aem:to>string</aem:to> <aem:cc>string</aem:cc> <aem:bcc>string</aem:bcc> <aem:subject>string</aem:subject> <aem:body mimeType="string"></aem:body> </aem:emailMessage>
    To avoid errors, be sure to set the body mimeType to a valid type such as
    text/plain
    . See the example in Step 5.
  5. Use one of the following tips to populate the
    emailMessage
    elements with the appropriate strings:
    • Create XPaths expressions, one per element. For example, to populate the <aem:to> element, create an expression such as FROM
      $quoteRequest/quote:contact/quote:name()
      TO
      aem:to
      .
    • Create an expression with a
      doXslTransform
      function. This solution requires that you create an XSL file containing all the transformation details for the email elements. For example,
      doXslTransform ('monitorEmail.xsl', $handleAlertRequest)
    • Set the Assignment Type to XQuery. Then you can add {expressions} or strings directly to each
      emailMessage
      element.
Example
<ns:emailMessage xmlns:ns="http://schemas.active-endpoints.com/email/2007/01/email.xsd"> <ns:from>Dave Verd &lt; DVerd@mycompany.com &gt;</ns:from> <ns:replyTo>sender@mycompany.org</ns:replyTo> <ns:to>{$quoteRequest/quote:contact/quote:name()}</ns:to> <ns:subject>{ $quoteRequest/quote:contact/quote:description}</ns:subject> <ns:body mimeType="plain/text">Message goes here.</ns:body> </ns:emailMessage>
Deploying a Process as an Email Service
You can deploy your process and make it available as a standard document literal service for the My Role partner link. Note that in the BPR, there are no WSDL or XSD. They are already deployed and available on the server.
If your email list contains an invalid address, the process logs an error. Check the Server Log in the Process Console to view email errors.

0 COMMENTS

We’d like to hear from you!