|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (1)
View Page History{noformat}
h2. Pivot service
Petals BC Mail can be configured to provide an *pivot service provider* deploying a service unit. With *pivot service provider* you are able to define it your own WSDL to better match your needs.
Using a pivot service is better than native or integration service because you will be more agile, you will be able to change the implementation of your pivot service (replacing Petals BC Mail) with impacts on your service consumers. It is not possible with native and integration services.
h3. Usage
{warning:title=warning} InOnly message exchange patterns are allowed.{warning}
The mail sent depends on:
* annotations that you have put in your WSDL. Annotations provides a way to get values of parameters to send mail from your incoming payload.
* and parameters available at SU descriptor level.
h3. Configuration
h4. WSDL annotations
Several WSDL annotations are available. They should be put in the binding section of your WSDL:
{code}
<wsdl:binding name="emailNotifyVacationBinding" type="notifyService:emailNotifyVacation"
xmlns:bcmail="http://petals.ow2.org/bc/mail/annotations/1.0" >
...
<wsdl:operation name="newVacationRequest">
<bcmail:subject>Your new vacation request #${/*[local-name()='newVacationRequest']/*[local-name()='vacationRequestId']} was submitted for validation</bcmail:subject>
<bcmail:body><![CDATA[
<p>
You have submitted a new vacation request for validation:
<ul>
<li>reference: #${/*[local-name()='newVacationRequest']/*[local-name()='vacationRequestId']},</li>
<li>first day: ${/*[local-name()='newVacationRequest']/*[local-name()='start-date']},</li>
<li>duration: ${/*[local-name()='newVacationRequest']/*[local-name()='day-number']} day(s),</li>
<li>reason: ${/*[local-name()='newVacationRequest']/*[local-name()='reason']}</li>
</ul>
</p>]]>
</bcmail:body>
<bcmail:to>//*[local-name()='newVacationRequest']/*[local-name()='recipient']/text()</bcmail:to>
<bcmail:header>
<bcmail:name>X-VacationRequestId</bcmail:name>
<bcmail:value>${/*[local-name()='newVacationRequest']/*[local-name()='vacationRequestId']}</bcmail:value>
</bcmail:header>
<bcmail:header>
<bcmail:name>X-VacationRequestStartDate</bcmail:name>
<bcmail:value>${substring-before(/*[local-name()='newVacationRequest']/*[local-name()='start-date'], 'T')}</bcmail:value>
</bcmail:header>
<bcmail:header>
<bcmail:name>X-VacationRequestDayNumber</bcmail:name>
<bcmail:value>${/*[local-name()='newVacationRequest']/*[local-name()='day-number']}</bcmail:value>
</bcmail:header>
<wsdl:input>...</wsdl:input>
</wsdl:operation>
</wsdl:binding>
{code}
All annotations are member of namespace '{{http://petals.ow2.org/bc/mail/annotations/1.0}}'. Annotations override content of the SU descripto. Available annotations are:
|| Name || Description || Required || Default value ||
| subject | Mail subject. To be able to put data extracted from the incoming message, you can use XPath expression placeholders as '${<xpath-expression>}' in the content of this annotation. | No | - |
| body | Mail body. To be able to put data extracted from the incoming message, you can use XPath expression placeholders as '${<xpath-expression>}' in the content of this annotation. | No | - |
| to | Recipient of the mail defined as a XPath expression. Only one recipient is accepted. | No | - |
| options | Use to set options on mail. Options are available as attributes:
* {{dsn-on-delay}}: Enable Delivery Status Notification (DSN) on delay,
* {{dsn-on-failure}}: Enable DSN on mail sent with failure,
* {{dsn-on-success}}: Enable DSN on mail sent succesfully,
* {{dsn-on-never}}: Disable DSN,
* {{dsn-content}}: Define the content of DSN: {{full}} (entire body) or {{headers}} (only headers). | No | - |
| header | Use to add headers in your mail. The header name is defined through the sub-tag '{{name}}', and its value through '{{value}}'. The value can contains XPath expression placeholders as '${<xpath-expression>}'. | No | - |
h4. Service Unit descriptor
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:mail="http://petals.ow2.org/components/mail/version-3.0"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-4.0"
xmlns:generatedNs="http://test">
<jbi:services binding-component="true">
<jbi:provides
interface-name="generatedNs:SendMail"
service-name="generatedNs:SendMailService"
endpoint-name="SendMailServiceEndpoint">
<!-- CDK specific elements -->
<petalsCDK:wsdl>sendMail.wsdl</petalsCDK:wsdl>
<!-- Component specific elements -->
<mail:scheme>smtp</mail:scheme>
<mail:host>smtp.host.com</mail:host>
<mail:port>25</mail:port>
<mail:user>user</mail:user>
<mail:password>password</mail:password>
<mail:from>from email address</mail:from>
<mail:reply>reply email address</mail:reply>
<mail:to>recipient address</mail:to>
<mail:subject>mail subject</mail:subject>
<mail:send-mode>content-and-attachments</mail:send-mode>
<mail:content-type>text/plain</mail:content-type>
</jbi:provides>
</jbi:services>
</jbi:jbi>
{code}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
|| Parameter || Description || Default || Required ||
| scheme | the connection protocol (smtp) | \- | Yes |
| username | the username used for authentication | \- | No |
| password | the password used for authentication. Can be null or empty | \- | No |
| host | the host used for connection | \- | Yes |
| port | the port used for connection | 25 | No |
| to | email address of the recipient | \- | Yes |
| from | email address of the sender | \- | Yes |
| reply | email address for the reply | \- | No |
| subject | the subject of the mail | petals-bc-mail | No |
| helohost | HELO host for SMTP | \- | No |
| send-mode | Send either the source, the attachments or both of the payload | content-and-attachments | No |
| content-type | The mail mime type | text/plain | no |
{table-plus}
h4. Service Unit content
The Service Unit has to contain the following elements, packaged in an archive :
* The META-INF/jbi.xml descriptor file, has described above,
* You own WSDL file describing the related service
{noformat}
su-mail.zip
+ META-INF
- jbi.xml
- service.wsdl
{noformat}
Petals BC Mail can be configured to provide an *pivot service provider* deploying a service unit. With *pivot service provider* you are able to define it your own WSDL to better match your needs.
Using a pivot service is better than native or integration service because you will be more agile, you will be able to change the implementation of your pivot service (replacing Petals BC Mail) with impacts on your service consumers. It is not possible with native and integration services.
h3. Usage
{warning:title=warning} InOnly message exchange patterns are allowed.{warning}
The mail sent depends on:
* annotations that you have put in your WSDL. Annotations provides a way to get values of parameters to send mail from your incoming payload.
* and parameters available at SU descriptor level.
h3. Configuration
h4. WSDL annotations
Several WSDL annotations are available. They should be put in the binding section of your WSDL:
{code}
<wsdl:binding name="emailNotifyVacationBinding" type="notifyService:emailNotifyVacation"
xmlns:bcmail="http://petals.ow2.org/bc/mail/annotations/1.0" >
...
<wsdl:operation name="newVacationRequest">
<bcmail:subject>Your new vacation request #${/*[local-name()='newVacationRequest']/*[local-name()='vacationRequestId']} was submitted for validation</bcmail:subject>
<bcmail:body><![CDATA[
<p>
You have submitted a new vacation request for validation:
<ul>
<li>reference: #${/*[local-name()='newVacationRequest']/*[local-name()='vacationRequestId']},</li>
<li>first day: ${/*[local-name()='newVacationRequest']/*[local-name()='start-date']},</li>
<li>duration: ${/*[local-name()='newVacationRequest']/*[local-name()='day-number']} day(s),</li>
<li>reason: ${/*[local-name()='newVacationRequest']/*[local-name()='reason']}</li>
</ul>
</p>]]>
</bcmail:body>
<bcmail:to>//*[local-name()='newVacationRequest']/*[local-name()='recipient']/text()</bcmail:to>
<bcmail:header>
<bcmail:name>X-VacationRequestId</bcmail:name>
<bcmail:value>${/*[local-name()='newVacationRequest']/*[local-name()='vacationRequestId']}</bcmail:value>
</bcmail:header>
<bcmail:header>
<bcmail:name>X-VacationRequestStartDate</bcmail:name>
<bcmail:value>${substring-before(/*[local-name()='newVacationRequest']/*[local-name()='start-date'], 'T')}</bcmail:value>
</bcmail:header>
<bcmail:header>
<bcmail:name>X-VacationRequestDayNumber</bcmail:name>
<bcmail:value>${/*[local-name()='newVacationRequest']/*[local-name()='day-number']}</bcmail:value>
</bcmail:header>
<wsdl:input>...</wsdl:input>
</wsdl:operation>
</wsdl:binding>
{code}
All annotations are member of namespace '{{http://petals.ow2.org/bc/mail/annotations/1.0}}'. Annotations override content of the SU descripto. Available annotations are:
|| Name || Description || Required || Default value ||
| subject | Mail subject. To be able to put data extracted from the incoming message, you can use XPath expression placeholders as '${<xpath-expression>}' in the content of this annotation. | No | - |
| body | Mail body. To be able to put data extracted from the incoming message, you can use XPath expression placeholders as '${<xpath-expression>}' in the content of this annotation. | No | - |
| to | Recipient of the mail defined as a XPath expression. Only one recipient is accepted. | No | - |
| options | Use to set options on mail. Options are available as attributes:
* {{dsn-on-delay}}: Enable Delivery Status Notification (DSN) on delay,
* {{dsn-on-failure}}: Enable DSN on mail sent with failure,
* {{dsn-on-success}}: Enable DSN on mail sent succesfully,
* {{dsn-on-never}}: Disable DSN,
* {{dsn-content}}: Define the content of DSN: {{full}} (entire body) or {{headers}} (only headers). | No | - |
| header | Use to add headers in your mail. The header name is defined through the sub-tag '{{name}}', and its value through '{{value}}'. The value can contains XPath expression placeholders as '${<xpath-expression>}'. | No | - |
h4. Service Unit descriptor
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:mail="http://petals.ow2.org/components/mail/version-3.0"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-4.0"
xmlns:generatedNs="http://test">
<jbi:services binding-component="true">
<jbi:provides
interface-name="generatedNs:SendMail"
service-name="generatedNs:SendMailService"
endpoint-name="SendMailServiceEndpoint">
<!-- CDK specific elements -->
<petalsCDK:wsdl>sendMail.wsdl</petalsCDK:wsdl>
<!-- Component specific elements -->
<mail:scheme>smtp</mail:scheme>
<mail:host>smtp.host.com</mail:host>
<mail:port>25</mail:port>
<mail:user>user</mail:user>
<mail:password>password</mail:password>
<mail:from>from email address</mail:from>
<mail:reply>reply email address</mail:reply>
<mail:to>recipient address</mail:to>
<mail:subject>mail subject</mail:subject>
<mail:send-mode>content-and-attachments</mail:send-mode>
<mail:content-type>text/plain</mail:content-type>
</jbi:provides>
</jbi:services>
</jbi:jbi>
{code}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
|| Parameter || Description || Default || Required ||
| scheme | the connection protocol (smtp) | \- | Yes |
| username | the username used for authentication | \- | No |
| password | the password used for authentication. Can be null or empty | \- | No |
| host | the host used for connection | \- | Yes |
| port | the port used for connection | 25 | No |
| to | email address of the recipient | \- | Yes |
| from | email address of the sender | \- | Yes |
| reply | email address for the reply | \- | No |
| subject | the subject of the mail | petals-bc-mail | No |
| helohost | HELO host for SMTP | \- | No |
| send-mode | Send either the source, the attachments or both of the payload | content-and-attachments | No |
| content-type | The mail mime type | text/plain | no |
{table-plus}
h4. Service Unit content
The Service Unit has to contain the following elements, packaged in an archive :
* The META-INF/jbi.xml descriptor file, has described above,
* You own WSDL file describing the related service
{noformat}
su-mail.zip
+ META-INF
- jbi.xml
- service.wsdl
{noformat}
h1. Invoking service on incoming email