Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Escape special characters for OData response

Hi all,

I'm facing a problem on HTTP response when some special characters are in my entity fields.

For example I've got a Edm.String field which has characters like ###, ", < (two number signs ## are ok, but three invoke an error)

When I set output format to xml via URI parameter $format=xml, I get following error:

<message xml:lang="en">In the context of Data Services an unknown internal server error occured</message>

Exception /IWCOR/CX_DS_INTERNAL_ERROR in class /IWCOR/CL_DS_EP_WRITER_OUTPUT method /IWCOR/IF_DS_EP_WRITER_OUTPUT~WRITE and Line 39

If I use JSON as output format, HTTP response code is 200!!, but payload just ends on the character which cannot be interpreted:

(ABAP)-JSON generator can handle double quotes much better than XML format:

How can I escape these output strings, without adding chars which will appear in response payload?

Thanks,

Steffen

Tags:
replied

Hi Steffen,

as you can see in your debugger screenshot, the field VERSID not only contains "bcoadm" but was filled with x0000 (hex 0) at the end, not spaces (in our system, too).

You have to output this as binary data or get rid of this.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question