Page 1 of 1

REST Response Contains Slash Appended to All Elements

Posted: Fri Apr 14, 2017 4:03 pm
by gsbrown
I'm new to REST binding and put together my first test.
The results data-wise I'm getting is fine, but I don't understand why it has the appended \r\n and extra slash characters all throughout the response. Is this normal or what controls that? I've tried both attaching the ISD_Output stage at the receiving end of the XML Stage directly and also tried dumping the JSON output to a sequential file and using the folder stage to ISD_Output. Both do this same behavior.

Code: Select all

{"result":"[ {\r\n    \"label\" : \"Clearance\",\r\n    \"path\" : \"/category/Clearance.do\",\r\n    \"Children\" : [ {\r\n        \"label\" : \"Bracelets\",\r\n ......
Any feedback on what causes this and if it can be tweaked somewhere that I'm missing? Thanks!

Posted: Sun Apr 16, 2017 6:14 pm
by ray.wurlod
The double quote characters are being "escaped" so that they are not meaningful to any shell processing the payload and will be interpreted as literal quote characters.

Re: REST Response Contains Slash Appended to All Elements

Posted: Sun Apr 16, 2017 10:50 pm
by chulett
Wasn't worried just about the escaped quotes...
gsbrown wrote:I don't understand why it has the appended \r\n and extra slash characters all throughout the response.

Posted: Mon Apr 17, 2017 7:30 am
by qt_ky
I do not think that is normal. I have a few REST & JSON ISD applications running with the ISD Output stage. When I test them via the URL with a web browser, I do not see any escaped characters in the results.

Posted: Mon Apr 17, 2017 7:32 am
by gsbrown
OK, the \ escaping each double quote makes sense. How do I stop it from doing that? Like I mentioned, when I'm testing "FolderStage --> Sequential File" I don't have that in my output, but "FolderStage --> RTI Output Stage" my SoapUI response contains the escape slashes and \r\n new line characters. I guess I don't know what's doing it the RTI Stage, WISD, or my SoapUI or Internet Explorer browser. Curious if anyone has experience encountering this?

Posted: Mon Apr 17, 2017 7:37 am
by qt_ky
Sounds like the folder stage might be causing it. Try a simpler test job: ISD Input --> Transformer --> ISD Output.

Posted: Mon Apr 17, 2017 11:34 am
by gsbrown
It's definitely something after the folder stage, I just don't know what. I tested with an ereplace() function after my folder stage to strip out \" and they're still there.

Posted: Mon Apr 17, 2017 12:02 pm
by gsbrown
qt_ky, curious to know are you using REST or REST 2.0?

I started with REST and wanted to see if REST 2.0 gives me this same issue, but instead I get an error with REST 2.0

Code: Select all

SRVE0255E: A WebGroup/Virtual Host to handle 172.16.100.6:9080 has not been defined.

Posted: Mon Apr 17, 2017 1:34 pm
by gsbrown
OK figured out a couple things and I believe have this resolved!

Decided to go with REST 2.0 instead of REST for the binding.
Fixed the error I was getting after realizing I need to change a piece of my URL path from "wisd-rest" to "wisd-rest2"

Within the Information Service Application setup at the Operations level, there's a tab "REST 2.0 Settings". There, I discovered a checkbox "Output pass through" basically telling the REST API to return the results "as-is". Sure enough, it doesn't insert the escape characters.

Posted: Mon Apr 17, 2017 5:45 pm
by ray.wurlod
\" is an escaped double quote character. \r\n represents a DOS-style line terminator sequence (carriage return, newline).

Posted: Tue Apr 18, 2017 9:35 am
by qt_ky
I'm on version 11.3.1.2 using REST 2.0. It is a bit cumbersome to have to manually piece together the URL. Glad you discovered the resolution!