How to reformat array returned by Web Service

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

Moderators: chulett, rschirm

Post Reply
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

How to reformat array returned by Web Service

Post by lstsaur »

I am trying to develop a server job using RTI's Job Control Web Service which exposes the DataStage Job Control API as a Web Service.

I can run my Java program to log into a specific DataStage server and project, retrieve all Jobs and display jobs' names on the console without any problem.
However, my server job is working fine execept the output format of the array returned by the Web Service in the seqential file is still in, <item>job1</item><item>job2</item><item>job3</item>...........
one long..long...xml string format.
How can I output the retruned array as following:
Job1
job2
job3
job..
job...
My server job is as follows:
Seqential_File_01--->WS_Trns_01--->Trnsform_01-->WS_Trns_07-->Sequential_File_09.

Any help is appreciated.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Don't you just need to add an XML Input stage into the mix? Have it flatten the returned XML before you write it out to your sequential file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

Craig,
I have tried that before by inserting an XML input stage before the target sequential file. Then, the output of the sequential file became like "job1job2job3job4job5...", one long string. The Xpath in the column description is "/ns1:GetAllJobNamesResponse/return/item/text()" (without double quotes).
In my Java program, the following code will handle the returned array:
String[] allJobs = jobControl.getAllJobNames (sessionID);
for (int i=0; i<allJobs.length; i++) {
System.out.println (" " + allJobs [i]);
}
and data will be displayed on the console as follows:
job1
job2
job3
job.....

I just don't know what's the XPath syntax should be used in the xml input stage to handle SOAP's data type of ArrayOf_soapenc_string. Any idea? Thanks.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

What release are you using lstsaur?

If 7.5.x or earlier, what Craig is saying should work great. Just be sure first to use the "user defined message" for the output link of your Web Service Pack stage (just have a single column with a long varchar datatype and specify that in the pull down of the stage message tab)...

Capture the XML coming from your Web Services stage and also be sure that you are getting what you expect....it should be a perfectly formed SOAP body in XML format --- perhaps it's not.

If this is 8.x, that could be an issue also. There are some problems with partial xml strings in 8.0 where tags are being removed. That may be reflected also in the partial SOAP body delivery from the WSPack.

Ernie
Post Reply