Reading Zero or More repetitive elements from XML

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Gopi Krishna
Participant
Posts: 10
Joined: Thu Jan 06, 2011 1:02 am
Location: Ramantapur,HYD

Reading Zero or More repetitive elements from XML

Post by Gopi Krishna »

Hi All,

We are using Serice Director to use the DS job as a service. So we will receive the SOAP request as an input and my job will read the request and it will standardize the data and will gives the response. Following is the sample SOAP req which i will receive.

<organization>
</organizationRecord>
<TID>xxx</tenantOID>
<SID>yyy</sourceOID>
<organizationRecord>
<status>I</status>

<!--Zero or more repetitions:--> {minoccurs=0, maxoccurs=unbounded}
<identifier>123</identifier>
<identifier>345</identifier>
<identifier>678</identifier>
<identifier>323</identifier>
<identifier>679</identifier>

<!--optional:--> {mincoocurs=0, maxoccurs=1}
<pIdentifier>12345</pIdentifier>

</organizationRecord>
</organization>

In this request both identifier and pidentifier fields both are optional but pidentifier we will receive only once if we have the value because minoccurs=0 and maxoccurs=1. But identifier will receive more than once because maxoccurs is unbounded.

Here is the actual problem which i am facing.

If we dont have any value for the optional fields then I will not get any tags for the optional fields.that means if i dont have any value for pidentifer then i will not receive even empty tag also in the request. so in that case my request will be like this.

<organization>
</organizationRecord>
<TID>xxx</tenantOID>
<SID>yyy</sourceOID>
<organizationRecord>
<status>I</status>

<!--Zero or more repetitions:--> {minoccurs=0, maxoccurs=unbounded}
<identifier>123</identifier>
<identifier>345</identifier>
<identifier>678</identifier>
<identifier>323</identifier>
<identifier>679</identifier>

</organizationRecord>
</organization>

This request is successfully processed by my DS job. but If i dont pass any tag for the identifier(see the below req) then my job is getting fail.

<organization>
</organizationRecord>
<TID>xxx</tenantOID>
<SID>yyy</sourceOID>
<organizationRecord>
<status>I</status>

</organizationRecord>
</organization>

My concern is if i dont pass any tag for the optional fileds it is working fine. But if i dont pass any tag for the zero or more repetitions then the job is getting fail. Dont know why it is behaving like this.In general both are optional fileds the only diff is for identifier the maxoccurs is unbounded. apart from that there is no difference. if i pass empty tag for identifier then the reauest is processing successfully. The job is failing when i dont pass any tag for zero or more repetitions. Can anybody help me on this why it is behaving differently even both the fileds are optional.
GK
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

...a couple of things...

a) what exactly does "failing" mean? What error, and where? in DS log? in ISD? in the calling client application?

b) is the repeating group in the wsdl? It's not entirely clear from your note. Are you just receiving a large varchar from someone with contents of xml? (ie...is the input and output of your job a single column?).

Ernie
Ernie Ostic

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