Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
28,736

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

 

  • Select Adapter Instances > Job Server.
  • Click the Adapter Configuration tab.
  • Click Add.
  • Select the adapter from the list of those available on this Job Server.
  • Enter the required information to create an HTTP adapter instance.
  • Click Apply.

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

 

  • Select Adapter Instances > Job Server.
  • Click the Adapter Configuration tab.
  • Under Dependent Objects, click Operations.
  • Click Add to configure a new operation.
  • Select an operation type from the list (here Request/Reply), then click Apply. The options that appear depend on the operation specific design.
  • Complete the operation instance configuration form.
  • Click Apply.

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

 

  • Give name of the input xsd in ‘Request message format’.

  Input parameters can be converted to xsd as follows(the reason is that BODS can only use xml format as input and output):

  • Give schema name of the reply xml in ‘Response message format’.
  • Give ‘param-value’ in ‘convert input XML to’ column. This is required to convert the input xml to parameters.

   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

  • In the Designer, double-click the HTTP data store .The Adapter Metadata Browser window opens.
  • Right-click the operation instance to import and select Import from the menu.

  

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.

13 Comments
Labels in this area