REST Response Contains Slash Appended to All Elements

Dedicated to DataStage and DataStage TX editions featuring IBM<sup>®</sup> Service-Oriented Architectures.

Moderators: chulett, rschirm

Post Reply
gsbrown
Premium Member
Premium Member
Posts: 147
Joined: Mon Sep 23, 2002 1:00 pm

REST Response Contains Slash Appended to All Elements

Post 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!
ray.wurlod
Participant
Posts: 54588
Joined: Wed Oct 23, 2002 10:52 pm

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm

Re: REST Response Contains Slash Appended to All Elements

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am

Post 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.
Choose a job you love, and you will never have to work a day in your life. - Confucius
gsbrown
Premium Member
Premium Member
Posts: 147
Joined: Mon Sep 23, 2002 1:00 pm

Post 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?
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am

Post by qt_ky »

Sounds like the folder stage might be causing it. Try a simpler test job: ISD Input --> Transformer --> ISD Output.
Choose a job you love, and you will never have to work a day in your life. - Confucius
gsbrown
Premium Member
Premium Member
Posts: 147
Joined: Mon Sep 23, 2002 1:00 pm

Post 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.
gsbrown
Premium Member
Premium Member
Posts: 147
Joined: Mon Sep 23, 2002 1:00 pm

Post 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.
gsbrown
Premium Member
Premium Member
Posts: 147
Joined: Mon Sep 23, 2002 1:00 pm

Post 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.
ray.wurlod
Participant
Posts: 54588
Joined: Wed Oct 23, 2002 10:52 pm

Post by ray.wurlod »

\" is an escaped double quote character. \r\n represents a DOS-style line terminator sequence (carriage return, newline).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am

Post 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!
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply