Recently we have developed a HTTP to File scenario in PI. There was a requirement that the target file name will be same as the attachment file name. SAP has provided a java method to read the attachment data and content type, content ID, but there is no standard function to read the attachment file name.
We have referred the following blog to create the HTTP test client for our interface.
http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/08/12/http-test-tool-for-sap-pi-73
The new java HTTP adapter supports attachment, Multipart Documents, form submission. The adapter also provides options to send URL parameters and Header Parameters in the dynamic header of the PI message.
So to read the attachment file name, we have passed the attachment file name in the URL and then read the same from dynamic header. Below are the detail steps
<td width="30%"><input type="file" name="Attachment1" size="40" /></td>
Attachment1 is the parameter.
2. Modify the java script to include the attachment file name in the URL
So in the URL file name parameter will carry the actual attachment file name.
3.Make the change in the communication channel so that the file name will be populated in the dynamic header
4.Write the following line of java code to read that value from header and then set the same for file adapter so that the target file will be generated with that name
Test Result:
File name populated in header
Target file name generated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
12 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |