Friday, January 10, 2014

Initiating an OSB Service with Email

Initiating an OSB Service with Email

Email transport will help us to send/receive emails in OSB. Some cases we may required to initiate the external service based on the email in the user inbox.

The Proxy service polls the Mail Inbox for the new messages and invokes the Business service whenever there is a new message in the Inbox.The polling interval can be specified in the Proxy Service configuration.Here i will explain about invoking the service with the XML message received from the email body.

Invoking the service with the XML message received from the email body

Create a XSD message structure that will be used by Proxy Service to receive the message

<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
<element name="EmployeeRequest">
<element name="empNo" type="string"/>

Create a OSB project and create a Business service that needs to be invoked based on the Email content - Here i am invoking a sample BPEL service with the same XSD structure as input.

Create a Service Account with Static username/password of email user.

Create a Proxy Service with Service Type as Messaging Service

Select the Request Message Type as XML and Response Message Type as None

Select the protocol as email and specify the mail server-host and port in the Endpoint URI.

Configure the Service Account Created in the previous step, specify the polling interval as per requirement, select the Post Read Action as per the requirement and also specify the Download/Archive/Error directories accordingly.

Open the Proxy service Message Flow and add a Routing node to the Business Service created in the previous step.


Send a mail with the XML payload to the configured user, this will initiate the proxy service and intern call the corresponding service with the XML payload(in my case BPEL service)

No comments:

Post a Comment