Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

if_http_client->request->set_cdata - Result Double quotes around entire body

DarcyMorse
Participant
0 Kudos

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"}"

 

11 REPLIES 11

Sandra_Rossi
Active Contributor
0 Kudos

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.

0 Kudos

the result I am getting is 

"{keyfield: "NeverGonnaGiveYouUp"}"

  I need it to look like:

{keyfield: "NeverGonnaGiveYouUp"}

 

0 Kudos

DarcyMorse_0-1712575666808.png

 

0 Kudos

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:

Sandra_Rossi_0-1712579808128.png

 

0 Kudos

It is the mock server screen where it shows the error.  

This is the error

DarcyMorse_0-1712580009070.png

This is one that was done directly testing Postman where it worked

DarcyMorse_1-1712580061101.png

 

0 Kudos

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.

0 Kudos

Note that you may see the exact outbound request in SAP by using the ICF client trace (transaction SICF).

0 Kudos

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.

0 Kudos

Transaction code SICF. Search ICF client recording in the forum rather than trace.

e.g. ICF recording - a possibility for analysing - SAP Community

0 Kudos

I'll give that a try and update today.  Thanks!