Forum Stats

  • 3,768,655 Users
  • 2,252,827 Discussions
  • 7,874,669 Comments

Discussions

Not able to open PDF attachment Sent from SOA Email activity

994181
994181 Member Posts: 92

Hi,

I have used email activity to send PDF attachment.  I am able to send PDF attachment but when i open it from mail box i get below error message -

Adobe reader could not open attachment.pdf because  it is either not a supported file type or because the file has been damaged (for example, it was sent as email attachment and wasn't correctly decoded).

i have used below java code for encoding data before sending -

try            

{            

  String temp1 = (String)getVariableData("EncodedTemp");         

oracle.soa.common.util.Base64Encoder Encoder = new oracle.soa.common.util.Base64Encoder();             

  java.lang.String Temp = null;                              

  Temp = Encoder.encode(temp1);            

  setVariableData("EncodedTemp",Temp);          

}            

catch(Exception e)                               

{                         

  System.out.println(e);                        

}

and i am using below mapping in assign activity for mapping attachment type in email -

<copy>

            <from>string('application/pdf;')</from>

            <to>$varNotificationReq.EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:MimeType</to>

          </copy>

          <copy>

            <from>string('Attachment1.pdf')</from>

            <to>$varNotificationReq.EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:BodyPartName</to>

          </copy>

          <copy>

            <from>$EncodedTemp</from>

            <to>$varNotificationReq.EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:ContentBody</to>

          </copy>

Please let me know if i am missing anything here and help me to resolve this issue.

I tried to use one more mapping for contecntEncoding like below but it was giving selectionFailure exception.

<copy>

            <from>string('base64')</from>

            <to>$varNotificationReq.EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:ContentEncoding</to>

          </copy>

Thanks,

Answers

  • AnatoliAtanasov
    AnatoliAtanasov Member Posts: 883 Silver Trophy
    edited Apr 13, 2018 5:49AM

    Before doing the base64 encoding what is the value of your variable that holds the attachment / PDF file? It could already encoded?!

  • 994181
    994181 Member Posts: 92
    edited Apr 13, 2018 5:53AM

    Hi,

    Values are normal text values that i am taking as inputs from the user.

    <element name="process">

    <complexType>

    <sequence>

    <element name="To" type="string"/>

    <element name="PDFBodyText" type="string"/>

    </sequence>

    </complexType>

    </element>

    Thanks,

  • Lawson Pereira-Oracle
    Lawson Pereira-Oracle Member Posts: 14
    edited May 3, 2018 12:44AM

    Hi,

    Could you try setting 'application/pdf' in mimeType instead of 'application/pdf;'..

    Assigning the values as below worked for me in sending data through the task file and opening it from mail.

                        <copy bpelx:insertMissingToData="yes">

                              <from><literal>

                               <attachment xmlns="http://xmlns.oracle.com/bpel/workflow/task">

                                <name/>

                                <content/>

                                <mimeType/>

                                <attachmentScope/>

                              </attachment>

                            </literal></from>

                             <to>$initiateTaskInput.payload/task:task/task:attachment</to>

                          </copy>

                          <copy>

                           <from>"application/pdf"</from>

                           <to>$initiateTaskInput.payload/task:task/task:attachment[1]/task:mimeType</to>

                          </copy>

                          <copy>

                           <from>'TASK'</from>

                           <to>$initiateTaskInput.payload/task:task/task:attachment[1]/task:attachmentScope</to>

                          </copy>

                         <copy>

                           <from>'EmailAttachmentName'</from>

                           <to>$initiateTaskInput.payload/task:task/task:attachment[1]/task:name</to>

                         </copy>

                          <copy>

                            <from>$EmailContent</from>

                            <to>$initiateTaskInput.payload/task:task/task:attachment/task:content</to>

                          </copy>

    Also could you try adding the email content first without encoding it to check whether encoding actually causes the problem.

This discussion has been closed.