Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dear community,

Did you ever faced the challenge of using a REST service with form-data instead of raw data?
This blog will describe how to deal with this requirement on your preferred cloud integration platform - SAP Cloud Platform Integration -.

The service


In my example, I'm using a service hosted on SAP Cloud Platform. This services is taking a CSV file as request form-data. Once the data is accepted by the service, the records are stored into a custom table. In order to upload your file, the service is handling the form-data (multipart).
Additional documentation about this content-type can be found here: https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4

Sample csv file


FIRSTNAME;LASTNAME;BIRTHDATE
John;Doe;19780405
Jane;Doe;19921015

Testing the service stand alone


It is always a good practice to test your service stand alone before actually implementing it in your middleware system.

Endpoint: SAP SCP Service


Cloud Platform Integration setup


One on one pass through


The idea of this scenario is to get a pass through integration. The payload sent towards CPI will be exactly the same as the one sent to SAP Cloud Platform ("The Service").



Some important remarks about this flow:

  • Allowed Headers

  • Sender connection

  • Receiver connection


Testing via postman:

Endpoint: SAP Cloud Platform Integration endpoint

Sender is multipart upload


The idea of this interface is to be able to send form-data towards CPI, and afterwards handle the data from the attachment (for example convert csv to xml) in your flow. The purpose of this interface is to return the data from the attachment as response to our call.



Some important remarks about this flow:

  • Allowed Headers

  • Sender connection

  • Mime Multipart Decoder


Testing via postman:

Endpoint: SAP Cloud Platform Integration endpoint

Receiver is multipart upload


In this iflow I will set my csv content via a content Modifier, create my body and send the payload as form-data towards "the service" on SAP Cloud Platform.



Some important remarks about this flow:

  • Content Modifier 1 : "SetContent"

  • Content Modifier 2 : "CreateFormData"
    Used to build the multipart
    Header:

    Body:

  • Receiver connection


As this is a timer based interface, I can't test it via Postman. However when the interface is running and you place your traces, you'll be able to see the response as well.



I hope this will help you handling multipart/form-data integrations in the future.
And they lived happily ever after...

Kind regards,
Pieterjan De Schrijver
Cloud integration consultant @ delaware

 
7 Comments
Labels in this area