Está en la página 1de 4

5/9/2016

ConsumingRESTwebservice(withParameters)in...|SCN

GettingStarted Newsletters

Hi,Guest

LogOn

JoinUs

Store

SearchtheCommunity

Products

Services&Support

AboutSCN

Downloads

Industries

Training&Education

Partnership

DeveloperCenter

Activity

LinesofBusiness

UniversityAlliances

Events&Webinars

Innovation

Browse

Communications

Actions

DataServicesandDataQuality

ConsumingRESTwebservice(withParameters)in
BODSusingHTTPAdapter
PostedbyJincyMinDataServicesandDataQualityon01Jul201308:22:48
Share

Tweet

Like

Letustrytounderstand,howtoaccessaRESTbasedwebservice(withparameters)inbatchjobfromBODS.This
featureissupportedfromBODS4.0SP3patch3.

Inthisexample,wewilltrytocallanexternalwebservicebypassingtwovaluesviz.materialnumberandtypeas
argumentsandwillcapturethematerialattributedetailsasreturnbythewebservicefunction.

ToimplementthisinSAPDataServices,firstofallweneedtocreateaHTTPadapterinstance,thenaddanoperation
to the adapter instance and create HTTPAdapter datastore. Next we need to Import the required function module.
FinallybuildaJobandaDataflowtoconsumethefunctionmodule.

ToaddaHTTPadapterinstanceintheAdministrator

SelectAdapterInstances>JobServer.
ClicktheAdapterConfigurationtab.
ClickAdd.
SelecttheadapterfromthelistofthoseavailableonthisJobServer.
EntertherequiredinformationtocreateanHTTPadapterinstance.
ClickApply.

LetsnametheAdapterInstancenameasHttpAdapter.Fortheotherfields,selectdefaultvalues.

Thenextstepistoconfigureadapteroperations.Adapteroperationsidentifytheintegrationoperationsavailablewith
theconfiguredadapterinstance.

Toaddanoperationinstancetoanadapterinstance

SelectAdapterInstances>JobServer.
ClicktheAdapterConfigurationtab.
UnderDependentObjects,clickOperations.
ClickAddtoconfigureanewoperation.
Selectanoperationtypefromthelist(hereRequest/Reply),thenclickApply.Theoptionsthatappeardependon
theoperationspecificdesign.
Completetheoperationinstanceconfigurationform.
ClickApply.

HereforthisdemonstrationIamusingthebelowdummywebservice.

http://scn.sap.com/community/dataservices/blog/2013/07/01/consumingrestwebservicewithparametersinbodsusinghttpadapter

1/4

5/9/2016

ConsumingRESTwebservice(withParameters)in...|SCN

http://testbatchwebapp/d/api/testcatalog/v1/shcoffering/pid/?client=COMMERCIAL&pid=71240403000

operationinstanceisgivenasOPERATION_GET_DESC.
FortheTargetURLgivethewebserviceurltilltheparametersiehereitishttp://testbatch
webapp/d/api/testcatalog/v1/shcoffering/pid/
sinceclientandpidareparameters.

GivenameoftheinputxsdinRequestmessageformat.
Inputparameterscanbeconvertedtoxsdasfollows(thereasonisthatBODScanonlyusexmlformatasinputand
output):

GiveschemanameofthereplyxmlinResponsemessageformat.
GiveparamvalueinconvertinputXMLtocolumn.Thisisrequiredtoconverttheinputxmltoparameters.

ThenextstepistocreatetheDatastore.GototheDatastoretaboftheLocalObjectLibrary.Rightclickandselect
NewtocreateaDatastore.

ForDatastoretype,selectAdapter.ForJobServer,selecttheJobServerconfiguredtohandleHTTPadapter.For
Adapterinstancename,choosetheinstancenameconfiguredintheAdministrator.ClickOKtosavevaluesandcreate
thedatastore.

http://scn.sap.com/community/dataservices/blog/2013/07/01/consumingrestwebservicewithparametersinbodsusinghttpadapter

2/4

5/9/2016

ConsumingRESTwebservice(withParameters)in...|SCN

Toimportmessagefunctions

IntheDesigner,doubleclicktheHTTPdatastore.TheAdapterMetadataBrowserwindowopens.
RightclicktheoperationinstancetoimportandselectImportfromthemenu.

TheoperationinstanceOPERATION_GET_DESCisaddedtothedatastore.

SonowwecanfindtheimportedfunctionundertheMessageFunctionssectionoftheHTTPDatastoreoftheLocal
ObjectLibrary.

DoubleclickthefunctionmoduletopreviewtheSchemaDefinition.Asmentionedpreviouslythisfunctionmodule
expectsaninputXMLSchemaasREQUESTandalsoreturnsanoutputXMLSchemaasREPLYorresponse.

NowaDataflowinadataservicesjobcanconsumethefunctioncall.Belowistheimplementationscreenshotofthe
Dataflow.

HeretheSourceTablehascolumnsCLIENTandPID.Therequirementhereistopassthisinformationtowebservice
andgetthereplymessage.

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)asinputargumentstotheWebServiceFunction.

QueryTransformQ_Unnest_RecordsisusedtoUNNESTtheReturnSchemaandfinallytherequiredfieldsfromthe
responsexmlispopulatedtothetableC_TEST_STG.

10255Views

Tags:rest,webservicerest_webservice

AverageUserRating

http://scn.sap.com/community/dataservices/blog/2013/07/01/consumingrestwebservicewithparametersinbodsusinghttpadapter

3/4

5/9/2016

ConsumingRESTwebservice(withParameters)in...|SCN

(9ratings)

Share

Tweet

Like

6Comments
kamalkumar26Aug201314:23

Hey,

Thanksalotforyourpost.
IsuccessfullyimplementedabovementionedstepsbutwhileexecutingthejobIgotfollowingerror
Errorcallingfunction:<AdapterRequest_Reply:
java.security.cert.CertificateException:UntrustedServerCertificateChain>

Kindlyhavealooktoresolvetheissue.

Regards,
Kamal
Like(0)

MeghaMohan15Oct201313:18

HiJincyMathew,

Greatinformativepost

HaveaquestiononODBCdoyouhavethestepstoemulateanODBConSolaris.TriedDatadirect
butthatdidnotwork.

Cheers,

MeghaChanchalA.Puthussery
Like(0)

JincyM21Oct201310:40(inresponsetoMeghaMohan)

HiMegha,

Pleasechecklink

http://scn.sap.com/message/5749481#5749481
(lastcommentbyScottBroadway).Itmayhelpyou.

Regards,
Jincy
Like(0)

DERLEMASOPHIE25Mar201409:15

hiJincyM

Thankyouforthepost
Iwouldliketoknowifitisnecessarytohaveaextranetconnexiontoimporttheoperationinthe
datastore.

thankyouinadvanceforyourreply

Sder
Like(0)

ArunSasi22Sep201513:53

ExcellentdocumentJincy!!

Arun
Like(0)

VadimKravchenko09Nov201518:16

GreatPost!

WouldliketoknowifthereisawaytoincludecustomHTTPheaderparametersinAdapter/Operation
configuration?

Thankyou.
Like(0)

SiteIndex
Privacy

ContactUs
TermsofUse

SAPHelpPortal
LegalDisclosure

Copyright

http://scn.sap.com/community/dataservices/blog/2013/07/01/consumingrestwebservicewithparametersinbodsusinghttpadapter

FollowSCN

4/4

También podría gustarte