httpweb-servicestokensap-business-technology-platformsap-cpi

SAP CPI HTTP Post how to pass token


I need to send a POST in CPI to a s4hana service, and in order to pass it directly in JSON, not in xml, I want to use the simple HTTP adapter.

How can I get the token with a GET and use it with a POST afterwards?


Solution

  • do the GET, parse the XML and save the token as a variable in message header. Use the message header variable in your POST via filling the JSON with ${header.yourVariableName}

    see this: https://blogs.sap.com/2018/01/18/sap-cpi-clearing-the-headers-reset-header/ http://blog.whint.de/runtime-variables-cpi/