Attachment Specifications
The attachment specification syntax is the same for soap_request, web_service_call, silverlight_service_call, and silverlight_soap_request.
To send an attachment, use one of ATTACHMENTS_FORMAT_DIME or ATTACHMENTS_FORMAT_MIME, to specify the message format. ATTACHMENTS_FORMAT_DIME and ATTACHMENTS_FORMAT_MIME, have no attributes.
Specify the attachments with one or more ATTACHMENT_ADD arguments.
ATTACHMENT_ADD takes the following attributes:
Content source specifier: One of:
FileName: The attachment file name can be passed with an absolute path, or a path relative to the script directory.
ParamName: The name of a parameter that contains the content (data) of the attachment.
ContentType (Optional): The MIME type. If not specified, auto-detection of the type is attempted. If auto-detection is impossible, the ContentType is required.
ID (Optional): User-specified value to identify the attachment. If not specified, an ID is generated automatically.
For example:
ATTACHMENT_ADD, "FileName=file1.txt", "ContentType = text/plain", "ID=TXT1",
ATTACHMENT_ADD, "ParamName=paramMyAttachment", "ContentType = image/gif",
For receiving expected attachments, use one of ATTACHMENT_SAVE_BY_INDEX or ATTACHMENT_SAVE_ALL.
ATTACHMENT_SAVE_ALL takes the following attribute:
ParamNamePrefix: The base name of the parameters to save the attachments.
The suffix "_<index>"
is automatically added to the ParamNamePrefix, so that if ParamNamePrefix is myParam
, the call creates myParam_1
, myParam_2
, and so on.
Parameters for the content type and content ID are created automatically. The names of the parameters are <ParamNamePrefix>_<index>_ContentType and <ParamNamePrefix>_<index>_ContentID.
For example:
ATTACHMENT_SAVE_ALL, "ParamNamePrefix=myParam
"
In the above example, if two attachments are received, the following six parameters are created:
myParam_1
and myParam_2
, contain the data of the first and second attachment, respectively.
myParam_1_ContentType
and myParam_2_ContentType
contain the content type of the first and second attachment, respectively.
myParam_1_ContentID
and myParam_2_ContentID
contain the content ID of the first and second attachment, respectively.
ATTACHMENT_SAVE_BY_INDEX takes the following attributes:
Index: The 1-based index of the attachment to save from among the attachments received as a result of this call.
ParamName: The name of a parameter to which to save the attachment.
Parameters for the content type and content ID are created automatically. The names of the parameters are <ParamName>_ContentType and <ParamName>_ContentID.
For example, to save the first attachment:
ATTACHMENT_SAVE_BY_INDEX, "Index=1", "ParamName=myNameParam1"
Note: The number of attachments received is saved automatically in a parameter named ResponseAttachmentsCount.
The parameter is not specified in the web_service_call invocation.