Sending Attachments
Sending Attachments
When you use the InterSystems IRIS support for the SOAP with Attachments standard, you use the following process to send attachments:
-
Create the attachments. To create an attachment:
-
Use a stream object to represent the attachment data. The class you use depends on the exact interface you need to obtain the stream data. For example, you might use %Library.FileCharacterStreamOpens in a new tab to read the contents of a file into a stream.
-
Create a MIME part, which is an instance of %Net.MIMEPartOpens in a new tab.
-
For the MIME part:
-
Set the Body property equal to your stream object. Or set the Parts property, which must be a list of instances of %Net.MIMEPartOpens in a new tab.
-
Call the SetHeader() method to set the Content-Transfer-Encoding header of the MIME part. Be sure to set this appropriately for the type of data you are sending.
-
-
-
Add the attachments to the web service or web client. To add a given attachment, you insert the MIME part into the appropriate property as follows:
-
If you are sending an attachment from a web client, update the Attachments property of your web client.
-
If you are sending an attachment from a web service, update the ResponseAttachments property of the web service.
Each of these properties is a list with the usual list interface (for example, SetAt(), Count(), and GetAt() methods).
-
-
Update the appropriate properties of the web client or the web service to describe the attachment contents:
-
ContentId
-
ContentLocation
-