How to call a webservice from Datastage version 7.1

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
pmadhavi
Charter Member
Charter Member
Posts: 92
Joined: Fri Jan 27, 2006 2:54 pm

How to call a webservice from Datastage version 7.1

Post by pmadhavi »

Does anyone have any information on what approach to follow to call a webservice from datastage version 7.1? i am aware that RTI is the answer to it but of what i know, RTI is supported only from version 7.5

I do not work on datastage so i have some basic queries. I have heard that you can call a java program from datastage. Is it then not possible to call a webservice directly in datastage and pass it the XML ?

please guide
Thanks,
Madhavi
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

Madhavi,
RTI also works with DataStage 7.1r1 version. You need a separate license for RTI. DataStage can call a Java program only if you have intalled the Java PACK which also requires a seperate license.
I have evaluated the IBM Hawk beta version. One of the nice things I like about it is that Hawk is using the Websphere app server as the mid tier. So, you can write your own J2EE code to do Web Service, XML, and EJB without buying the RTI and the Java PACK.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

RTI (now called SOAP edition) is about publishing DataStage jobs as web services. It is not about calling web services from DataStage. RTI has been in DataStage since at least version 7.0, if not earlier.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

SOA Edition, actually. No pee. And you can purchase something called the Web Services PACK which is all about calling web services from DataStage jobs. It gets you two lovely little stages:

Web Services Transformer stage: An active stage allowing you to call a web service for each record through a job.

Web Services Client stage: A passive stage when you need the web service to act as either a data source or a data target.

The help says that it also includes 'added functionality in DataStage routines' but not sure I could honestly say what that would be, in spite of having used these stages. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Post by sud »

chulett wrote:The help says that it also includes 'added functionality in DataStage routines' but not sure I could honestly say what that would be, in spite of having used these stages. :?
As an example, if you import the metadata of any webservice you will find a server routine being created for each function so that you can also invoke the webservice by calling the routine instead of using any of the RTI stages. The routine name should be <WebServiceName>.<function name>

I am pasting an example :

Code: Select all


* *********************************************************
* (c) 2004, 1997-2003 Ascential Software Corporation. All rights reserved.
* This code was automatically generated by the Web Service 
* WSDL Code Generator.  You can freely modify the code, but
* doing so may invalidate the functionality of the code.   
* Any added code should be made between designated regions 
* *********************************************************
* CodeGen Version #1
* *********************************************************


	* *********************************************
	* Definitions of the Input Arguments           
	* 	Argument Name	Argument Type               
	* 	-------------	-------------               
	* *********************************************


	* **************************************************************
	* Declare the possible flag values for the initializeWebService call 
	* **************************************************************

	Deffun DSRMessage(A1, A2, A3) Calling "*DataStage*DSR_MESSAGE"
	WS_NODEBUG_FLG = 0
	WS_TRACE_FLAG  = 1
	WS_DEBUG_FLAG  = 2
	WS_FULLDEBUG   = 3

	* **************************************************************
	* This first bit of code is here to define the error handling,  
	* if defined.  The variable DEBUG_FLAG should be set to one to
	* turn this on, which will log any errors to the DataStage      
	* logging mechanism                                             
	* **************************************************************
	DEBUG_FLAG         = 0
	RoutineName        = 'calculateAttributes'
	ds%%operationName  = 'CriteriaManagerServiceWsService'
	ds%%soapName       = ''
	ds%%portName       = 'http://***.**.***.**:****/rypothesis/kitchenservices/OhMyGodService'
	ds%%operationStyle = 'Rpc'
	ds%%encodingStyle  = 'http://schemas.xmlsoap.org/soap/encoding/'

	* **************************************************************
	* Ok, now lets start the actual Web Service Setup Code 
	* **************************************************************
	ds%%wsHdl  = initializeWebService( RoutineName, WS_NODEBUG_FLG )
	ds%%status = setWSOperationName( ds%%wsHdl, ds%%operationName )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END
	ds%%status = setWSSOAPAction( ds%%wsHdl, ds%%soapName )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END
	ds%%status = setWSPortAddress( ds%%wsHdl, ds%%portName )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END
	ds%%status = setWSOperationStyle( ds%%wsHdl, ds%%operationStyle )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END
	ds%%status = setWSEncodingStyle( ds%%wsHdl, ds%%encodingStyle )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END

	* **************************************************************
	* Now we will add the name space pairs.  These define how to translate  
	* from the name space alias to the actual name space definition.  
	* **************************************************************
	ds%%reqNameSpace = 'soapenc':@VM:'http://schemas.xmlsoap.org/soap/encoding/'
	ds%%reqNameSpace = ds%%reqNameSpace:@FM:'wsdl':@VM:'http://schemas.xmlsoap.org/wsdl/'
	ds%%reqNameSpace = ds%%reqNameSpace:@FM:'xsi':@VM:'http://www.w3.org/2001/XMLSchema-instance'
	ds%%reqNameSpace = ds%%reqNameSpace:@FM:'xsd':@VM:'http://www.w3.org/2001/XMLSchema'
	ds%%status = setWSRequestNSTable( ds%%wsHdl, ds%%reqNameSpace )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END

	* **************************************************************
	* Now we will add the name space pairs.  These define how to translate  
	* from the name space alias to the actual name space definition.  
	* **************************************************************
	ds%%resNameSpace = 'soapenc':@VM:'http://schemas.xmlsoap.org/soap/encoding/'
	ds%%resNameSpace = ds%%resNameSpace:@FM:'wsdl':@VM:'http://schemas.xmlsoap.org/wsdl/'
	ds%%resNameSpace = ds%%resNameSpace:@FM:'ns1':@VM:'urn:CriteriaManagerService'
	ds%%resNameSpace = ds%%resNameSpace:@FM:'xsi':@VM:'http://www.w3.org/2001/XMLSchema-instance'
	ds%%resNameSpace = ds%%resNameSpace:@FM:'xsd':@VM:'http://www.w3.org/2001/XMLSchema'
	ds%%status = setWSResponseNSTable( ds%%wsHdl, ds%%resNameSpace )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END

	* **************************************************************
	* Now we need to prepare the mappings to be applied to each       
	* argument.  This array will be a dynamic array of                
	* values that will align with the corresponsing arguments         
	* **************************************************************  

	ds%%outputArray = ''
	ds%%status = setWSResponseMapArray( ds%%wsHdl, ds%%outputArray)
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END

	* **************************************************************
	* Call the actual web service, returning the Ans                
	* **************************************************************
	Ans = ''
	ds%%status = callWebService( ds%%wsHdl, 'ARRAY', Ans )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END

	* **************************************************************
	* Terminate the web service data structures                     
	* **************************************************************
	ds%%status = terminateWebService( ds%%wsHdl )
	IF DEBUG_FLAG AND ds%%status NE 0 THEN
		ds%%statusString = getWSStatusReport( ds%%wsHdl )
		CALL DSLogWarn( ds%%statusString, RoutineName )
	END
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I was assuming they had added additional 'web service' related functions, but don't recall seeing anything like that documented anywhere.

It sure looks like we've found some, cherry picking out of your pasted code:

Code: Select all

getWSStatusReport
setWSSOAPAction
setWSEncodingStyle
setWSRequestNSTable
setWSResponseNSTable
setWSResponseMapArray
callWebService
terminateWebService
Interesting...
-craig

"You can never have too many knives" -- Logan Nine Fingers
newtier
Premium Member
Premium Member
Posts: 27
Joined: Mon Dec 13, 2004 5:50 pm
Location: St. Louis, MO

Re: How to call a webservice from Datastage version 7.1

Post by newtier »

pmadhavi wrote:Does anyone have any information on what approach to follow to call a webservice from datastage version 7.1? i am aware that RTI is the answer to it but of what i know, RTI is supported only from version 7.5

I do not work on datastage so i have some basic queries. I have heard that you can call a java program from datastage. Is it then not possible to call a webservice directly in datastage and pass it the XML ?

please guide
Just to add some extra information: With Version 7.x there are additional packs you have to "buy", one for Java and one for Web Services. My understanding is that both are 2-way, meaning you can call a DataStage job "as a Web Service", or a DataStage job can call a Web Service (same description for Java 2-way.)

Per Keith Kohl on the Webinar yesterday, with the HAWK release, the plan is to incorporate these features as part of the base DataStage product without extra cost.
Rick H
Senior Consultant
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: How to call a webservice from Datastage version 7.1

Post by chulett »

newtier wrote:Just to add some extra information: With Version 7.x there are additional packs you have to "buy", one for Java and one for Web Services. My understanding is that both are 2-way, meaning you can call a DataStage job "as a Web Service", or a DataStage job can call a Web Service (same description for Java 2-way.)
I thought we'd already covered this - the Web Service aspect of DataStage is (unfortunately) not two-way. You have to buy the Web Service PACK to enable jobs to call web services and you have to buy the SOA Edition in order to expose your jobs as web services.

I'm also not sure about the 'two-way-ness' of the Java PACK. It will allow you to call Java objects from inside a DataStage job... curious what the other 'way' might be... :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply