Skip to Content
0
Jan 08, 2020 at 08:16 AM

CPI send attachment to Ariba

1160 Views

Hi

I am using HTTP adapter in CPI as CPI Ariba adapter has limitation.

I am using below cxml request to pass Incomplete or Image only invoices to Ariba.

flow is from SFTP->CPI->Ariba

ICS Provider attachment. FailedInvoice cid: 24116359.1330306017198@cxml.org 600

I used below code in groovy script to set header for attachment

e Message processData(Message message)

{ def body = message.getBody();

def dataHandler = new ByteArrayDataSource(body.getBytes(), 'application/pdf')

def attachment = new DefaultAttachment(dataHandler)

attachment.setHeader("Content-Type", "application/pdf");

attachment.setHeader("Content-ID", "<" + "InvoicePDF_24116359.1330306017198@cxml.org" + ">") attachment.setHeader("Content-Description", "Invoice PDF") attachment.setHeader("Content-length", "325597") attachment.setHeader("Content-Disposition", "attachment;filename=\"InvoicePDF_0001.pdf\"") message.addAttachmentObject('InvoicePDF_0001.pdf', attachment)

return message }

I am using MIME mutipart encoder with Subtype- related.

But still i am getting below error from Ariba

<Status code="400" text="Bad Request">Error:No attachments found!! Please contact support ...

.

Thanks

Harsha