Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

Escape special characters for OData response

$
0
0

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)

 

Screen Shot 2014-03-19 at 11.25.50.png

 

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:

 

Screen Shot 2014-03-19 at 11.20.57.png

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

 

Screen Shot 2014-03-19 at 11.39.36.png

 

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

 

Thanks,

Steffen


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>