cancel
Showing results for 
Search instead for 
Did you mean: 

Correlate XML and PDF file/mail

Former Member
0 Kudos

Following ugly requirement: PI receives XMLfiles and mails with PDF attachment. The XML contains the plain invoice data, the PDF is the signed invoice. PI sends both types as files to the customer. But the customer wants that files which belong together (see below) are sent within a time interval of max. 6 hours.

Problem is, the PDF is signed by an external partner which may need longer than those 6 hours. And the supplier is not able to hold back the corresposing XML files.

I fear the only way to solve it is by integration process (?)

The XML has a file reference tag, which corresponds to the mail attachment name, so in theory, we know what fits together. But the PDF is a binary message, so how to definine a correlation definition on it ? Do I need to map the PDF into an own XML structure, e.g. some header tag which contains the attachment name, and a base64 tag which contains the PDF ? But then I would later have to recreate the binary PDF, after the 2 messages are correlated. Is that possible in the process ? Can I map message 2 again when it leaves the process ?

We are on PI 7.0, soon 7.1

CSY

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

What about this:

you put both files in the same folder, the names of the files correlate, like file12345.xml - file12345.pdf

For the same folder, you put a sender file adapter which works with additional files. It starts processing, when both files are available.

Former Member
0 Kudos

Hi Stefan,

> It starts processing, when both files are available.

How do I configure that in the file cc ? I was not aware this is possible.

CSY

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>> How do I configure that in the file cc ? I was not aware this is possible

File adapter has option additional file...if you specify details here about your pdf .. then output message will be availabe with additional file as attachment.

Former Member
0 Kudos

I managed to configure the additional files option and created a message with the 2nd file as attachment. On the receiver side, my only options then are SOAP and mail, is that right ? Because only those types can handle attachments.

Is there a way to extract payload and attachment to 2 files (file receiver adapter) ? The target system cannot receive SOAP or mail. Only plain HTTP or file.

CSY

Edited by: Christian Sy on Jan 10, 2011 9:03 AM

stefan_grube
Active Contributor
0 Kudos

> The target system cannot receive SOAP or mail. Only plain HTTP or file.

You can use SOAP adapter and use parameter 'do not create SOAP envelope'. This will send the payload and attachment together has HTTP body.

In file adapter you could use payloadzipbean to create a single zip file which you unzip with OS command. The point point in this scenario is the file name, which is not easy to set.

What I have not tried, but might work: Send the message to two different receiver interfaces, in one of them use payloadswapbean to change attachment and main payload.

Former Member
0 Kudos

Thank you, the PayloadZipBean solves the requirement. The filename problem is a bit disturbing (because the name of the PDF should not be changed), but we have the original filename prefix in the XML mapping result, so I let the target system guys resolve this issue (instead of writing a new adapter module in PI) . They have the right XML and PDF in one ZIP together, so they can recreate the name of the original PDF.

I also tried the The SOAP without SOAP envelope, but the target system was not able to handle the attachment in that case.

CSY

Former Member
0 Kudos

Additional info: I just implemented the solution with 2 receiver interfaces. And write both messages with file reveiver channels, one of them uses the PayloadSwapBean. Works great. The solution is better than the zip option, because now I can even set the filename as I want:

1. for the XML file, I can just use the adapter specific attribute filename (= use the name of the original XMLfile)

2. for the PDF file, this does not work without additional change because it was read as attachment with the XML file, and so gives the name of the XML file, and the original PDF filename is not in the PI message anymore. But I just add a Java mapping in the routing of the PDF file, and set the needed filename value in dynamic configuration (read the value, remove .xml and append .pdf)

CSY

Answers (0)