on 01-04-2011 12:29 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
> 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.
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
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
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.