Skip to Content
avatar image
Former Member

XML to PDF conversion and create attachment in java mapping

Hello Experts,

I am trying to convert XML to PDF using XSLFO. The code works fine in local NWDS. I have uploaded the relevant jar files as well into PI (7.3 Version) and executed end to end scenario. The Scenario is from File to File. I am placing an XML File but the PDF File is is emptyin the target folder. So I have tried to create an attachment in SAP PI with below code.

     OutputAttachments outAttach = arg1.getOutputAttachments();

    Attachment attOut = outAttach.create("PDF_Output.pdf",outStream.toByteArray());

    outAttach.setAttachment(attOut);

I couldnt see any attachments in the moni/channel monitoring. The Mapping seem to work successfully without any failures.

Can you please help me out in creating attachments in SAP PI. I have already referred to below links

http://scn.sap.com/docs/DOC-26528

http://scn.sap.com/thread/1918880

http://scn.sap.com/thread/1953315

Regards,

N. Jayanth Kumar.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jan 21, 2013 at 08:54 AM

    Hi Experts,

    Just for an update, I would like to know if a PDF can be accessed as Payload to be placed in a target folder, if that is not possible, can we create as an attachment, use a payload swapbean to convert that into payload?

    Regards,

    N. Jayanth Kumar

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 21, 2013 at 09:15 AM

    Hello,

    In your operation mapping, did you check the read attachments option?

    Regards,

    Mark

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Mark,

      Yes I have checked the read attachments check box in the Operation Mapping. The scenario is we are not getting anything as attachments. We need to pick the XML Payload convert into PDF and then place it in another folder via FTP.

  • Jan 21, 2013 at 05:20 PM

    Can you attach the java program file? Since it is file to file scenario no need to go for attachments.

    Check my other blogs which will collectively help in such situations

    http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/07/08/can-we-test-binary-files-in-interfaceoperational-mapping

    http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/08/05/coding-java-mapping-points-to-ponder

    Regards,

    Praveen Gujjeti

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Praveen,

      I tried to execute with above code, but I am getting the below error in PI 7.3 Log Viewer.

      org.apache.fop.fo.ElementMappingRegistry findFOMaker

      WARNING: Unknown formatting object http://www.w3.org/1999/XSL/Format^root

      Can you please let me know what could be the cause of this issue?

      Regards,

      N. Jayanth Kumar.