Forum Stats

  • 3,837,746 Users
  • 2,262,292 Discussions
  • 7,900,378 Comments

Discussions

Q: Unable to change the email attachment name on UMS Adapter BPEL 12c Email SendNotification operati

Hari Selva
Hari Selva Member Posts: 282 Blue Ribbon
edited Oct 14, 2018 6:02PM in SOA Suite Discusssions

Hi Experts,

I have been trying to change the email attachment name while I send an email through UMS Adapter on Oracle SOA BPEL 12c.

I tried following properties one at a time. None of them seem to be working . Please advise.

                 <bpelx:toProperty name="jca.ums.msg.content-type">"text/plain; charset=UTF-8; name=filename1.txt;"</bpelx:toProperty>

                <bpelx:toProperty name="jca.ums.msg.content-disposition">'attachment; filename="filename2.txt";'</bpelx:toProperty>

                <bpelx:toProperty name="jca.ums.Content-Disposition">'attachment; name="filename3.txt";'</bpelx:toProperty>

                <bpelx:toProperty name="jca.ums.Content-Type">'name="filename4.txt";'</bpelx:toProperty>

                <bpelx:toProperty name="jca.ums.part.content-type">"text/plain; charset=UTF-8; name=filename5.txt;"</bpelx:toProperty>

Thanks for your help in advance!!

Tagged:
Hari Selva

Best Answer

  • vladodias
    vladodias Member Posts: 2,283 Gold Trophy
    edited Oct 9, 2018 6:21PM Answer ✓

    Hi mate,

    It can be achieved by using function ora:readBinaryFromFileWithMimeHeaders... Please see example below...

    It is not a JCA property, it is something that you have to do at the "assign" in BPEL, when creating the "SendNotification" input variable...

          <copy bpelx:insertMissingToData="yes">

            <from>ora:readBinaryFromFileWithMimeHeaders(concat($directoryOutbound,'\',$outFilename),'one','text/csv',concat('attachment; filename="',$outFilename,'"'),'7bit','text file','en')</from>

            <to expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">$SendNotification_SendNotification_InputVariable.body/ns5:attachment[1]</to>

          </copy>

    Cheers,

    Vlad

    Hari Selva

Answers

  • vladodias
    vladodias Member Posts: 2,283 Gold Trophy
    edited Oct 9, 2018 6:21PM Answer ✓

    Hi mate,

    It can be achieved by using function ora:readBinaryFromFileWithMimeHeaders... Please see example below...

    It is not a JCA property, it is something that you have to do at the "assign" in BPEL, when creating the "SendNotification" input variable...

          <copy bpelx:insertMissingToData="yes">

            <from>ora:readBinaryFromFileWithMimeHeaders(concat($directoryOutbound,'\',$outFilename),'one','text/csv',concat('attachment; filename="',$outFilename,'"'),'7bit','text file','en')</from>

            <to expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">$SendNotification_SendNotification_InputVariable.body/ns5:attachment[1]</to>

          </copy>

    Cheers,

    Vlad

    Hari Selva
  • Hari Selva
    Hari Selva Member Posts: 282 Blue Ribbon
    edited Oct 10, 2018 11:04AM

    Thanks Vlad. Its working as expected now.

  • Hari Selva
    Hari Selva Member Posts: 282 Blue Ribbon
    edited Oct 12, 2018 9:51AM

    Hi Vlad,

    I am seeing one issue on the output CSV format. Please advise.

    Input :

    160708046131

    160709036169

    Output :

    pastedImage_2.png

    Here is the expression I used in BPEL:

    <copy>                         <from>ora:readBinaryFromFileWithMimeHeaders(concat($attachmentPath,'/',$attachmentFileName),'one','text/csv',concat('attachment; filename="', $attachmentFileName,'"'),'7bit', $attachmentFileName,'en')</from>

    <to expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">$Invoke_SendEmail_SendNotification_InputVariable.body/ns5:attachment[1]

    </to>

    </copy>

    Thanks

  • vladodias
    vladodias Member Posts: 2,283 Gold Trophy
    edited Oct 14, 2018 6:02PM

    Hi mate,

    If you open the file in Excel it will show like that, but the data in the file should be correct - try and open it using notepad++ or similar.

    You can either format the column in excel to show a big number or do some trick in the CSV so Excel will think it is a text field when opening the file.

    See the answer to this question in Stack Overflow...

    https://stackoverflow.com/questions/165042/stop-excel-from-automatically-converting-certain-text-values-to-dates

    Cheers,

    Vlad

  • User_Z7UMW
    User_Z7UMW Posts: 1 Employee

    Dear Sir, i have copy pasted the above code in assign activity, created 2 variables. One for outfilename and other one for directoryOutbound

    Created another assign before the actual assign which calls the ums And mapped href element(iam reading a file as an attachement) to directoryOutbound and hardcoded a filename(without .csv extension)

    but still i am getting the xpath incorrect error when testing in em console


    Please help and let me know what needs to be done/mapped to directoryOutbound and outFilename in the expression you suggested


    Thanks in advance