Web Service Call from DataStage

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
kewk
Participant
Posts: 17
Joined: Tue Mar 16, 2010 8:54 am

Web Service Call from DataStage

Post by kewk »

Hi All,
In our project we are using web service transformer stage to call MDM web service (The datastage version is 8.7 and OS is Windows server 2008 R2). the job design is as below

Sequential file---->webserviceTransformer--->Transformer--->Sequentialfile

The job is working fine , we have imported the WSDL and used the definations to call the webservice. But we have a new requrement in which a particular block of the request XML needs to be repeated. For e.g.

Code: Select all

<ns3:TCRMPartyAddressBObj>
					<ns3:AddressUsageType>13</ns3:AddressUsageType>
					<ns3:TCRMAddressBObj>
						<ns3:AddressLineOne>abcefg</ns3:AddressLineOne>
						<ns3:AddressLineTwo>abcefg</ns3:AddressLineTwo>
						<ns3:AddressLineThree>abcefg</ns3:AddressLineThree>
						<ns3:City>abcefg</ns3:City>
						<ns3:ZipPostalCode>700055700055</ns3:ZipPostalCode>
						<ns3:CountryType>7426</ns3:CountryType>
					</ns3:TCRMAddressBObj>
				</ns3:TCRMPartyAddressBObj>
In the Xpath definations that we have imported we have only one row for the above columns

For e.g. AddressLineOne is defined as


/ns1:addPerson/ns2:TCRMPersonBObj/ns2:TCRMPartyAddressBObj/ns2:TCRMAddressBObj/ns2:AddressLineOne/

In the input file the structure is as below


AddressUsageType,AddressLineOne,AddressLineTwo,AddressLineThree,
City,ZipPostalCode,CountyType,AddressUsageType_2,AddressLineOne_2,
AddressLineTwo_2,AddressLineThree_2,City_2,ZipPostalCode_2,CountyType_2

So basically we need to generate two blocks - one withe city,adrressline etc and the other with city_2,addresslineone_2 etc.

Please let me know if there is a way to achieve this. Thanks for your help in advance.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

You need to put the xmlOutput stage in front of the ws transformer....

You may have to learn about the xml output stage and build the exact payload required......but if the incoming array is already defined in the wsdl, you can do this easily......put a transformer directly in front of your ws transformer, and an xmloutput stage in front of that.......then, on the input link of the xmlOutput stage, LOAD the _IN tabledef that you'll find in the collection of tabledefs that were imported along with your wsdl. On the output link just have one big varchar column with a single slash in the Description property.

In the wstransformer just go to the input link, message tab and select this column in the pulldown for "user defined msg".

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kewk
Participant
Posts: 17
Joined: Tue Mar 16, 2010 8:54 am

Post by kewk »

Thanks for the reply.

In my incoming file , I have all the columns in a single row only, I need process it one row at a time also.


But the real problem is to generate two address blocks with a single row.

Because both of them have same xpath expressions. I tried defining the columns with same Xpath

for e.g.

Code: Select all

AddressLineOne :/ns1:addPerson/ns2:TCRMPersonBObj/ns2:TCRMPartyAddressBObj/ns2:TCRMAddressBObj/ns2:AddressLineOne/ 


AddressLineOne_2:/ns1:addPerson/ns2:TCRMPersonBObj/ns2:TCRMPartyAddressBObj/ns2:TCRMAddressBObj/ns2:AddressLineOne/ 
so if AddressLineOne is abc & AddressLineOne_2 is efg ,
what it did was to append the values in the below tag

Code: Select all

<ns3:AddressLineOne>abcefg</ns3:AddressLineOne> 



I need to get two separate address blocks of the below

Code: Select all

<ns3:TCRMPartyAddressBObj>
               <ns3:AddressUsageType>13</ns3:AddressUsageType>
               <ns3:TCRMAddressBObj>
                  <ns3:AddressLineOne>abcefg</ns3:AddressLineOne>
                  <ns3:AddressLineTwo>abcefg</ns3:AddressLineTwo>
                  <ns3:AddressLineThree>abcefg</ns3:AddressLineThree>
                  <ns3:City>abcefg</ns3:City>
                  <ns3:ZipPostalCode>700055700055</ns3:ZipPostalCode>
                  <ns3:CountryType>7426</ns3:CountryType>
               </ns3:TCRMAddressBObj>
            </ns3:TCRMPartyAddressBObj>

with the values

Code: Select all

AddressUsageType,AddressLineOne,AddressLineTwo,AddressLineThree,City,ZipPostalCode,CountyType
and the another with the values

Code: Select all

AddressUsageType_2,AddressLineOne_2,AddressLineTwo_2,AddressLineThree_2,City_2,ZipPostalCode_2,CountyType_2

I am capturing the above request XML that is getting generated by web service transformer using tcpmon.It there I found that if I defined same Xpath for two columns the values simple get concatenated in the tag.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

To get two repeating nodes you need two incoming rows. Pivot the addesses first.
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
spoilt
Participant
Posts: 7
Joined: Mon Mar 25, 2013 7:17 am

Post by spoilt »

You can mark the City as Key (Repeating Elements required=Yes). So that the output will be new line for every City.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

wait..... reading thru this again..... you said you needed "two address blocks".....but you don't...

according to your details, you need one address block of

.....UsageType ....and another one of
.....UsageType_2

That's just additional columns. The first usage type column on the link will go to the first UsageType and the next one (which has a unique name on the link already) will go to the second one.

This assumes that they are on the same row. This is simple when the node is NOT repeating (this is not repeating addresses --- it's just "similar named" elements). A poor xml design, frankly, but in this case, if you already have all the address values on the same row, a bit simpler to deal with.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kewk
Participant
Posts: 17
Joined: Tue Mar 16, 2010 8:54 am

Post by kewk »

Hi All,
Thanks dor your help. I was able to resolve the issue. I generated the XML with repeating block to be fed into the webservice . Marking the thread as resolved.
Post Reply