Download file from IS to MWS

Hello,

I’m trying to show a file in MWS that I created on IS.

First, I use stringToBytes and than use base64Encode (print 1)

In MWS, on my button action, I set this java code (print 2)

Now, I getting this error when i execute (print 3)

Please, can anyone help me?

Thanks!


print 3.png

Hey, the content type appears wrong, spelling mistake… Please retry after correcting it.

Hello Raja,

I’ve fixed this mistake, but still the same error. Tried to add “charset=UTF-8” in content type, but not working.

Some examples used in content type:
String contentType = “application/csv”;
String contentType = “text/csv”;
String contentType = “text/plain”;

Thanks!

I think is something with WSDL, or not?. (print 4)

print4.png

Hello,

I found a solution, i set an output flow service as string instead of object, so my WSDL changes to string type.

Well, now I have a csv file when I click in a button, but all buttons form are disabled at this moment.

I added a script block with this code:

Event.observe( window, 'load', function() {  
    CAF.model('#{activePageBean.clientIds['buttonRelatorio']}').addActionListener(function(id) {Form.enableButtons(document.body);
    });  
});

But nothing happens, the buttons remain disabled.

Can anyone help me?

Thanks!

Hello Luis Henrique,

Please find the attached document. This document is helpful to your scenario.

Thanks & Regards,
Prem Sai.
HowToUploadDownloadFiles_MWS-IS.pdf (439 KB)

1 Like

Hello Prem Sai,

Thanks for reply.

This part it’s working, getting the file from IS and show for client in MWS.
But in this moment, all buttons in my form gets disabled and even with an action listener to enable the buttons, it’s doesn’t work.

This document shows only how to download from IS to MWS.

Thanks!

Hello Luis Henrique,

once please change the auto refresh property to true in your portlet.

Thanks & Regards,
Prem sai.

unsuccessfully. :frowning:

Changed form properties “Target” to _self

Working now! :lol:

Thanks!

Great Luis Henrique.

Thanks,
Prem

Hello Luis ,

What is the IS version you are using.

Previously I have designed some file upload/download in CAF and was working in 8.2…but now when I ma trying to use same design in 9.7 It is not working.
For upload file mapping (mapping is done using java custom code) to objectType for input is not working.

Thanks

Baharul,

Try setting your input flow service as object and java wrapper type properties to “byte

I’m using 9.5.1

Let me know if works!

Thanks!

Hi Luis,
After setting java wrapper type to byte,I am able to invoke webService and transfer encoded data file to IS.
But this is working only for text type document.For others document type getting errors of timeout(maximum time as well as encoding error in some scenario).
I have used “save pipeline to file” to file in IS flow service and what have noticed is that .if document selected is not text type then the size of the saved file is getting 2mb while selecting a file of 100KB.
I have used the below code sample for getting the file from fileItem and mapped to IS input.

getInsertFile2().getParameters().getInsertFile().getInputDoc().setUploadedFile(getFileItem().get());

Thanks
Baharul Islam

Hi Luis,
I have tried the below code in 9.8 but not working

After getting byte data from CAF in flow service below step I have used to insert data in oracle database…

pub.string:bytesToString
pub.string:base64Decode
pub.io:bytesToStream
Insert adapter to insert as CLOB Data

To get back the file in UI,flow service step written as

Select adapter to get the CLOB Data
pub.io:streamToBytes
pub.string:base64Encode
pub.string:stringToBytes

In this step I am able to insert the data in DB ,but at the time of displaying not getting any data in output.
Can any one please help to get the appropriate step need to follow to display the file in CAF UI.

Thanks
Baharul

Hello Baharul,

Try to use base64Encode output as your flow service output.

In your CAF page, you’ll need to add an action with a java code (print 2 in my first post).

Thanks.