cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.31 File Receiver - Variable substitution error

RafaelVieira
Active Participant
0 Kudos

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!!

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor
0 Kudos

Hi Rafael!

Don't know if it helps but try to use "ocrImageType" instead of "ocrimagetype" in variable substitution settings.

Regards, Evgeniy.

RafaelVieira
Active Participant
0 Kudos

Hi ,

Actually I did what you suggested in my first configuration. As it does not work, after reading couple of threads, I changed to lower case but unfortunately it also doesn't work.

Appreciate other inputs.

Tks!

former_member190293
Active Contributor
0 Kudos

Ok, try to add the following parameter:

contentType = text/xml;charset=UTF-8

Regards, Evgeniy.

RafaelVieira
Active Participant
0 Kudos

you mean, for the custom module?

Also, did you notice the File Receiver channel is posting an image (not a text/xml file)?

Can you please clarify?

Tks in advance for your suggestions.

former_member190293
Active Contributor
0 Kudos

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.

Answers (4)

Answers (4)

RafaelVieira
Active Participant
0 Kudos

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.

manoj_khavatkopp
Active Contributor
0 Kudos

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

former_member181985
Active Contributor
0 Kudos

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

RafaelVieira
Active Participant
0 Kudos

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!

former_member190293
Active Contributor
0 Kudos

Hi Rafael!

I guess you'll see it when you set 'File name' parameter in ASMA settings of receiver file channel.

Regards, Evgeniy.

RafaelVieira
Active Participant
0 Kudos

Evgeniy, I really appreciate your inputs on this.

Would you know the module name where I should set the DCXPATH/DCXPATHDEL?

Thanks again!

former_member190293
Active Contributor
0 Kudos

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.

former_member190293
Active Contributor
0 Kudos

If you want to know module name - after deploying module to your java server go to JNDI browser that can be found in NWA and use search by module name. In object properties you'll see the JNDI name which you should use when adding module to modules sequense.

Regards, Evgeniy.

0 Kudos

Hi,

You can't use Dynamic configuration with multi-mapping unless you use BPM.  However you can use variable substitution without Dynamic Configuration.

Please follow Praveen Gujjeti blog to achieve the same

RafaelVieira
Active Participant
0 Kudos

I'm using variable substitution. Please read the post.