NextGen Knowledge Center

Source Connectors - Sending Attachments

All of the Interoperability Suite source connectors (PIX/PDQ/XCA/XCPD/XDS.b) support sending attachments back with the SOAP response payload as a multipart response. To do this, you add a MultipartResponseSettings object into the response map (or channel map) with the key "responseMultipartSettings". For example:

var bodyHeaders = Maps.map(); bodyHeaders.put( "X-Custom-Body-Header" , Lists.list( "testing" )); bodyHeaders.put( "X-Custom-Body-Header2" , Lists.list( "testing2" )); var attachments = Lists.list();
// Create message attachment here in channel and use
                        that
var attachmentId = addAttachment( "testing" , "text/plain" , true ).getId(); var attachment1 = new ResponseMultipartAttachment(attachmentId); attachments.add(attachment1); // Set custom attachment content var attachment2 = new ResponseMultipartAttachment(); attachment2.setContent(FileUtil.decode( "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kFDRc2FT7HcIEAAAJ3SURBVFjD7ddPaBVXFAbwX16ikQ7V4EpQNLVNVLQIYhcB0UawIm8jWuhCiwq68h/tgOtBN3bxoC7cFBFCFw0uRANTMRtFKUXRtln4bxT8F2KkiJg2GktqXHgD4yN5ySsakeaszj33zPd9c3nvnm+YjP971JQX+pPmL/FRWF6Ikuxcf9K8At+gBVNwDW1oi5JsMDw3BZuxCZ+iFndwEoeiJOsbr4CfsS4sD+IpEhRGeP40NqABJ/DZKC96Ha1RkvWWb9SNcUIb0RTy+/gLn2BqqK3FD1iCpaHWjT58jPpQW4jDAe+1KIwhoAkPsBLzoiRbHIAv53o2BfKHaMXc0DcPZ3J96/uT5sZqBcC2KMnOR0k2BFGSdWM7hsr6dkRJdjbX9xBbMZjjWl2tgNvoHKH+B+7m1j1Iy5uiJLuHrlypuVoBl4bfqAwYbuVKl6MkezEKxp1c3lCtgJ4Ke3/n8t4KfU8r8Y0l4Nk475Pn//UiKrzrm3BSwKSAdy6gTrHUglXokMZXJ4S1WFqEr9BZhzX4LjeaT4WJBhcrwHTiz5D/UqHvLAZCfl6xBE/CqN9Vo1hagA/xuzT+d4JOoA7Lca8gjW/gCnYrluongHwqvkWXNO559SNM42dox2HF0vy3SD4XR/BT4CyzZMXSTBzFb/heGve9IeIPsBNfYIs07hnVEyqWarEHe3EcP4bjelEl6bAV24yvA85+afxPRVOaA5iFfcH9PMa5YMWuB3/4KEzLIUwLs35OMB3Lgo1rxDEckMY3x+WKRxAyPTjf9fgcM3K7QyPgDOBXdKBdGvdW9V0whphCMKoLMDv8fYd9Qy9u4po0fm4y3pd4CbNVrtWPazx9AAAAAElFTkSuQmCC" )); attachment2.addHeader( "Content-Type" , "image/png" ); attachments.add(attachment2); var responseMultipartSettings = new ResponseMultipartSettings(bodyHeaders, attachments); responseMap.put( 'responseMultipartSettings' , responseMultipartSettings);

The bodyHeaders option on the ResponseMultipartSettings object allows you to set custom headers that will be included on the SOAP payload part of the multipart response.

You can view additional information about these classes and their supported methods in the auto-completion menu in your script: