cancel
Showing results for 
Search instead for 
Did you mean: 

Set in the header : "Content-Type: application/json"

FRLEN
Participant

Hi SAP Guru's

We have developed a workflow in SAP cloud workflow.

But our SAP backend System does not see the post request as a Json format. But as a XML format. To solve this we have to add in the header "Content-Type: application/json".

Do you guys know how this is done in SAP cloud Platform workflow?

Ps, Yes I did try to put ?$format=json

Accepted Solutions (1)

Accepted Solutions (1)

tobias_breyer
Contributor
0 Kudos

Hi,

CP Workflow currently does not support anything else than JSON in service tasks and we do set all the headers that are usually required for that, such as the "Content-Type: application/json" and the corresponding Accept header for the JSON-format response that we expect. So you do not need to set these headers and there is currently no possibility to overwrite them anyway.

In our logs, I do not see the $format=json for calls to your company server, so maybe the respective destination configuration change did not work out?

The error message that's coming back from your server is a rather generic ABAP XML error message, so maybe some logs on the ABAP side could tell you more on what it is struggling with.

Regards,

Tobias

FRLEN
Participant
0 Kudos

Dear tobias.breyer,

Thank you for your answer it did help me to move forward.

However, when I opened in "/n/IWFND/ERROR_LOG" to check this, I notice that accept in the header was empty.

Please see the screenshot I shared.

Kind Regards,
Nitin Antoon van Nieuwenhoven

tobias_breyer
Contributor

Hi Nitin,

The only case, when we do not set a JSON Accept header is when the response variable is NOT configured, i.e. when it seems you are not interested in a storing the result. It seems our HTTP client library in such cases sets the */* value that you see for the Accept header, which corresponds to "I accept anything you send me".

So maybe check the settings at the respective service tasks. Perhaps you did not configure a response context reference.

Best regards,

Tobias

FRLEN
Participant
0 Kudos

Hi tobias.breyer,

Thank you for your answer, I did put in the request variable & Response variable ${context} and now I do get the messages correctly in sap.

Kind Regards,
Nitin

Answers (0)