Let us try to understand, how to access a REST based web service (with parameters) in batch job from BODS. This feature is supported from BODS 4.0 SP3 patch3.
In this example, we will try to call an external web service by passing two values viz. material number and type as arguments and will capture the material attribute details as return by the web service function.
To implement this in SAP Data Services, first of all we need to create a HTTP adapter instance, then add an operation to the adapter instance and create HTTP Adapter datastore. Next we need to Import the required function module. Finally build a Job and a Dataflow to consume the function module.
To add a HTTP adapter instance in the Administrator
Let’s name the Adapter Instance name as HttpAdapter. For the other fields, select default values.
The next step is to configure adapter operations. Adapter operations identify the integration operations available with the configured adapter instance.
To add an operation instance to an adapter instance
Here for this demonstration I am using the below dummy web service.
http://test-batch-webapp/d/api/testcatalog/v1/shcoffering/pid/?client=COMMERCIAL&pid=71240403000
Input parameters can be converted to xsd as follows(the reason is that BODS can only use xml format as input and output):
The next step is to create the Datastore. Go to the Datastore tab of the Local Object Library. Right-click and select New to create a Datastore.
For Datastore type, select Adapter. For Job Server, select the Job Server configured to handle HTTP adapter. For Adapter instance name, choose the instance name configured in the Administrator. Click OK to save values and create the datastore.
.
To import message functions
The operation instance OPERATION_GET_DESC is added to the datastore.
So now we can find the imported function under the Message Functions section of the HTTP Datastore of the Local Object Library.
Double-click the function module to preview the Schema Definition. As mentioned previously this function module expects an input XML Schema as REQUEST and also returns an output XML Schema as REPLY or response.
Now a Dataflow in a data services job can consume the function call. Below is the implementation screenshot of the Dataflow.
Here the Source Table has columns CLIENT and PID. The requirement here is to pass this information to web service and get the reply message.
Here the query transform Q_Test_Nest is used to generate a XML Schema(TEST_ADAPTER_INPUT) as per the required input template for the Web Service Function. In query transform Q_Test_XML_Func_Call , function OPERATION_GET_DESC is called by using New function call and passed the generated XML schema (TEST_ADAPTER_INPUT)as input arguments to the Web Service Function.
Query Transform Q_Unnest_Records is used to UNNEST the Return Schema and finally the required fields from the response xml is populated to the table C_TEST_STG.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |