Create ISD job for a web service with RESTFUL JSON format

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

Moderators: chulett, rschirm

yijuanl
Participant
Posts: 23
Joined: Fri Jun 24, 2005 8:32 am

Post by yijuanl »

I have tried your design. I run the URL to test it, like http://servername:port/wisd-txhttp/Clarity/PersonPortfolio/getPortfolio

I get this message "/apps/appmgr/Datastage/devl/ODS/webservice/scripts/xml/Clarity_Portfolio.xml" in the web page.

Why do I not get the XML data in the web page?

Thank you!
-Jane
yl
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

I'm not surprised. I have never looked at the exact format of an xml REST response to an http GET (what your browser issues). There is likely some additional detail needed.
When I do this technique with a custom SOAP payload, I often use an http or tcp trace facility to capture a whole payload with a "normal" web service to see what it looks like. It's possible that your browser can do some high level tracing --- you'll have to do some research.

In the end, you need to build in DataStage whatever that whole http payload needs to look like.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

I dug up an old example that illustrates the concept....

Job is this:

ISDinput --- Transformer ----- ISDOutput

There is one column coming from ISDinput. Call it "payload". There is one column coming from the Transformer. Call it "output". The incoming payload column is 10 characters and in the Transformer it gets concatenated into a simple xml string (just for illustration purposes --- it could have been an xmlOutput Stage or other complex scenario). The derivation in the "output" column is "<mytag>":inputLink.payload:"</mytag>" resulting in the string <mytag>value from ISDinput</mytag> .

Deploy that using the text over http binding.

Then, using a tool that is able to just send a basic string to a URL (I used TCPMON to test --- you can download that at apache), I send something like (in the payload):

hello12345

The simple url is http://<server>:9080/wisd-txhttp/<app>/<service>/<operation>


...and the response via text/http is:

<mytag>hello12345</mytag>

So --- it becomes nothing more than a way to pass information over http. Your developers simply need to send in an http payload whatever values your ds job requires and they need to process whatever you return. It could be xml in whatever format you like, or it could be just comma delimited if you wanted .....whatever you put into the column "output" is going to be sent over the wire, untouched.

There is nothing fancy about it...the calling developers and you as the DS developer are doing everything yourselves. This way you can build whatever you need to, or whatever they are requesting, in XML with a hierarchy, and send it back. You can't do JSON today because in this release there is no stage for building JSON, unless you do it yourself with a Transformer or custom plugin.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

...it's worth noting that (if you want to get really fancy) ISD supports some very complex constructs here --- you can ask ISD to apply xslt to the output payload, and you can also do things like capture only the HTTP header information.

These are all the assignment settings that you will see for the input and output tabs on the Operation level when you deploy with the Text over HTTP binding.

In most cases, just processing the HTTP payload in-and-out is sufficient.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply