Technical Notes |
|
This technical note explains how to use a Verastream demonstration component TransferData to send e-mail from a Verastream Scripting Language (VSL) application built with Process Integrator (PI). This document also addresses related common problems with the repository component definition and registration.
The TransferData component, provided in the Verastream Demonstration Repository, provides sample methods to send or receive data using HTTP, HTTPS (secure HTTP), FTP, SMTP, and POP3. These sample methods call underlying SERVICE, TABLE, and COMPONENT objects built into the Verastream interface.
The following files are located in the <Verastream>\demo\components directory:
The following procedure guides you through the steps to successfully use this server component.
Follow the steps below to insert the repository component into your application.
The repository component definition does not reflect updates to the shipping component. Follow the steps below to update the component definitions.
METHOD smtp_send ARGUMENTS { server FIELD FORMAT=string BUFNAME=server data FIELD FORMAT=string BUFNAME=data from FIELD FORMAT=string BUFNAME=from to FIELD FORMAT=string BUFNAME=to cc FIELD FORMAT=string BUFNAME=cc subject FIELD FORMAT=string BUFNAME=subject file FIELD FORMAT=string BUFNAME=file } |
Follow these steps to add the component method to your application.
| Field |
String value |
Required or optional |
| server |
Host name or IP address of your SMTP email server |
Required |
| data |
Email message body (sent as attachment in this implementation) |
|
| from |
Email address of sender |
Required |
| to |
Email address of recipient |
Required |
| cc |
Email address of carbon copy recipient |
Optional |
| subject |
Email message subject line |
Optional |
| file |
file name to use for the message text. default is 'att1' |
Optional |
Before proceeding, follow the steps below to verify that the component has been properly registered.
The Verastream Control Protocol (VCP) client and server need to use a matching namespace/address combination. By default, the TransferData component is registered to run in the local "/.Demo" namespace, but your application will run in the "" namespace. To get these to match, there are a number of approaches:
The VCP client and server must use a matching namespace/address combination. By default, the TransferData component is registered to run in the local "/.Demo" namespace and your application is run in the "" namespace. There are several approaches you can take to coordinate the namespace/address combinations.
Specify a different VCP_NAMESPACE when registering the server (in the Registration Options dialog or using +<variable>=<value> syntax on the command line).
-or-
Specify a different VCP_NAMESPACE when running the application (such as setting environment variable in sn.ini, or clicking Run > Namespace in the Process Integrator).
-or-
In the VSL editor, simply modify the ADDRESS in the component definition to match the registration:
COMPONENT TransferData INTERFACE=VCP ADDRESS=/.Demo/TransferData \ EXCEPTION=TransferData_DefaultException |
Note: Components using a namespace with a "/." prefix are only available locally and are not visible to other Verastream systems (reached over network broadcasts or specified in SNDAEMONPEERS).
In PI, click Run > Run Composite Application (or run your saved .pia file using Windows Explorer or the snpi command line). As with any application, it is strongly recommended that you enable debug logging. Debug logging can be enabled by clicking Run > Enable logfile in PI, or by using the MYDBG environment variable.
Use the information below to troubleshoot common problems with repository component definitions and registration.
This situation is indicated by a debug log line similar to the following:
ALERT: Field 'smtphost' does not exist >> |
Verify that all literal string values are enclosed in quote characters.
This situation is indicated by debug log lines similar to the following:
surpris - VCP Exception COMM_FAILURE minor=0, 1:COMPLETED_NOsurpris - COMPONENT 'TransferData' METHOD 'smtp_send': Cannot connect to server.ALERT: COMPONENT 'TransferData' METHOD 'smtp_send': Cannot connect to server. >>ALERT: Activation server: Request for address 'TransferData' failed: Unknown address >> |
This error refers to the Verastream VCP server component, not the SMTP e-mail server. The server component many not be registered (see Step 4Verify the Component Registration) or may be running at a different VCP namespace/address (see Step 5Specify the Component Namespace).
This situation is indicated by the following error:
Error converting network buffer to COMPONENT_DATA file. |
Add the "file" argument. For details, see Step 2Update the Component Definition.