This Research Paper is about Restful API and Rest APIs. This Paper Presents Description about how APIS Restful APIs work and how they are implemented and why they are used in the modern world. Mithilesh Tarkar | Ameya Parker "APIs and Restful APIs" P
This Research Paper is about Restful API and Rest APIs. This Paper Presents Description about how APIS Restful APIs work and how they are implemented and why they are used in the modern world. Mithilesh Tarkar | Ameya Parker "APIs and Restful APIs" P
Web services con Java (desde Netbeans) y PostgreSQL
Descripción completa
Descrição completa
Descrição: Construindo APIs REST Com Node.js - Casa Do Codigo
Data Services Integration Using IDocDescripción completa
Descripción completa
ghgmkkgDescripción completa
Descripción: Understanding about desiging web api
REST API
Descripción: REST API
Descibes how to use NPN and PNP transistors as switches.Full description
Using VyOS as a Firewall
Learn Rest
Cloud computing is becoming an increasingly popular enterprise model in which computing resources are made available on demand to the user as needed. The unique value proposition of cloud computing creates new opportunities to align IT and business g
rest areaFull description
Descripción completa
plasenta restDeskripsi lengkap
Esplanação sobre Java e RESTDescrição completa
With the Knowledge of Java Application, we can implement a Project for the purpose of Web based Automated Manufacturing system, chat system, Web E-Marketing, online event planning system and online booking system.
Skip Headers Oracle E-Business Suite Integrated SOA Gateway Developer's Guide Release 12.2 Part Number E20927-12
Content Previou Ne s s t
Using Java APIs as ES! Services Overview !ava "P#s are business inter$a%es based on !ava %lasses. Some spe%iali&ed !ava "P#s '(ose met(ods must use parameters o$ eit(er seriali&able !ava )eans or simple data t*pes su%( as Strin+, #nt, and so $ort( %an be %ate+ori&ed as Java Bean Services. Some !ava %lass provides a%%ess to business lo+i% +overnin+ t(e " rame'ork-based %omponents and pa+es. Su%( !ava %lasses are %alled Application "odule Services and are also %ate+ori&ed as a subt*pe o$ !ava inter$a%e. /o lo%ate t(ese subt*pe o$ !ava inter$a%es, per$orm a sear%( b* spe%i$*in+ #nter$a%e Subt*pe as t(e Cate+or* and !ava )ean Servi%es or "ppli%ation odule Servi%es as t(e Cate+or* alue. )ot( !ava )ean Servi%es and "ppli%ation odule Servi%es %an be eposed as RES/ servi%es onl*. n%e !ava )ean Servi%es or "ppli%ation odule Servi%es (ave been su%%ess$ull* deplo*ed as RES/ servi%es, an inte+ration developer %an invoke t(e deplo*ed RES/ servi%es $rom %lient pro+ram usin+ lan+ua+es like !ava, PHP, !avas%ript, P*t(on, and so on. Using Java Bean Services as t#e ES! Service Invocation E$a%ple /o better understand (o' to use !ava "P#s as RES/ servi%es to $et%( and use appli%ation data, an inter$a%e t*pe o$ !ava )ean Servi%es is used as an eample to eplain detailed desi+n-time and runtime tasks in t(is %(apter. or t(e eample des%ribed in t(e $ollo'in+ se%tions, ra%le !3eveloper 11 g 411.1.1.5.06 is used to %reate a proe%t 'it( a !ava %lass and invoke t(e servi%e. Similar to !ava )ean Servi%es, "ppli%ation odule Servi%es are a subt*pe o$ !ava inter$a%e and %an be eposed as RES/ servi%es 'it( 8E/ and PS/ H//P met(ods. /(ere$ore, t(e servi%e invo%ation $or
"ppli%ation odule Servi%es 'ill use t(e similar approa%( as des%ribed $or !ava )ean Servi%es to invoke t(e "ppli%ation odule RES/ servi%es. /(at is, deplo* an inter$a%e t*pe o$ "ppli%ation odule Servi%es as a RES/ servi%e rst, t(en %reate a se%urit* +rant and re%ord t(e deplo*ed :"3;, t(en %reate a proe%t 'it( a !ava %lass, and t(en invoke t(e RES/ servi%e usin+ a !ava %lass. /(is %(apter in%ludes t(e $ollo'in+ RES/ servi%e invo%ation eamples $or !ava )ean Serviv%es< •
#nvokin+ a RES/ Servi%e =sin+ H//P 8E/ et(od
•
"nnotatin+ and #nvokin+ a Custom !ava )ean Servi%e
Invo&ing a ES! Service Using !!P GE! "et#od ES! Service Invocation Scenario Consider a !ava )ean servi%e >RES/ Servi%e ;o%ator> 4ora%le.apps.$nd.rep.'s.servi%e.EbsRest;o%ator6 as an eample to eplain t(e RES/ servi%e invo%ation. RES/ Servi%e ;o%ator is a sample !ava "P# t(at %onsists o$ met(ods to retrieve details about deplo*ed ra%le E-)usiness Suite RES/ servi%es. " !ava %lient is used to make H//P 8E/ re?uest to t(e +etRest#nter$a%e servi%e operation. /(e +etRest#nter$a%e servi%e operation returns t(e details o$ a RES/ servi%e identied b* its internal name. #n t(is eample, H//P )asi% "ut(enti%ation s%(eme is used to provide username and pass'ord in$ormation in t(e H//P re?uest (eader. /(e user %redentials are aut(enti%ated and aut(ori&ed b* #S8>s RES/ Servi%e Provider. "$ter validation, t(e +etRest#nter$a%e servi%e operation ee%utes t(e re?uest $or t(e aut(enti%ated user. "$ter t(e su%%ess$ul servi%e invo%ation, t(e %lient 'ill re%eive a RES/ response messa+e 'it( t(e details o$ t(e RES/ servi%e '(ose internal name (as been passed in H//P =R; at run time durin+ servi%e invo%ation. Invo&ing a ES! Service Using Java
)ased on t(e RES/ servi%e invo%ation s%enario, t(e $ollo'in+ tasks are in%luded in t(is se%tion< 1. 3eplo*in+ a RES/ Servi%e 2. Creatin+ a Se%urit* 8rant @. Re%ordin+ Resour%e #n$ormation $rom 3eplo*ed :"3; A. Creatin+ a Proe%t 'it( a !ava Class B. #nvokin+ a RES/ Servi%e =sin+ a !ava Class
Deploying a ES! Service =se t(e $ollo'in+ steps to deplo* t(e !ava )ean Servi%e %alled RES/ Servi%e ;o%ator< 1. ;o+ in to ra%le E-)usiness Suite as a user '(o (as t(e #nte+ration "dministrator role. Sele%t t(e #nte+rated S" 8ate'a* responsibilit* and t(e #nte+ration Repositor* link $rom t(e navi+ation menu. 2. #n t(e #nte+ration Repositor* tab, %li%k Searc# to a%%ess t(e main Sear%( pa+e. @. Cli%k S#ow "ore Searc# Optionsto displa* more sear%( elds. Enter t(e $ollo'in+ ke* sear%( values as t(e sear%( %riteria< o Cate+or*< #nter$a%e Subt*pe o Cate+or* alue< !ava )ean Servi%es
A. Cli%k Go to ee%ute t(e sear%(.
Cli%k t(e RES/ Servi%e ;o%ator inter$a%e name link to open t(e inter$a%e details pa+e. B. #n t(e RES/ :eb Servi%e tab, enter t(e $ollo'in+ in$ormation< Deploying a Java API as a ES! Service
o Servi%e "lias< servi%elo%ator
/(e alias 'ill be displa*ed as t(e servi%e endpoint in t(e :"3; and s%(ema $or t(e sele%ted met(od or operation. o Sele%t 3esired Servi%e perations
#n t(e Servi%e perations re+ion, H//P met(od %(e%k boes are presele%ted. Please note t(at i$ a !ava met(od is annotated 'it( a spe%i% H//P met(od, t(en t(e %orrespondin+ H//P met(od %(e%k bo is presele%ted $or t(at met(od. /(e administrator %an %(an+e t(e H//P met(od %(e%k bo sele%tion be$ore deplo*in+ t(e servi%e. or more !ava )ean Servi%es annotation +uidelines, see "nnotations $or !ava )ean Servi%es. #n t(is eample, t(e >+etRest#nter$a%e> servi%e operation (as been annotated 'it( t(e 8E/ H//P met(od t(ere$ore, t(e 8E/ %(e%k bo is automati%all* sele%ted. 5. Cli%k Deploy to deplo* t(e servi%e to an ra%le E-)usiness Suite :eb;o+i% environment. n%e t(e RES/ servi%e (as been su%%ess$ull* deplo*ed, >3eplo*ed> appears in t(e RES/ Servi%e Status eld alon+ 'it( t(e (iew )AD* link. Cli%k t(e (iew )AD* link to vie' t(e deplo*ed servi%e :"3; des%ription. or more in$ormation on deplo*in+ RES/ servi%es, see 3eplo*in+ RES/ :eb Servi%es, Oracle E-Business Suite Integrated SOA Gateway Implementation Guide.
+reating a Security Grant "$ter deplo*in+ t(e RES/ Servi%e ;o%ator as a RES/ servi%e, t(e inte+ration administrator %an %reate a se%urit* +rant to aut(ori&e t(e servi%e or met(od a%%ess privile+es to a spe%i% user, a user +roup, or all users. =se t(e $ollo'in+ steps to %reate a se%urit* +rant<
1. ;o+ in to ra%le E-)usiness Suite as a user '(o (as t(e #nte+ration "dministrator role. Sele%t t(e #nte+rated S" 8ate'a* responsibilit* and t(e #nte+ration Repositor* link $rom t(e navi+ation menu. 2. Per$orm a sear%( to lo%ate t(e RES/ Servi%e ;o%ator servi%e t(e administrator ust deplo*ed earlier. @. #n t(e inter$a%e details pa+e o$ t(e sele%ted %ustom !ava )ean Servi%es, %li%k t(e 8rants tab. A. Sele%t t(e +etRest#nter$a%e met(od %(e%k bo and t(en %li%k +reate Grant. +reating a Security Grant ,or a Selected "et#od
B. #n t(e Create 8rants pa+e, sele%t "ll =ser as t(e 8rantee /*pe.
ote. #n t(is eample, t(e +etRest#nter$a%e servi%e operation is +ranted to all users. #n a%tual implementation, *ou s(ould dene stri%t se%urit* rules. Create +rant to a user or more appropriatel* to a +roup o$ users dened b* roles and responsibilities. +reating t#e Grant to All Users
Cli%k +reate Grant. /(is +rants t(e sele%ted met(od a%%ess privile+e to all ra%le E-)usiness Suite users.
Cop* or re%ord t(e $ollo'in+ in$ormation '(i%( 'ill be used later '(en denin+ a !ava %lient< •
Dresour%es baseF(ttp
•
Dresour%e pat(FG+etRest#nter$a%eGirepClassNameIG /(is in$ormation G+etRest#nter$a%eGirepClassNameIG 'ill be used later to $orm t(e later part o$ t(e servi%e =R;. /(e input irepClassNameI is a pat( variable, and it 'ill be repla%ed 'it( t(e internal name o$ an inter$a%e.
+reating a Pro/ect wit# a Java +lass /(is se%tion des%ribes (o' to %reate a proe%t 'it( a !ava %lass t(at 'ill be used to invoke t(e RES/ Servi%e ;o%ator servi%e. !o create a pro/ect and a Java class. 1. pen ra%le !3eveloper.
2. rom t(e main menu, %(oose 0ile 1 ew. #n t(e Ne' 8aller* 'indo', epand t(e 8eneral %ate+or* and sele%t >"ppli%ations>. #n t(e #tems list, sele%t +usto% Application. +reating a Pro/ect in Oracle JDeveloper
Cli%k O2. /(e Create Custom "ppli%ation - Name *our appli%ation pa+e is displa*ed.
@. Enter an appropriate name $or t(e appli%ation in t(e "ppli%ation Name eld, $or eample #S8!avaRES/Proe%t. Cli%k e$t. A. /(e Create Custom "ppli%ation - Name *our proe%t pa+e is displa*ed. Enter an appropriate name $or t(e proe%t in t(e Proe%t Name eld, $or eample #S8!avaRES/Client. #n t(e Proe%t eatures tab, sele%t > Java> $rom t(e "vailable list. ove t(e sele%ted $eature $rom t(e "vailable 'indo' to t(e Sele%ted 'indo' usin+ t(e ri+(t arro' button. Cli%k e$t. B. Cli%k 0inis# in t(e Con+ure !ava Settin+s dialo+ bo. /(e ne'l* %reated proe%t s(ould be visible in t(e Proe%ts 'orkspa%e. 5. Sele%t and ri+(t-%li%k on t(e proe%t name *ou ust %reated in t(e "ppli%ation Navi+ator and %(oose ew $rom t(e drop-do'n sele%tion menu. 7. #n t(e Ne' 8aller* 'indo', epand t(e 8eneral %ate+or* and sele%t >!ava>. #n t(e #tems list, sele%t +lass. Cli%k O2. Selecting a Java +lass
J. #n t(e Create !ava Class dialo+, %(an+e t(e de$ault %lass name to >Rest#nvo%ation8E/et(od>. "%%ept all ot(er de$aults and %li%k O2.
tr7 @ response = read?ttpesponseCconn M &inall7 @ i& Cconn N= n2ll conn.disconnectC M %%#o( esponse 7stem.o2t.printlnC"esponse is $ Kn" response M %AA A T#is met#od reads response sent b7 t#e server and ret2rns it in a string representation. A% private static tring read?ttpesponseC?ttpU!6onnection conn @ 9np2ttream is rd = n2ll 2&&eredeader = n2ll tring2&&er response = ne( tring2&&erC tr7 @ i& Cconn.getesponse6odeC >= /00 @ is = conn.getErrortreamC M else @ is = conn.get9np2ttreamC M rd = ne( 2&&eredeaderCne( 9np2ttreameaderCis tring line (#ile CCline = rd.read!ineC N= n2ll @ response.appendCline response.appendCLKnL M M catc# C9;Exception ioe @ response.appendCioe.getessageC M &inall7 @ i& Cis N= n2ll @ tr7 @ is.closeC M catc# CException e @ M M i& Crd N= n2ll @ tr7 @ rd.closeC M catc# CException e @ M
M M ret2rn Cresponse.totringC M p2blic static void mainCtringGH args t#ro(s Exception @ tring baseUrl = " http://:/webservices/rest/servicelocator " tring svcUrltr1 = baseUrl "% getRestInterface " %%9nvoe ET service invoeETCsvcUrltr1D "s7sadmin"D "s7sadmin"D "B!O!$F4:B;F9!E" M M
Please note t(at resour%e in$ormation re%orded earlier $rom t(e deplo*ed :"3; is no' pla%ed in t(e base=rl and sv%=rlStr1 elements. P;SK;<N3LPR#;E is t(e inter$a%e internal name and t(at it is assumed to be deplo*ed in t(e instan%e. ote. =se #ttps 4instead o$ (ttp6 in t(e base=rl i$ *our ra%le E-)usiness Suite instan%e is runnin+ on t(e /;S-enabled environment. "dditionall*, *ou need to import t(e /;S %erti%ate into *our %lient !>s ke*store. 10.
Repla%e D(ostname
11.
Save *our 'ork b* sele%tin+ 0ile 1 Save All.
12.
Add re3uired li4rary ,or JSO ,or%at.
=se t(e $ollo'in+ steps to add t(e re?uired librar* le to t(e proe%t properties. a. Sele%t and ri+(t-%li%k on t(e proe%t name *ou ust %reated earlier to open a sele%tion menu. b. Sele%t Pro/ect Properties $rom t(e menu. /(e 3e$ault Properties dialo+ bo opens. %. Sele%t *i4raries and +lasspat#, and %li%k Add *i4rary. /(e "dd ;ibrar* dialo+ bo opens.
d. #n t(e "dd ;ibrar* dialo+ bo, sele%t t(e Proe%t $older and t(en %li%k ew. /(e Create ;ibrar* dialo+ bo opens. e. #n t(e ;ibrar* Name eld, enter >!erse*-bundleL1.0.0.0L1-1-B-1.ar>. Cli%k Add Entry. /(e Sele%t Pat( Entr* dialo+ bo appears. $. #n t(e Sele%t Pat( Entr* dialo+ bo, lo%ate and sele%t t(e >!erse*-bundleL1.0.0.0L1-1-B-1.ar> le t(at *ou (ave do'nloaded. /(is adds it to t(e Classpat(. Cli%k O2. /(e >!erse*-bundleL1.0.0.0L1-1-B-1.ar> is no' added to t(e Proe%t $older. +. /(e Proe%t Properties dialo+ bo appears. Cli%k O2. /(is proe%t is no' set up 'it( t(e re?uired librar*. (eri,ying t#e Added *i4rary
Invo&ing a ES! Service Using a Java +lass "$ter %reatin+ a proe%t 'it( a !ava %lass Rest#nvo%ation8E/et(od.ava, *ou need to %ompile and ee%ute t(e pro%ess to invoke t(e RES/ servi%e.
=se t(e $ollo'in+ steps to %ompile and run t(e !ava %lass< 1. #n t(e "ppli%ation Navi+ator, ri+(t-%li%k on t(e Rest#nvo%ation8E/et(od.ava !ava %lass *ou ust %reated at t(e desi+n time. Sele%t "a&e $rom t(e menu. 2. Ri+(t-%li%k on t(e Rest#nvo%ation8E/et(od.ava !ava %lass. Sele%t un $rom t(e menu. onitor t(is pro%ess and %(e%k $or su%%ess$ul %ompilation in t(e ;o+ 'indo'. eri$* t(at t(e ee%ution is su%%ess$ul in t(e ;o+ 'indo'. e3uest eader In,or%ation #n t(is eample, +etRest#nter$a%e !ava met(od is eposed as a RES/ servi%e operation 'it( 8E/ met(od. /(ere is no input pa*load $or 8E/ met(od. /(e pat( variable irepClassNameI is repla%ed 'it( a%tual value P;SK;<N3LPR#;E sent as part o$ t(e H//P =R; s(o'n belo' '(en t(e +etRest#nter$a%e RES/ servi%e operation is invoked. =R; F (ttp
(iewing Output "essage :(en t(e RES/ servi%e is su%%ess$ull* invoked, t(e $ollo'in+ output in !SN $ormat appears in t(e ;o+ 'indo'< @ ";2tp2tBarameters" $ @ "Ebsesterviceean" $ G @
"alternateIlias" $ "plsl%B!O!$F4:B;F9!E"D "serviceIlias" $ "pro&ile"D '()*(:+N,-'R.+I( "serviceame" $ " "D "(adlUrl" $ "#ttp$%%<#ostname>$%(ebservices%rest%pro&ile3QI4!" M HD "6ontrolean" $ G @ "&ields" $ ""D "&ilter" $ ""D "limit" $ ""D "o&&set" $ "" M H M M
Noti%e t(at t(e servi%e in$ormation identied b* its internal name P;SK;<N3LPR#;E is returned. or eample, t(e :"3; =R;, servi%e name, and servi%e alias are in%luded as part o$ t(e response messa+e.
Annotating and Invo&ing a +usto% Java Bean Service Sin%e not all !ava "P#s re+istered in t(e #nte+ration Repositor* %an be eposed as RES/ servi%es, onl* some spe%iali&ed !ava "P#s des%ribed earlier 'it( proper annotation %an be eposed as RES/ servi%es. /o better understand (o' to annotate t(ose spe%iali&ed !ava "P#s as !ava )ean Servi%es, and (o' to invoke !ava )ean Servi%es 'it( RES/ servi%e se%urit*, t(is se%tion des%ribes t(e entire pro%ess $rom annotatin+ a %ustom !ava "P# to invokin+ t(e servi%e usin+ H//P 8E/ met(od. ES! Service Invocation Scenario /(is eample uses a %ustom !ava "P# %alled Emplo*ee Servi%e 4ora%le.apps.per.sample.servi%e.Emplo*ee#n$o6 to eplain t(e entire annotation and upload pro%esses as 'ell as t(e servi%e invo%ation. /(ere are t'o invo%ation s%enarios. ne s%enario is to +et emplo*ee details, and t(e ot(er one is to +et dire%t reports $or t(e lo++ed in user. /o +et emplo*ee details, an H/; pa+e 'it( !avas%ript is used to make H//P 8E/ re?uest to t(e +etPerson#n$o servi%e operation %ontained in t(e %ustom "P#. "n emplo*ee #3 is provided at run time $or t(e servi%e to retrieve t(e asso%iated emplo*ee name and t(e emplo*ee>s mana+er name. "$ter t(e
su%%ess$ul servi%e invo%ation, t(e emplo*ee details %orrespondin+ to t(e emplo*ee #3 are displa*ed in t(e H/; pa+e. /o +et dire%t reports $or t(e lo++ed in user, a dierent H/; pa+e 'it( !avas%ript is used in t(is s%enario to make H//P 8E/ re?uest to t(e +et3ire%tReports servi%e operation. /(e lo++ed in user %redentials are provided '(en t(e +et3ire%tReports servi%e operation is invoked. "$ter t(e su%%ess$ul servi%e invo%ation, t(e lo++ed in user>s subordinates or t(e user>s dire%t reports are displa*ed in t(e H/; pa+e 'it( t(e re?uested number o$ re%ords s(o'n in ea%( pa+e. High Level Process Flow for Creating Custom Java Bean Services
/o develop %ustom !ava )ean Servi%es, an inte+ration developer needs to %reate and annotate t(e %ustom !ava "P#s based on t(e #nte+ration Repositor* "nnotation Standards $or !ava )ean Servi%es. "$ter t(e inter$a%e %reation, an inte+ration administrator needs to validate t(e annotated "P#s. #$ no error o%%urs durin+ t(e validation, t(e administrator 'ill t(en upload t(e %ustom "P#s to ra%le #nte+ration Repositor* '(ere t(e* %an be publis(ed as RES/ servi%es t(rou+( ra%le E-)usiness Suite #nte+rated S" 8ate'a*. or annotation in$ormation, see< "nnotations $or !ava )ean Servi%es. Annotating and Invo&ing a +usto% Java Bean Service ,ro% !"* Pages wit# Javascript )ased on t(e RES/ servi%e invo%ation s%enario, t(e $ollo'in+ tasks are in%luded in t(is se%tion< 1. Creatin+ and Compilin+ Custom !ava "P#s 2. 3eplo*in+ Custom !ava Classes and Sour%e iles @. Parsin+ and =ploadin+ t(e "nnotated Custom !ava )ean Servi%e to t(e #nte+ration Repositor* A. 3eplo*in+ a Custom !ava )ean Servi%e B. Creatin+ a Se%urit* 8rant
+reating and +o%piling +usto% Java APIs /(is se%tion des%ribes (o' to %reate and annotate a %ustom !ava )ean Servi%e %alled Emplo*ee #n$ormation 4ora%le.apps.per.sample.servi%e.Emplo*ee#n$o6. Guidelines ,or Developing +usto% Java APIs 3urin+ t(e plannin+ sta+e, use t(e $ollo'in+ +uidelines to plan and develop t(e %ustom !ava "P#s t(at 'ill be eposed as RES/ servi%es t(rou+( ra%le E-)usiness Suite #nte+rated S" 8ate'a*< 1. 3evelop a !ava %lass '(ose publi% met(ods provide business $un%tionalit*. )usiness lo+i% s(ould be embedded into t(ese publi% met(ods. o /(e %ustom !ava "P#s and met(od names 'ill be used in :eb servi%e =R;. /(ere$ore, ensure to provide $riendl* names. o #$ *ou need initiali&ed ra%le E-)usiness Suite Contet 'it(in t(e !ava met(od, ensure t(e $ollo'in+<
=se #S8 Contet 4#Contet6 to +et (andle to runtime in$ormation. or eample, #Contet %t F Contetana+er.+etContet46
Retrieve $ull* initiali&ed ra%le E-)usiness Suite :eb"ppsContet based on t(e re?uest (eader G se%urit* token. or eample, :eb"ppsContet '%t F 4:eb"ppsContet6 %t.+etEternalContet46
:eb"ppsContet ma* be used later $or appli%ation spe%i% validation, su%( as ne +rained a%%ess %ontrol. o Oou ma* use t(e ra%le E-)usiness Suite #nte+rated S" 8ate'a* database %onne%tions 'it(in t(e !ava "P#s.
or eample, %onn F 3)Conne%tionana+er.+etConne%tion46 o ra%le E-)usiness Suite #nte+rated S" 8ate'a* provides a standard e%eption (andlin+ $rom t(e in$rastru%ture. Ensure t(at t(e !ava "P#s t(ro' or ret(ro' a t(ro'able e%eption '(enever an error %ondition o%%urs.
2. #$ above !ava met(ods re?uire %omple data obe%ts to be e%(an+ed as input and output parameters, t(en develop !ava )eans. !ava )eans s(ould< o #mplement ava.io.Seriali&able. o Have no-ar+ument %onstru%tor. o Have a%%essor met(ods, $ollo'in+ >+et> and >set> namin+ %onvention, $or private attributes.
+reating +usto% Java APIs #n t(is eample, *ou need a servi%e t(at 'ill return t(e details o$ a spe%i% person in t(e (ierar%(* o$ t(e lo++ed in user, as 'ell as return all t(e reports o$ t(e lo++ed in user. /o a%(ieve t(is +oal, %reate t(e $ollo'in+ !ava les< •
" !ava %lass Emplo*ee#n$o.ava %ontains t(e $ollo'in+ t(ree met(ods. )ased on t(e s%enarios, t(e* are read-onl* met(ods and 'e 'ill map ea%( !ava met(od to H//P 8E/ verb.
o +et"llReports - /(is met(od returns an arra* o$ all reports o$ t(e re?uestin+ user. o +et3ire%tReports - /(is met(od returns a list o$ dire%t reports o$ t(e re?uestin+ user. o +etPerson#n$o - /(is met(od returns t(e person details $or a spe%i% person #d.
/(is met(od re?uires a ke* identier parameter $or Person #d. /(ere$ore, person#d 'ill be annotated as ke*Lparam. ... A Rparam personI Berson 9denti&ier A Rrep$paramin&o @Rrep$re2iredM @Rrep$0e1-paramM ... •
•
" !ava %lass PerServi%eE%eption.ava t(at etends Servi%eE%eption in ra%le E-)usiness Suite #nte+rated S" 8ate'a*. " !ava )ean Person)ean.ava to %apture person in$ormation.
!o create and co%pile custo% Java APIs. =se t(e $ollo'in+ steps to %reate and %ompile %ustom !ava "P#s< 1. pen ra%le !3eveloper. 2. rom t(e main menu, %(oose 0ile 1 ew. #n t(e Ne' 8aller* 'indo', epand t(e 8eneral %ate+or* and sele%t >"ppli%ations>. #n t(e #tems list, sele%t +usto% Application. Cli%k O2. /(e Create Custom "ppli%ation - Name *our appli%ation pa+e is displa*ed. @. Enter an appropriate name $or t(e appli%ation in t(e "ppli%ation Name eld. Cli%k e$t.
A. /(e Create Custom "ppli%ation - Name *our proe%t pa+e is displa*ed. Enter an appropriate name $or t(e proe%t in t(e Proe%t Name eld, $or eample >#S8!avaLRES/3emo>. #n t(e Proe%t eatures tab, sele%t > Java> $rom t(e "vailable list. ove t(e sele%ted $eature $rom t(e "vailable 'indo' to t(e Sele%ted 'indo' usin+ t(e ri+(t arro' button. Cli%k e$t. B. Cli%k 0inis# in t(e Con+ure !ava Settin+s dialo+ bo. /(e ne'l* %reated proe%t s(ould be visible in t(e Proe%ts 'orkspa%e. 5. Add re3uired li4raries. =se t(e $ollo'in+ steps to add t(e re?uired librar* les to t(e proe%t properties. a. Sele%t and ri+(t-%li%k on t(e proe%t name #S8!avaLRES/3emo *ou ust %reated earlier to open a sele%tion menu. b. Sele%t Pro/ect Properties $rom t(e menu. Selecting Pro/ect Properties ,ro% t#e "enu
/22 2 3 sample class to emonstrate how 4ava 3'I can use the I)! R)# framewor05 #his class provies 2 methos to retrieve list of irect reports6 all reports of a person5 It also has methos to 2 retrieve personal etails an accrual balance of a person5 2 7rep:scope public 2 7rep:prouct 'R 2 7rep:ispla1name mplo1ee Information 2 7rep:categor1 IR'-C(3))-)89#' 43;3-93N-)R;IC) 2/ p2blic class Emplo7ee9n&o @ p2blic Emplo7ee9n&oC @ M
s2perC
/22 2 #his metho returns a list of irect reports of the re$uesting user5 2 2 7return (ist of person recors who are irect reports
2 7rep:paraminfo {7rep:innert1pe oracle5apps5per5sample5beans5'erson9ean 2 7rep:scope public 2 7rep:ispla1name !et ,irect Reports 2 7rep:httpverb get 2 7rep:categor1 98)IN))-N#I# sample 2/ %% 4emonstration o& list ret2rn t7pe p2blic !ist get4irecteportsC t#ro(s BererviceException @ %% 5et t#e 95 contextD (#ic# #as r2ntime in&ormation 96ontext ctx = 6ontextanager.get6ontextC %% etrieve &2ll7 initialiJed (ebappscontextD as per t#e re2est #eader % sec2rit7 toen QebIpps6ontext (ctx = CQebIpps6ontext ctx.getExternal6ontextC %% Use (ebappscontext &or apps speci&ic validation e.g. &ine grained access control etc. int 2ser9d = (ctx.getUser9dC tring 2serame = (ctx.getUserameC.toUpper6aseC %% ?ere (e intend to &ilter based on t#e speci&ic 2ser (#o is invoing t#e service tring &ilter = " I4 !ESE! = ) TIT Q9T? UE:IE = $1" !ist person!ist = n2ll tr7 @ ap<9ntegerD Bersonean> map = maeeanC&ilterD 2serame i& Cmap N= n2ll person!ist = ne( Irra7!istCmap.val2esC M catc# CO!Exception sle @ t#ro( ne( BererviceExceptionC"O! error (#ile getting t#e all reports"D sle M ret2rnCperson!ist M
/22 2 #his metho returns an arra1 of all reports of the re$uesting user5 2 2 7return 3rra1 of person recors who are reporting into the re$uesting users organiation hierarch1 2 7rep:scope public 2 7rep:ispla1name !et 3ll Reports 2 7rep:httpverb get 2 7rep:categor1 98)IN))-N#I# sample 2/ %% 4emonstration o& arra7 ret2rn t7pe
%% Use (ebappscontext &or apps speci&ic validation e.g. &ine grained access control etc. int 2ser9d = (ctx.getUser9dC tring 2serame = (ctx.getUserameC.toUpper6aseC %% ?ere (e intend to &ilter based on t#e speci&ic 2ser (#o is invoing t#e service tring &ilter = " TIT Q9T? UE:IE = $1 " BersoneanGH arra7 = n2ll tr7 @ ap<9ntegerD Bersonean> map = maeeanC&ilterD 2serame i& Cmap N= n2ll arra7 = map.val2esC.toIrra7Cne( BersoneanGmap.siJeCH M catc# CO!Exception sle @ t#ro( ne( BererviceExceptionC"O! error (#ile getting t#e direct reports"D sle M ret2rnCarra7 M
/22 2 #his metho returns the person etails for a specific person i5 #hrows error if the person 2 is not in re$uesting users org hierarch15 2 2 7return ,etails of a person in the logge on users org hierarch15 2 7param personI 'erson Ientifier 2 7rep:paraminfo {7rep:re$uire {7rep:0e1-param 2 7rep:scope public 2 7rep:ispla1name !et 'erson ,etails 2 7rep:httpverb get 2 7rep:categor1 98)IN))-N#I# sample 2/ %% 4emonstration o& simple navigation 2sing pat# param p2blic Bersonean getBerson9n&oCint person9dt#ro(s BererviceException @
%% 5et t#e 95 contextD (#ic# #as r2ntime in&ormation 96ontext ctx = 6ontextanager.get6ontextC %% etrieve &2ll7 initialiJed (ebappscontextD as per t#e re2est #eader % sec2rit7 toen QebIpps6ontext (ctx = CQebIpps6ontext ctx.getExternal6ontextC %% Use (ebappscontext &or apps speci&ic validation e.g. &ine grained access control etc. int 2ser9d = (ctx.getUser9dC tring 2serame = (ctx.getUserameC.toUpper6aseC tring &ilter = " TIT Q9T? UE:IE = $1 " ap<9ntegerD Bersonean> map = n2ll tr7 @ map = maeeanC&ilterD 2serame M catc# sle @ t#ro( CO!Exception ne( BererviceExceptionC"O! error (#ile getting t#e direct reports"D sle M i& Cmap == n2ll t#ro( ne( BererviceExceptionCBererviceException.IUT?;9IT9;:FI9!UED "o org #ierarc#7 &o2nd &or 2ser - " 2serameD n2ll boolean doesExist = map.containse7Cperson9d i& CNdoesExist t#ro( ne( BererviceExceptionCBererviceException.IUT?;9IT9;:FI9!UED "T#e given person " person9d " eit#er does not exist or does not belong to t#e c2rrent 2serLs - " 2serame " #ierarc#7"D n2ll Bersonean bean = map.getCperson9d ret2rnCbean M %AAAAAAAAAAAAAAAAAAAAAAAAA private members AAAAAAAAAAAAAAAAAAAAAAAAAAAA% private ap<9ntegerD Bersonean> maeeanCtring slFilterD tring 2serame t#ro(s O!Exception @ 6onnection conn = n2ll ;racleBreparedtatement stmt = n2ll ;raclees2ltet rs = n2ll ?as#ap<9ntegerD Bersonean> personap = ne( ?as#ap<9ntegerD Bersonean>C 96ontext ctx = 6ontextanager.get6ontextC
o Save *our 'ork b* sele%tin+ 0ile 1 Save All. o Sele%t and ri+(t-%li%k on t(e proe%t name #S8!avaLRES/3emo and %(oose "a&e Pro/ect89/pr $rom t(e drop-do'n sele%tion menu. /(e %ompilation pro%ess starts.
eri$* t(at t(e %ompilation pro%ess is su%%ess$ul in t(e essa+e - ;o+ 'indo'.
Deploying +usto% Java +lasses and Source 0iles
n%e t(e %ustom !ava "P# (as been su%%ess$ull* %reated, t(e inte+ration developer needs to %op* t(ese ne'l* %reated !ava %lasses and sour%e les to a tar+et instan%e. or in$ormation on (o' to deplo* t(ese %ustom !ava %lasses, re$er to Se%tion B< 3eplo*in+ Custom "ppli%ation /ier be%ts, 3eplo*in+ Customi&ations in ra%le E-)usiness Suite Release 12.2, * ra%le Support no'led+e 3o%ument 1B77551.1. "$ter t(e su%%ess$ul deplo*ment to a tar+et instan%e, stop and restart t(e mana+ed server.
Parsing and Uploading t#e Annotated +usto% Java Bean Service to t#e Integration epository n%e t(e %ustom !ava %lasses (ave been su%%ess$ull* deplo*ed to a tar+et instan%e, t(e inte+ration administrator needs to validate t(e annotated %ustom inter$a%e denition Emplo*ee #n$ormation a+ainst t(e annotation standards $or !ava )ean Servi%es usin+ #nte+ration Repositor* Parser. 3urin+ t(e validation, i$ no error o%%urs, an i;3/ le 'ill be +enerated. /(e administrator 'ill t(en upload t(e +enerated i;3/ le to ra%le #nte+ration Repositor*. Per$orm t(e $ollo'in+ steps to parse and upload t(e annotated %ustom inter$a%e denition Emplo*ee #n$ormation to ra%le #nte+ration Repositor*< 1. Sour%e t(e environment in t(e run le s*stem and set C;"SSP"/H to in%lude all libraries and !"R les used b* t(e %ustom !ava "P#. 2. Ensure t(e annotated %ustom inter$a%e denition and related !ava %lasses are lo%ated in t(e tar+et instan%e. (eri,ying t#e Annotated +usto% Inter,ace De:nition
Noti%e t(at t(e upload pro%ess (as been %ompleted su%%ess$ull*. 7. Sear%( t(e uploaded %ustom !ava Servi%e )eans inter$a%e Emplo*ee #n$ormation $rom t(e #nte+ration Repositor*. Cli%k t(e Emplo*ee #n$ormation name link to open t(e inter$a%e details pa+e.
Deploying a +usto% Java Bean Service =se t(e $ollo'in+ steps to deplo* t(e %ustom inter$a%e as a RES/ servi%e< 1. ;o+ in to ra%le E-)usiness Suite as a user '(o (as t(e #nte+ration "dministrator role. Sele%t t(e #nte+rated S" 8ate'a* responsibilit* and t(e #nte+ration Repositor* link $rom t(e navi+ation menu. 2. #n t(e #nte+ration Repositor* tab, %li%k Searc# to a%%ess t(e main Sear%( pa+e. @. Cli%k S#ow "ore Searc# Optionsto displa* more sear%( elds. Sele%t >Custom> in t(e #nter$a%e Sour%e eld. A. Cli%k Go to ee%ute t(e sear%(. Cli%k t(e Emplo*ee #n$ormation inter$a%e name link to open t(e inter$a%e details pa+e. B. #n t(e RES/ :eb Servi%e tab, enter t(e $ollo'in+ in$ormation< o Servi%e "lias< empin$o
/(e alias 'ill be displa*ed as t(e servi%e endpoint in t(e :"3; and s%(ema $or t(e sele%ted met(od or operation.
5. Cli%k Deploy to deplo* t(e servi%e to an ra%le E-)usiness Suite :eb;o+i% environment. n%e t(e RES/ servi%e (as been su%%ess$ull* deplo*ed, >3eplo*ed> appears in t(e RES/ Servi%e Status eld alon+ 'it( t(e (iew )AD* link. Cli%k t(e (iew )AD* link to vie' t(e deplo*ed servi%e :"3; des%ription. or more in$ormation on deplo*in+ RES/ servi%es, see 3eplo*in+ RES/ :eb Servi%es, Oracle E-Business Suite Integrated SOA Gateway Implementation Guide.
+reating a Security Grant "$ter deplo*in+ t(e %ustom inter$a%e Emplo*ee #n$ormation as a RES/ servi%e, t(e inte+ration administrator %an %reate a se%urit* +rant to aut(ori&e t(e servi%e a%%ess privile+es to all users. =se t(e $ollo'in+ steps to %reate a se%urit* +rant< 1. ;o+ in to ra%le E-)usiness Suite as a user '(o (as t(e #nte+ration "dministrator role. Sele%t t(e #nte+rated S" 8ate'a* responsibilit* and t(e #nte+ration Repositor* link $rom t(e navi+ation menu. 2. Per$orm a sear%( to lo%ate t(e Emplo*ee #n$ormation servi%e t(e administrator ust deplo*ed earlier. @. Sele%t t(e Emplo*ee #n$ormation name link $rom t(e sear%( result table to displa* t(e inter$a%e details pa+e. Cli%k t(e 8rants tab. A. Sele%t t(e Emplo*ee #n$ormation servi%e and t(en %li%k +reate Grant. B. #n t(e Create 8rants pa+e, sele%t "ll =sers as t(e 8rantee /*pe.
ote. #n t(is eample, t(e Emplo*ee #n$ormation servi%e is +ranted to all users. #n a%tual implementation, *ou s(ould dene stri%t se%urit* rules. Create +rant to a user or more appropriatel* to a +roup o$ users dened b* roles and responsibilities. Cli%k +reate Grant. /(is +rants t(e sele%ted servi%e a%%ess privile+e to all ra%le E-)usiness Suite users.
Dresour%e pat(FG+etPerson#n$oG
Note t(at
Dresour%e pat(FG+et3ire%tReportsG /(is in$ormation G+et3ire%tReportsG 'ill be used later to $orm t(e later part o$ t(e servi%e =R;.
Invo&ing a +usto% ES! Service ,ro% !"* Using Javascript /(is eample %ontains t'o invo%ation s%enarios< 1. 8et emplo*ee personal in$ormation b* invokin+ +etPerson#n$o RES/ servi%e operation 2. 8et dire%t reports $or t(e lo++ed in user b* invokin+ +et3ire%tReports RES/ servi%e operation 'it( pa+ination %ontrol parameter Scenario 8. Get E%ployee Personal In,or%ation =se t(e $ollo'in+ steps to invoke t(e deplo*ed +etPerson#n$o RES/ servi%e operation< 1. Create an H/; le usin+ an* tet editor 'it( t(e $ollo'in+ %ontent< ). +. <#tml> /. <#ead> . ;racle E-2siness 2ite 9ntegrated ;I 5ate(a7 - ET ervices ample<%title> . <meta #ttp-e2iv="6ontent-T7pe" content="text%#tml c#arset=UTF-8"> W. 8. tableDt#Dtd *. @ 10. border$1px solid blac 11. border-collapse$collapse 1). M 1+. t#Dtd 1/. @ 1. padding$px
M <%st7le <script lang2age="&avascript"> &2nction getEmp4etailsC @ varxml#ttp i& C(indo(.,!?ttpe2est @%% code &or 9EWD Fire&oxD 6#romeD ;peraD a&ari xml#ttp=ne( ,!?ttpe2estC M else @%% code&or9ED 9E xml#ttp=ne( Ictive,;b'ectC"icroso&t.,!?TTB" M
+0. +1. +). ++. +/. +.
xml#ttp.onread7statec#ange=&2nctionC @ i& Cxml#ttp.read7tate==/ VV xml#ttp.stat2s==)00 @ var det = evalC "C" xml#ttp.responseText "" doc2ment.getElement79dCLdiv1L.inner?T!=det.;2tp2tBarameters.BersoneanG0H.&2llame
+. +W. +8. +*. /0. /1.
doc2ment.getElement79dCLdiv)L.inner?T!=det.;2tp2tBarameters.BersoneanG0H.s2pervisorF2llame M M var empno = doc2ment.getElement79dC"empno" var 2rl = "#ttp$%%<#ostname>$%(ebservices%rest%empin&o% get'ersonInfo%" empno.val2e
/(e pat( parameter
ie' t(e H/; pa+e in a bro'ser 'indo'.
Invo&ing t#e Service !#roug# t#e !"* Page
7@. Enter an Emplo*ee #3 4pat( parameter person#dI6, su%( as 1@1@7, in t(e H/; pa+e and %li%k Get Details. /(is invokes t(e +etPerson#n$o RES/ servi%e operation and returns t(e asso%iated emplo*ee>s name and (is or (er mana+er>s name. #n t(is eample, /a*lor, r. Steve '(o (as t(e emplo*ee #3 1@1@7 is displa*ed as t(e Emplo*ee Name )ennett, /erren%e 8 4/err*6 '(o is /a*lor>s mana+er is displa*ed as ana+er Name. Displaying t#e E%ployee Personal In,or%ation
Scenario >. Get Direct eports ,or t#e *ogged in User =se t(e $ollo'in+ steps to invoke t(e deplo*ed +et3ire%tReports RES/ servi%e operation< 1. Create an H/; le usin+ an* tet editor 'it( t(e $ollo'in+ %ontent< ). +. <#tml> /. <#ead>
i&Cx.lengt# == / @ doc2ment.getElement79dC"div+".inner?T!="" *0. M *1. else *). @ *+. doc2ment.getElement79dC"div+".inner?T!="" */. M *. *. *W. M *8. M **. 100. var 2rl = "#ttp$%%<#ostname>$%(ebservices%rest%empin&o% get,irectReports %3 ctx:orgid=)0/Vlimit=?offset " o&&setB 101. 10). xml#ttp.openCL5ETLD2rlDtr2e 10+. xml#ttp.sete2est?eaderC" 3ccept"D "application/%ml " 10/. xml#ttp.sendC 10. M 10. <%script> 10W. <%#ead> 108. 10*.
<#1>;racle E-2siness 2ite 9ntegrated ;I 5ate(a7 - ET ervices ample<%#1> 110. <#)>Bagination 6ontrol Barameters Example<%#)> 111. <%center> 11). <#+>T#is example demonstrates t#e 2se o& Bagination 6ontrol Barameters. Q#en 7o2 clic 5et 4irects b2ttonD 95 ET ervice (ill be invoed. Brovide E 2sername 11+. and pass(ord. ;n s2ccess&2l invocationD t#e &irst + direct reports Cemplo7ees o& t#e logged in 2ser (ill be displa7ed. ext and Brevio2s b2ttons (ill be displa7ed 11/. based on t#e n2mber o& records. 11. <%#+> 11.
11W. 118.
<%div> 1)0.
1). %%--><%script> 1). 1)W. <%bod7> <%#tml>
/(is invo%ation s%enario uses pa+ination %ontrol parameter o?set dened in t(e !avas%ript to limit t(e number o$ re%ords returned at run time and $or pa+ination '(en +et3ire%tReports servi%e operation is invoked t(rou+( H//P 8E/ re?uest. <script lang2age="'avascript"> ... var 2rl = "#ttp$%%<#ostname>$%(ebservices%rest%empin&o% ctx:orgid=)0/Vlimit=?offset " o&&setB
get,irectReports %3
xml#ttp.openCL5ETLD2rlDtr2e xml#ttp.sete2est?eaderC"3ccept"D "application/%ml " xml#ttp.sendC M <%script>
/(is eample sets "%%ept (eader in t(e 8E/ re?uest. RES/ servi%e returns response messa+e is in M; $ormat. 12J.
ie' t(e H/; pa+e in a bro'ser 'indo'.
Invo&ing t#e Service !#roug# t#e !"* Page
129. Cli%k Get Directs in t(e H/; pa+e. /(is invokes t(e +etPerson#n$o RES/ servi%e operation. " pop-up 'indo' appears re?uirin+ *ou to enter t(e username and pass'ord. "$ter *ou entered t(e username and pass'ord and %li%kedO2, t(e servi%e returns t(e rst @ dire%t reports 4emplo*ees6 o$ t(e user *ou ust entered in t(e table. Cli%k e$t to displa* t(e net @ re%ords retrieved $rom t(e dire%t reports list. Cli%k Previous to displa* t(e last @ re%ords $rom t(e %urrent dire%t reports list. Displaying Direct eports as t#e esults
Contents Previous /op o$ Pa+e Net Cop*ri+(t T 200J, 2017, ra%le andGor its aUliates. "ll ri+(ts reserved.