:::: MENU ::::

Friday, January 24, 2014

1.creating web service:

1.1 Open netbeans -->file --> new project--> in java web select “web application “-->give project name as “markwebservice” -->select server as “apache tomcat” -->finish
1.2 In the project window(if project window is no there in the right side, select the window from menu bar and click projects) right click the project we created just now (markwebservice) -->new--> web service -->give Web Service Name as (markwebservice) and give package as ( webservice.markwebservice) --> finish
1.3 Now go to the project window , in the markwebservice project (project we created just now) expand the folder Web Services and right click the markwebservice file and select add operation -->now give name as total , Return Type as int , and add the subjects(wt,pcd,nm) with int data type --> ok
1.4 Now the “markwebservice.java” file will look like shown below
Now change “return 0;” to “return (wt+pcd+nm);
Note: wt,pcd,nm are the subject name you given in step 1.3
1.5 Right click markwebservice project -->properties-->run-->In the Relative URL field type “/MarkWS?Tester”-->ok
Now your web service is created..!!!!

2. Adding Java Client to Web Service

2.1 File-->new project-->in java select “java application”-->give the project name as “markjavaclient”-->finish
2.2 Right Click the project “markjavaclinet”-->new-->WebServiceClient--> in the pop up window browse the project “markwebservice” expand it and select “markwebservice”-->ok. Type the package name as” webservice.markwebservice” as given in Step 1 --> finish
2.3 Right click “markjavaclient” source code -->insert code-->Call Web Service Operation-->now expand markjavaclient until we reach total -->ok
2.4 Now the file will look as shown below
Make changes as shown below
2.5 Right click markjavaclient project and run to get desired output..!!!!
Categories: ,

2 comments: