Sie sind auf Seite 1von 2

PROCEDURE FOR CREATING WEB SERVICES IN NETBEANS 1. Create new project a.

NewProjectJavaEEEJBModule Next Give project name Finish . Create new we! service a. "i#ht clic$ the created project nameNew%e! &erviceGive name 'or we! service and pac$a#eFinish !. ( new 'older named )%e! &ervices* will !e created under the project 'older. +nside that, new we! services will !e created. -. Creatin# 'unctions 'or we! service a. .nder the %e! &ervices 'older, ri#ht clic$ the we! service created(dd operation i. Give appropriate name 'or the operation /here 'unction can !e named as )add* to per'orm sum o' two num!ers0. ii. &elect the return t1pe o' the 'unction /here )int*0. iii. (ddin# parameters2 1. Clic$ (dd#ive name o' the parameter and their data t1pe . Follow the a!ove step to add more parameters. /3wo parameters should !e added each o' t1pe int to per'orm addition0. iv. Clic$ 45. 6. %rite the re7uired operation8statements /modi'1 as )return /i9j0* 'or add 'unction0 inside the 'unction and also see to that the return t1pe matches. &ave the 'ile. :. ;eplo1in# and testin#2 a. "i#ht clic$ the project;eplo1. !. +n the %e! &ervices 'older, ri#ht clic$ on 1our we! service3est %e!&ervice. CLIENT: 1. Create new project2 a. FileNew ProjectJava %e!%e! (pplicationNext#ive a nameFinish. . ( 'ile names index.jsp will !e created. Modi'1 the code as !elow2 <!od1= <'orm name>*'orm1* action>*su!.jsp* method>*#et*= Enter no.1 <input t1pe>*text* name>*n1*8=<!r= Enter no. <input t1pe>*text* name>*n *8=<!r= <input t1pe>*su!mit* value>*(dd*8= <8'orm= <8!od1=

-. "i#ht clic$ the created projectNewJ&P#ive name /su!.jsp0Finish. 6. Create %e! &ervice Client2 a. "i#ht clic$ the created projectNew%e! &ervice Client. !. Enter the %&;? ."?. @ou can #et the %&;? ."? !1 the 'ollowin# steps2 i. +n the 'irstl1 created EJB Module project, ri#ht clic$ 1our we! service under the %e! &ervices 'olderProperties ii. ( ."? will !e displa1ed. Cop1 it and paste it in the %&;? ."? 'ield. c. Clic$ Finish. :. "i#ht clic$ the su!.jsp 'ile in the editor%e! &ervice Client "esourcesCall %e! &ervice 4perationA +n the dialo# !ox that opens, clic$ the B9C si#n until 1ou #et the re7uired operationclic$ 45. 3he code 'or #eneratin# %e! &ervice operation will !e #enerated. D. Modi'1 the J&P 'ile to have the 'ollowin# content2 int i > +nte#er.parse+nt/re7uest.#etParameter/En1E00F int j > +nte#er.parse+nt/re7uest.#etParameter/En E00F G. "i#ht clic$ the %e! (pplication project;eplo1. H. "i#ht clic$ the %e! (pplication project"un. I. index.jsp 'ile will !e displa1ed. Give appropriate inputs and clic$ )&u!mit*. 1J. 3he result will !e displa1ed.

Das könnte Ihnen auch gefallen