2024 Apr 08 12:04 PM
I am trying to do a Web Service Call. I am using if_http_client-Request->set_cdata and append_cdata2.
The beginning and ending double quotes shouldn't be included. Any ideas of what needs to be changed to fix this?
Below is the code that I tried
wa_patch_body-keyfield = 'NeverGonnaGiveYouUp'.
CREATE OBJECT ref_json_serializer
EXPORTING
data = wa_patch_body.
ref_json_serializer->serialize( ).
g_body = ref_json_serializer->get_data( ).
* ref_http_client->request->set_cdata(
* exporting
* data = g_body ).
ref_http_client->request->append_cdata2(
exporting
data = g_body ).
Both result in the follow results in Postman:
"{keyfield: "NeverGonnaGiveYouUp"}"
2024 Apr 08 12:24 PM
I don't understand your question. The double quotes are required in JSON to represent texts:
{keyfield: "NeverGonnaGiveYouUp"}
What is your question?
It would be better to understand your question if you post a screenshot of Postman.
2024 Apr 08 12:27 PM
the result I am getting is
"{keyfield: "NeverGonnaGiveYouUp"}"
I need it to look like:
{keyfield: "NeverGonnaGiveYouUp"}
2024 Apr 08 12:27 PM
2024 Apr 08 1:36 PM - edited 2024 Apr 08 1:41 PM
I think it's added by Postman, the double quotes around don't really exist.
Which screen is it in Postman? I only know this kind of basic screen:
2024 Apr 08 1:41 PM
It is the mock server screen where it shows the error.
This is the error
This is one that was done directly testing Postman where it worked
2024 Apr 08 1:57 PM
I doubt that it's an ABAP problem, it never appends double quotes. The error message is about the method (PATCH, etc.) and the URL, not the double quotes shown in the body (which I think don't exist). I don't know enough Postman, but I recommend asking in a Postman forum.
2024 Apr 08 2:59 PM
2024 Apr 08 1:42 PM
Note that you may see the exact outbound request in SAP by using the ICF client trace (transaction SICF).
2024 Apr 08 1:58 PM
I am connecting thru an RFC connection and don't have an SICF connection set up. Does that have to be done? I didn't see anything in any of the posts I searched.
2024 Apr 08 4:23 PM
Transaction code SICF. Search ICF client recording in the forum rather than trace.
e.g. ICF recording - a possibility for analysing - SAP Community
2024 Apr 08 4:45 PM
I'll give that a try and update today. Thanks!