Upload
pallavi-koppula
View
215
Download
0
Embed Size (px)
Citation preview
8/17/2019 Consuming REST Web Service (With Parameters) in..
1/4
5/9/2016 Consuming REST web service (with Parameters) in... | SCN
http://scn.sap.com/community/data-services/blog/2013/07/01/consuming-rest-web-service-with-parameters-in-bods-using-http-adapter 1/4
Getting Started Newsletters Store
Products Services & Support About SCN Downloads
Industries Training & Education Partnership Developer Center
Lines of Business University Alliances Events & Webinars Innovation
Log On Join UsHi, Guest Search the Community
Activity Communications Actions
Browse
Data Services and Data Quality
0 Tweet
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 operationto 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 Conf iguration tab.
Click Add.
Select the adapter from the list of those available on this Jo b 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.
Consuming REST web service (with Parameters) inBODS using HTTP Adapter
Posted by Jincy M in Data Services and Data Quality on 01-Jul-2013 08:22:48
Share 1 0Like
http://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttps://twitter.com/intent/tweet?hashtags=scn&original_referer=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F07%2F01%2Fconsuming-rest-web-service-with-parameters-in-bods-using-http-adapter&ref_src=twsrc%5Etfw&text=Consuming%20REST%20web%20service%20(with%20Parameters)%20in%20BODS%20using%20HTTP%20Ada...&tw_p=tweetbutton&url=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F07%2F01%2Fconsuming-rest-web-service-with-parameters-in-bods-using-http-adapter&via=SAPCommNethttp://scn.sap.com/people/jincyhttp://scn.sap.com/community/data-services/blog/2013/07/01/consuming-rest-web-service-with-parameters-in-bods-using-http-adapterhttp://scn.sap.com/community/data-services/bloghttp://scn.sap.com/community/data-services/blog/2013/06/20/match-strings-with-matchpatternhttp://scn.sap.com/community/data-services/blog/2013/07/04/creating-a-data-flow-for-a-real-time-service-in-designer-to-be-exposed-as-a-web-service-callhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttp://scn.sap.com/people/jincyhttp://scn.sap.com/community/data-services/bloghttp://scn.sap.com/people/jincyhttp://scn.sap.com/community/data-services/blog/2013/07/01/consuming-rest-web-service-with-parameters-in-bods-using-http-adapterhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238958/Capture1.PNGhttps://twitter.com/intent/tweet?hashtags=scn&original_referer=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F07%2F01%2Fconsuming-rest-web-service-with-parameters-in-bods-using-http-adapter&ref_src=twsrc%5Etfw&text=Consuming%20REST%20web%20service%20(with%20Parameters)%20in%20BODS%20using%20HTTP%20Ada...&tw_p=tweetbutton&url=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F07%2F01%2Fconsuming-rest-web-service-with-parameters-in-bods-using-http-adapter&via=SAPCommNethttp://scn.sap.com/community/data-services/blog/2013/07/04/creating-a-data-flow-for-a-real-time-service-in-designer-to-be-exposed-as-a-web-service-callhttp://scn.sap.com/community/data-services/blog/2013/06/20/match-strings-with-matchpatternhttp://scn.sap.com/community/data-services/bloghttp://scn.sap.com/contenthttp://scn.sap.com/actionshttp://scn.sap.com/communicationshttp://scn.sap.com/activityhttp://scn.sap.com/login.jspahttp://scn.sap.com/community/data-services/blog/2013/07/01/login.jspahttp://scn.sap.com/community/uachttp://scn.sap.com/community/developer-centerhttp://scn.sap.com/community/downloadshttp://scn.sap.com/welcomehttps://www.sapstore.com/?url_id=banner-US-2015-SCN-HeadLinkhttp://scn.sap.com/community/newslettershttp://scn.sap.com/community/getting-started
8/17/2019 Consuming REST Web Service (With Parameters) in..
2/4
5/9/2016 Consuming REST web service (with Parameters) in... | SCN
http://scn.sap.com/community/data-services/blog/2013/07/01/consuming-rest-web-service-with-parameters-in-bods-using-http-adapter 2/4
http://test-batch-webapp/d/api/testcatalog/v1/shcoffering/pid/?client=COMMERCIAL&pid=71240403000
operation instance is given as OPERATION_GET_DESC.
For the Target UR L give the web service url till the parameters ie; here it is http://test-batch-
webapp/d/api/testcatalog/v1/shcoffering/pid/
since client and pid are parameters.
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 in stance name, choose the instance name con figured i n the Administrator. Click OK to save values and crea te
the datastore.
.
http://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238960/Capture3.PNGhttp://test-batch-webapp/d/api/testcatalog/v1/shcoffering/pid/http://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238959/Capture2.PNGhttp://test-batch-webapp/d/api/testcatalog/v1/shcoffering/pid/?client=COMMERCIAL&pid=71240403000
8/17/2019 Consuming REST Web Service (With Parameters) in..
3/4
5/9/2016 Consuming REST web service (with Parameters) in... | SCN
http://scn.sap.com/community/data-services/blog/2013/07/01/consuming-rest-web-service-with-parameters-in-bods-using-http-adapter 3/4
Average User Rating
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 therequired 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.
10255 Views Tags: rest, webservice;rest_webservice
http://scn.sap.com/community/data-services/blog/tags#/?tags=webservice%3Brest_webservicehttp://scn.sap.com/community/data-services/blog/tags#/?tags=resthttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238967/Capture7.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238966/Capture6.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238965/Capture5.PNGhttp://scn.sap.com/servlet/JiveServlet/showImage/38-88100-238964/Capture4.PNG
8/17/2019 Consuming REST Web Service (With Parameters) in..
4/4
5/9/2016 Consuming REST web service (with Parameters) in... | SCN
http://scn.sap.com/community/data-services/blog/2013/07/01/consuming-rest-web-service-with-parameters-in-bods-using-http-adapter 4/4
Follow SCNSite Index Contact Us SAP Help Portal
Privacy Terms of Use Legal Disclosur e Copyright
9 ratin s
0 TweetShare 1 0Like
6 Comments
Like (0)
kamal kumar 26-Aug-2013 14:23
Hey ,
Thanks a lot for your post.
I successfully implemented above mentioned steps but while executing the job I got following error
Error calling function:
Kindly have a look to resolve the issue.
Regards,
Kamal
Like (0)
Megha Mohan 15-Oct-2013 13:18
Hi Jincy Mathew,
Great informative post
Have a question on ODBC - do you have the steps to emulate an ODBC on Solaris. Tried Datadirect
but that did not work.
Cheers,
Megha Chanchal A. Puthussery
Like (0)
Jincy M 21-Oct-2013 10:40 (in response to Megha Mohan)
Hi Megha,
Please check link http://scn.sap.com/message/5749481#5749481(last comment by Scott Broadway). It may help you. Regards,Jincy
Like (0)
DERLEMA SOPHIE 25-Mar-2014 09:15
hi Jincy M
Thank you for the post
I would like to know if it is necessary to have a extranet connexion to import the operation in the
datastore.
thank you in advance for your reply
Sder
Like (0)
Arun Sasi 22-Sep-2015 13:53
Excellent document Jincy!!
Arun
Like (0)
Vadim Kravchenko 09-Nov-2015 18:16
Great Post!
Would like to know if there is a way to include custom HTTP header parameters in Adapter/Operation
configuration?
Thank you.
http://scn.sap.com/people/vadim.kravchenkohttp://scn.sap.com/people/arun.sasihttp://scn.sap.com/people/derlemahttp://scn.sap.com/message/5749481#5749481http://scn.sap.com/people/jincyhttp://scn.sap.com/people/megha.chanchalputhusseryhttp://scn.sap.com/people/kamal264https://twitter.com/intent/tweet?hashtags=scn&original_referer=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F07%2F01%2Fconsuming-rest-web-service-with-parameters-in-bods-using-http-adapter&ref_src=twsrc%5Etfw&text=Consuming%20REST%20web%20service%20(with%20Parameters)%20in%20BODS%20using%20HTTP%20Ada...&tw_p=tweetbutton&url=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F07%2F01%2Fconsuming-rest-web-service-with-parameters-in-bods-using-http-adapter&via=SAPCommNethttp://www.sap.com/corporate-en/our-company/legal/copyright/index.epxhttp://www.sap.com/corporate-en/our-company/legal/impressum.epxhttps://accounts.sap.com/ui/public/viewTextResource?scenario=SCN&spId=504efd8ee4b0555c3c17b94e&resourceType=RESOURCE_TERMS_OF_USE&version=1&spDisplayName=SAP%20Community%20Network&locale=enhttps://accounts.sap.com/ui/public/viewTextResource?scenario=SCN&spId=504efd8ee4b0555c3c17b94e&resourceType=RESOURCE_PRIVACYPOLICY&version=1&spDisplayName=SAP%20Community%20Networkhttp://help.sap.com/http://scn.sap.com/docs/DOC-18476http://scn.sap.com/docs/DOC-19361http://spr.ly/SCNgoogleplushttp://bit.ly/SCNyouThttp://bit.ly/SCNFBhttp://bit.ly/SCNTwR