Attaching Files to Service Operations

This section provides an overview of attaching files to service operations and discusses how to:

  • Use the FTP Attachment utility.

  • Send attachment information with service operations.

  • Process attachment information that is included in service operations.

PeopleSoft Integration Broker provides an FTP Attachment Upload utility that enables you to upload attachments from any directory to your FTP server and then provide the location of the attachments in service operation PeopleCode. The attachments can be in any file format, such as text files, EDI files, word processing files, and so on.

As the operation is consumed, you can access these attachments using the attachment API. The recipient can get the necessary information about the attachment and can retrieve it using a URL or file location that you provide.

Note: The FTP Attachment Upload utility does not support uploading attachments from the database. To upload attachments from the database, manually retrieve and copy them to the FTP server.

Use the FTP Attachment Upload page in the Files Utilities component (IB_FILEUPLOAD) to upload files to your FTP server for attaching to service operations.

To access the FTP Attachment Upload page, select PeopleTools > Integration Broker > File Utilities > File Upload.

Image: FTP Attachment Upload page

This example illustrates the fields and controls on the FTP Attachment Upload page. You can find definitions for the fields and controls later on this page.

FTP Attachment Upload page

You work with the following page elements:

Field or Control

Definition

User

Indicates the user ID of the FTP server.

Password

Indicates the password to the FTP server.

FTP Host

Indicates the machine name of the FTP server.

Remote Directory

Indicates the directory path to the file to upload.

File Name Prepend

Enter text to prepend the file name to build the final file name to copy to the target directory.

Add Attachment

Click to upload the indicated file.

The following example shows sample PeopleCode for sending attachment information:

Local Message &MSG;
Local Rowset &Flight_Profile;
Local String &Attachment_id;

QE_FLIGHTDATA.QE_ACNUMBER.Value = QE_FLIGHTDATA.QE_ACNUMBER + 1;

&FLIGHT_PROFILE = GetLevel0();

&MSG = CreateMessage (Operation.ASYNC_RR);

&Attachment_id = &MSG.IBInfo.AddAttachment (c:\\temp\\myfile.txt);

&attachReturn = &MSG.IBInfo.SetAttachmentProperty(&Attachment_id, 
     %Attachment_Encoding, "UTF-8");

&attachReturn = &MSG.IBInfo.SetAttachmentProperty(&Attachment_id, 
     %Attachment_Base, "Standard");

&attachReturn = &MSG.IBInfo.SetAttachmentProperty(&Attachment_id, 
     %Attachment_Disposition, "Pending");

&attachReturn = &MSG.IBInfo.SetAttachmentProperty(&Attachment_id, 
     %Attachment_Language, "English");

&attachReturn = &MSG.IBInfo.SetAttachmentProperty(&Attachment_id, 
     %Attachment_Description, "Parts data");

&MSG.CopyRowset (&FLIGHT_PROFILE);

%IntBroker.Publish(&MSG);

The following example shows sample PeopleCode for processing an attachment from a notification:

import PS_PT:Integration:INotificationHandler;

class FLIGHTPROFILE implements PS_PT:Integration:INotificationHandler;
     method FLIGHTPROFILE();
     method OnNotify(&MSG As Message);

end-class;

/* Constructor */
method FLIGHTPROFILE
     %Super = create PS_PT:Integration:INotificationHandler();
end method;

method OnNotify
     /+ $MSG as Message +/
     /+ Extends/implements PS_PT:Integration:INotificationHandler.OnNotify +/

     Local Rowset &rs;
     Local integer &count;
     Local string &Attachment_ID &Results;

     &rs = &MSG.GetRowset();

     &count = &MSG.IBInfo.NumberOfAttachments;
     If &count > 0 Then

          &Attachment_ID = &MSG.IBInfo.GetAttachmentContentID(1);
          &Results = &MSG.IBInfo.GetAttachmentProperty(&Attachment_ID, 
            %Attachment_Encoding);
          &Results = &MSG.IBInfo.GetAttachmentProperty(&Attachment_ID,
            %Attachment_Type);
          &Results = &MSG.IBInfo.GetAttachmentProperty(&Attachment_ID, 
            %Attachment_URL);
          &Results = &MSG.IBInfo.GetAttachmentProperty(&Attachment_ID, 
            %Attachment_Base);
          &Results = &MSG.IBInfo.GetAttachmentProperty(&Attachment_ID, 
            %Attachment_Location);
          &Results = &MSG.IBInfo.GetAttachmentProperty(&Attachment_ID, 
            %Attachment_Disposition);
          &Results = &MSG.IBInfo.GetAttachmentProperty(&Attachment_ID,
             %Attachment_Description);

     End-If;
     /* Process data from message */

end-method;