Thursday, February 28, 2008

Notification Service

Notification Service:

1. Cofigure ns_emails.xml file

2. Create BPEL Project

3. Drag and Drop Email Activity

4. Click On EMail activity
To Address,Subject and Body can be passed Dynamically from input or they can be a static value( here subject and body are passed through client)

5. Compile and deploy
---------------------------------------------------------------------------------------
ns_emails.xml

<EmailAccounts xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService" EmailMimeCharset="" NotificationMode="ALL">
<EmailAccount>
<Name>Default</Name>
<GeneralSettings>
<FromName>abc abc</FromName>
<FromAddress>abc.abc@abc.com</FromAddress>
</GeneralSettings>
<OutgoingServerSettings>
<SMTPHost>smtphost.abc.com</SMTPHost>
<SMTPPort>25</SMTPPort>
</OutgoingServerSettings>
<IncomingServerSettings>
<Server>yourdomain.com</Server>
<Port>110</Port>
<Protocol>pop3</Protocol>
<UserName>accountId</UserName>
<Password ns0:encrypted="false" xmlns:ns0="http://xmlns.oracle.com/ias/pcbpel/NotificationService">password</Password>
<UseSSL>false</UseSSL>
<Folder>Inbox</Folder>
<PollingFrequency>1</PollingFrequency>
<PostReadOperation>
<MarkAsRead/>
</PostReadOperation>
</IncomingServerSettings>
</EmailAccount>
</EmailAccounts>

---------------------------------------------------------------------------------------
<?xml version = "1.0" encoding = "UTF-8" ?>
<process name="EmailTest"
targetNamespace="http://xmlns.oracle.com/EmailTest"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:ns1="http://xmlns.oracle.com/ias/pcbpel/NotificationService"
xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:client="http://xmlns.oracle.com/EmailTest"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PARTNERLINKS
List of services participating in this BPEL process
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<partnerLinks>
<!--
The 'client' role represents the requester of this service. It is
used for callback. The location and correlation information associated
with the client role are automatically set using WS-Addressing.
-->
<partnerLink name="client" partnerLinkType="client:EmailTest"
myRole="EmailTestProvider"/>
<partnerLink name="NotificationService"
partnerRole="NotificationServiceProvider"
partnerLinkType="ns1:NotificationServiceLink"/>
</partnerLinks>
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
VARIABLES
List of messages and XML documents used within this BPEL process
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<variables>
<!-- Reference to the message passed as input during initiation -->
<variable name="inputVariable"
messageType="client:EmailTestRequestMessage"/>
<!-- Reference to the message that will be returned to the requester-->
<variable name="outputVariable"
messageType="client:EmailTestResponseMessage"/>
</variables>
<!--
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ORCHESTRATION LOGIC
Set of activities coordinating the flow of messages across the
services integrated within this business process
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<sequence name="main">
<!-- Receive input from requestor. (Note: This maps to operation defined in EmailTest.wsdl) -->
<receive name="receiveInput" partnerLink="client"
portType="client:EmailTest" operation="process"
variable="inputVariable" createInstance="yes"/>
<!-- Generate reply to synchronous request -->
<scope name="Email_1">
<bpelx:annotation>
<bpelx:pattern patternName="bpelx:email"></bpelx:pattern>
</bpelx:annotation>
<variables>
<variable name="varNotificationReq"
messageType="ns1:EmailNotificationRequest"/>
<variable name="varNotificationResponse"
messageType="ns1:ArrayOfResponse"/>
<variable name="NotificationServiceFaultVariable"
messageType="ns1:NotificationServiceErrorMessage"/>
</variables>
<sequence name="Sequence_1">
<assign name="EmailParamsAssign">
<copy>
<from expression="string('Default')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:FromAccountName"/>
</copy>
<copy>
<from expression="string('')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Bcc"/>
</copy>
<copy>
<from expression="string('')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Cc"/>
</copy>
<copy>
<from expression="string('')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:ReplyToAddress"/>
</copy>
<copy>
<from expression="bpws:getVariableData('inputVariable','payload','/client:EmailTestProcessRequest/client:input')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Subject"/>
</copy>
<copy>
<from expression="string('xyz@xyz.com')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:To"/>
</copy>
<copy>
<from>
<Content xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
<MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">multipart/mixed</MimeType>
<ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
<MultiPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
<BodyPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">
<MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
<ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
<BodyPartName xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/>
</BodyPart>
</MultiPart>
</ContentBody>
</Content>
</from>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content"/>
</copy>
<copy>
<from expression="string('text/html; charset=UTF-8')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[1]/ns1:MimeType"/>
</copy>
<copy>
<from expression="string('NotificationAttachment1.html')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[1]/ns1:BodyPartName"/>
</copy>
<copy>
<from expression="bpws:getVariableData('inputVariable','payload','/client:EmailTestProcessRequest/client:input1')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[1]/ns1:ContentBody"/>
</copy>
</assign>
<invoke name="InvokeNotificationService"
partnerLink="NotificationService"
portType="ns1:NotificationService"
operation="sendEmailNotification"
inputVariable="varNotificationReq"
outputVariable="varNotificationResponse"/>
</sequence>
</scope>
<assign name="Assign_1">
<copy>
<from expression='"SUCCESS" '/>
<to variable="outputVariable" part="payload"
query="/client:EmailTestProcessResponse/client:result"/>
</copy>
</assign>
<reply name="replyOutput" partnerLink="client"
portType="client:EmailTest" operation="process"
variable="outputVariable"/>
</sequence>
</process>
-------------------------------------------------------------------------------------

Wednesday, February 27, 2008

My First BPEL Program

Hello world

<sequence name="main">
<!-- Receive input from requestor. (Note: This maps to operation defined in Helloworld.wsdl) -->
<receive name="receiveInput" createinstance="yes" variable="inputVariable" operation="process" porttype="client:Helloworld" partnerlink="client">
<!-- Generate reply to synchronous request -->
<assign name="Assign_1">
<copy>
<from expression="concat('Hello ',bpws:getVariableData('inputVariable','payload','/client:HelloworldProcessRequest/client:input'))">
<to variable="outputVariable" query="/client:HelloworldProcessResponse/client:result" part="payload">

</copy>
</assign>
<reply name="replyOutput" variable="outputVariable" operation="process" porttype="client:Helloworld" partnerlink="client">
</sequence>

Hi,

The goal of this blog is to share my knowledge and view about the Oracle products which i have been using;Oracle BPEL,Oracle Application Server,Oracle Identity Management,Database,etc...

~Muthu Ardhanary