Array Input to web service

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
Nicole
Premium Member
Premium Member
Posts: 93
Joined: Mon Oct 22, 2007 12:55 pm
Location: Albany
Contact:

Array Input to web service

Post by Nicole »

I need to send an array to a web service

The WSDL contains one field as:

/ns1:saveForm/form/additionalInfo/FormInfo/extPayerID/text()

and another as:

/ns1:saveForm/form/additionalInfo/FormInfo/intPayerID/text()

I know that I will always only have 2 groups of these. 1 set of extPayerId and intPayerId and a second set of extPayerId and intPayerId.

I guess the XML getting passed to the web service would then be:

<additionalInfo>
<FormInfo>
<extPayerId>input.exttpid</extPayerId>
<intPayerId>input.inttpid</intPayerId>
</FormInfo>
</additionalInfo>
<additionalInfo>
<FormInfo>
<extPayerId>input.exttpid1</extPayerId>
<intPayerId>input.inttpid1</intPayerId>
</FormInfo>
</additionalInfo>
<additionalInfo>


How can I pass a second set of ids to the web service? in the description could I possibly use a subscript in the xpath to pass the first and second set? Can I pass - for these fields - the xml as a string and just not include the xpath in the description? Is that possible?

Can someone help me out here? Thanks so much - Nicole
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

It's not particularly easy, but it can be done....try these steps:

a) be sure that the service WORKS PERFECTLY with a single row. That will ensure that the "plumbing" is working as you expect and that the service behaves as you would expect, only needing an array of data for better efficiency and less invocations.

b) create a BRAND new job from scratch (brand new links and stages) and have the following order of stages around your WSTransformer.....

regular transformer, xmlOutput, regular Transformer, WSTransformer, regular Transformer, xmlInput, regular Transformer.

This is for building and deserializing your arrays, and also to avoid any possible confusion of xpath among the stages you are working with.

c) "Load" the Operation into your WSTransformer via the main "Select a Service" button, but do NOT load anything into its input or output links.

d) at the Input link of your xmlOutput Stage, go to the columns tab and LOAD the _IN table definition that you will find in your Table Definitins tree for this Operation. On the output link of the XMLOutput stage, manually enter a single large varchar column and put a single "/" in the Description property. You should probably go also to the Transformation Settings of the Stage and "LOAD" the same _IN table def into the Namespace declarations property.

e) pass the column thru the next transformer

f) in the WSTransformer, find the "user defined" drop down at the Input Link, and select your single large column.

g) On the output link of the WSTransformer, LOAD the "Built In" SOAPBody tabledef. Use the same pull down to select this single column as Use defined.

h) Pass it directly thru the next transformer.

i) In the XMLInput Stage, where you will parse out the array from the SOAP envelope, LOAD the _OUT Tabledef from the TableDefs tree (Web Services) into its Output Link. be sure also to LOAD the namespace property in that stage also.

j) connect the rest of your stages.


This technique will work in Server or EE, although EE may have issues if the arrays are extremely large. Also, in the past I've seen issues with this technique at the XML stage if there are only 2 columns.....you many need to increase the number of columns if the body isn't created exactly as you would like.

Lastly .....test each piece individually.....create the arrays, send them to flat files, etc....as you move forward with the entire technique.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Nicole
Premium Member
Premium Member
Posts: 93
Joined: Mon Oct 22, 2007 12:55 pm
Location: Albany
Contact:

Post by Nicole »

Thanks so much - i'll give it a try - so there is no way to subscript in the xpath description? such as /ns1:saveForm/form/additionalTaxpayerInfo/FormTaxpayerInfo/externalTaxpayerID[2]/text() - although I did try this and I received an error - so something must be incorrect :?

Also, there are other fields that need to be passed, not just these ids - it's just that for each group of data - this is the only one that needs to have a second set of ids - there has to be a way to this that is easier, no?
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Not in the current WSTransformer. It is designed to handle single row, single input/output request/response services without complex bodies (the body must be a relational set of identical rows and columns).

Ernie
Ernie Ostic

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