on 08-17-2016 9:29 PM
Hi All,
I'm working in an 1..N (using multi mapping w/o BPM) sync interface - File XML -> REST (Sync) -> File JPEG.
I get a reference from XML and have to extract corresponding images from REST and generate multiple image files in the same FTP.
I'm struggling to define a variable substitution to the final image files.
Here's my target (File JPEG) message structure after multi mapping:
<MT_image>
<ocrImageString>[Base64 code for image]</ocrImageString>
<ocrImageType>Type 1</ocrImageType>
</MT_image>
<MT_image>
<ocrImageString>[Base64 code for image]</ocrImageString>
<ocrImageType>Type 2</ocrImageType>
</MT_image>
....
Also, an additional info is that I'm using a custom module which does the Base64 decode as per guidance on
This is how my FTP receiver channel is set for the file naming:
It's not working and giving the error:
MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: Caught IOException while parsing XML payload: Invalid byte 1 of 1-byte UTF-8 sequence
I went through many other posts with no success on fixing this.
Can anyone please suggest what I might be doing wrong and how to overcome this as it's an urgent requirement?
Thanks in advance!!
Hi Rafael!
Don't know if it helps but try to use "ocrImageType" instead of "ocrimagetype" in variable substitution settings.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rafael!
I've just read about Base64DecodeConverter.
I guess that content type must be "image/jpeg" in your case.
And for getting file name from payload you need to use any custom adapter module prior to Base64DecodeConverter in order to save value to DC as file name and further use that falue in module's ASMA parameters.
Regards, Evgeniy.
I was not able to use another module prior to the decoding one, so I decided to remove the decoding module and post XML files with the desired dynamic names.
Then a 2nd interface gets each XML and converts it to an image.
Not the best solution but it's working.
Thanks for all the help!
Rafael.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rafel,
You can't use variable substitution with this module because once the module has executed the output is the decoded content in your case an image but variable substitution executes after modules which is expecting an xml for the xpath, hence it is failing.
So as suggested you need to have a custom module before this module by which means you can store the field name from xml to DC for the filename.
Br,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rafael,
>>1..N (using multi mapping w/o BPM) sync interface - File XML -> REST (Sync) -> File JPEG.
First of all, I am bit confused with your statement Multi-map in a synchronous scenario. As far as I know, multi-mapping is not possible in synchronous scenarios.
If I understand correctly,
Your scenario is without BPM: File (XML) --> REST (Sync) --> File (JPEGS)
1) you have an input file (source) with 'n' no. of records in it with reference information for images that should be pulled from a REST webservice (target system).
2) Assuming you are getting response message with 'n' no. of base64 image information from REST webservice for target file
3) now you want this response message to be split for each image record (with base64 decoding) into a separate image file in a file system?
Right??
Thanks,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I'm using Async/Sync bridge to make a Sync call to REST service.
The REST response I am mapping to the FTP with multi mapping using the decode custom module as detailed in my first post.
I just want to understand what else is needed in your proposed solution, besides deploying the EAR and setting up the parameters in module configuration. How am I going to see the file name dynamically changing?
Any sample you could share?
Many thanks!
Hi Rafael!
As far as I can see you gonna use adapter module DCMultiMapBean, developed by .
If so you need to deploy .EAR file attached to that blog to your PI Java server.
In your file receiver channel add deployed module before FormatConvertionBean and set parameters for it the way it's described in the blog.
Your XML message should contain structure with rows having "DCValue" element inside with attributes "DCNameSpace" and "DCTechnicalName". For each of these elements within given structure DC key will be created during module processing. You set XPath expression for that structure in "DCXPATH" parameter.
If you want to remove that structure from XML after DC keys creation use parameter "DCXPATHDEL" with XPath value according to structure root element. Thus, module will remove it from your payload after processing (but, I guess, you don't need that as you'll convert your XML to jpeg file in next turn).
Further, you use previously stored DC key for setting file name via ASMA parameters.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
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.