cancel
Showing results for 
Search instead for 
Did you mean: 

pdf through rest receiver communication channel sap pi

former_member554184
Discoverer
0 Kudos

Hi All ,

I am working on Proxy to REST Receiver Channel . i am receiving a pdf and how to send the attachment to ECC System .

Regards ,

Giridhar

Accepted Solutions (0)

Answers (1)

Answers (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Giridhar,

I am assuming that you are getting the PDF as attachment with proxy message in PI. Then you need following code in UDF to read the attachment

      String Content = "";
      String AttachmentID ="";
          
      InputAttachments inputAttachments = container.getGlobalContainer().getInputAttachments();
      if(inputAttachments.areAttachmentsAvailable())
      {
          Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);
          Object[] arrayObj = CollectionIDs.toArray();
          int attachmentCount = arrayObj.length;
          for(int i =0;i<attachmentCount;i++)
          {
              AttachmentID =(String) arrayObj[i]; 
              Attachment attachments =inputAttachments.getAttachment(AttachmentID);
              String s = new String(attachments.getContent());
              Content = Content + s;
          }
          
      }
      return Content;<br>

After reading the attachment you need to again attach the same to receiver REST adapter.

Since version PO 7.50 and SP07 a new functionality is added to the REST adapter that allows sending and receiving MIME multipart messages (as defined in https://tools.ietf.org/html/rfc2046#section-5.1). In addition, it is mandatory to update your REST adapter metadata with the one from 7.50 SP07 before you proceed with this scenario with help from BASIS team.

Details of configuring REST receiver adapter can be seen here.

Make following changes in receiver REST adapter.

  • For REST receiver channel
    1. To enable attachment support, select "Support attachments" in the Data Format tab - this will serialize the XI message application main payload and attachments (if any) to a MIME multipart message and send it to the partner server.
    2. If the attachment support is enabled, you can specify the request multipart message MIME subtype from the "Request message multipart type" dropdown - supported options are:

Regards

Anupam