DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message
gsbrown



Group memberships:
Premium Members

Joined: 23 Sep 2002
Posts: 136
Location: USA
Points: 1743

Post Posted: Fri Apr 14, 2017 4:03 pm Reply with quote    Back to top    

DataStage® Release: 9x
Job Type: Parallel
OS: Unix
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:
{"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

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 53955
Location: Sydney, Australia
Points: 292754

Post Posted: Sun Apr 16, 2017 6:14 pm Reply with quote    Back to top    

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.

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42033
Location: Denver, CO
Points: 215738

Post Posted: Sun Apr 16, 2017 10:50 pm Reply with quote    Back to top    

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

<this space for rent>
Rate this response:  
Not yet rated
qt_ky



Group memberships:
Premium Members

Joined: 03 Aug 2011
Posts: 2551
Location: USA
Points: 18469

Post Posted: Mon Apr 17, 2017 7:30 am Reply with quote    Back to top    

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
Rate this response:  
Not yet rated
gsbrown



Group memberships:
Premium Members

Joined: 23 Sep 2002
Posts: 136
Location: USA
Points: 1743

Post Posted: Mon Apr 17, 2017 7:32 am Reply with quote    Back to top    

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?
Rate this response:  
Not yet rated
qt_ky



Group memberships:
Premium Members

Joined: 03 Aug 2011
Posts: 2551
Location: USA
Points: 18469

Post Posted: Mon Apr 17, 2017 7:37 am Reply with quote    Back to top    

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
Rate this response:  
Not yet rated
gsbrown



Group memberships:
Premium Members

Joined: 23 Sep 2002
Posts: 136
Location: USA
Points: 1743

Post Posted: Mon Apr 17, 2017 11:34 am Reply with quote    Back to top    

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.
Rate this response:  
Not yet rated
gsbrown



Group memberships:
Premium Members

Joined: 23 Sep 2002
Posts: 136
Location: USA
Points: 1743

Post Posted: Mon Apr 17, 2017 12:02 pm Reply with quote    Back to top    

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:
SRVE0255E: A WebGroup/Virtual Host to handle 172.16.100.6:9080 has not been defined.
Rate this response:  
Not yet rated
gsbrown



Group memberships:
Premium Members

Joined: 23 Sep 2002
Posts: 136
Location: USA
Points: 1743

Post Posted: Mon Apr 17, 2017 1:34 pm Reply with quote    Back to top    

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.
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 53955
Location: Sydney, Australia
Points: 292754

Post Posted: Mon Apr 17, 2017 5:45 pm Reply with quote    Back to top    

\" is an escaped double quote character. \r\n represents a DOS-style line terminator sequence (carriage return, newline).

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne
Rate this response:  
Not yet rated
qt_ky



Group memberships:
Premium Members

Joined: 03 Aug 2011
Posts: 2551
Location: USA
Points: 18469

Post Posted: Tue Apr 18, 2017 9:35 am Reply with quote    Back to top    

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
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours