BlogJava 首頁 新隨筆 聯系 聚合 管理
            37 Posts :: 64 Stories :: 21 Comments :: 0 Trackbacks
          Setting up
          1. Set up the installed JRE in eclipse (Windows -> Preferences -> Java -> Installed JREs)

           

           

          1. Set up the installed runtime for server in eclipse (Windows -> Preferences -> Server -> Installed Runtimes)

           

           

          1. Set up the Server view in eclipse (Windows -> Show View -> Other)

           

          1. Set up the Tomcat Server by right clicking and selecting New -> Server option from the Server view in eclipse

           

           

           

          ?span style="font:7.0pt "Times New Roman"">         Creating a Web service

          1. Create a new Dynamic Web Project in eclipse (File -> New -> Other)

           

          1. Enter name as 揥ebServiceTutorial? select project location as 揈:"Test? and select Apache Tomcat v5.5 as the Target server.

           

          1. Now create a new Java class from the Project Explorer (Dynamic Web Projects -> Java Source -> New -> Class)

           

           

          1. Enter name as 揌ello?and package as 揷om.tutorial?

           

          1. Add a simple method in the 揌ello?class as below.

                      public String sayHello(String name){

                                  return "Hello " + name;

                      }            

               

           

          1. Save and build the project.
          2. Create a new Web service in eclipse (File -> New -> Other)

           

          1. Select Generate a proxy.
          2. Select Test the Web service.
          3. Select Overwrite files without warning.

           

          1. Select or enter the Bean name as 揷om.tutorial.Hello? This is the java class that we just now created.

           

          1. Continue the wizard by clicking Next and finish.
          2. On Finish, the Tomcat server starts up and launches the Test client.
          3. Verify the generated contents. Look for Hello.class and the generated JSPs as below.

           

           

          1. Verify the Tomcat folder and ensure the newly created web applications ? WebServiceTutorial, WebServiceTutorialClient.

           

           

          1. We can also run the following url from the browser to access/test the Web service.

          http://localhost:8080/WebServiceTutorialClient/sampleHelloProxy/TestClient.jsp

          1. If servlet error 搊rg.eclipse.jst.ws.util.JspUtils cannot be resolved or is not a type?is thrown on the browser, then copy the webserviceutils.jar file from the E:"Eclipse3.1"eclipse"plugins"org.eclipse.jst.ws.consumption_0.7.0 into the WEB-INF"lib folder of the WebServiceTutorialClient application and restart the Tomcat server.
          1. The browser displays the methods available in the web service.

           

          1. Click on the sayHello(..) method, enter your name (for e.g. 揓eeva? in the inputs section and click 揑nvoke?

           

           

          1. The browser greets using the web service.

           

          1. The WSDL for the Hello Web service can be found in E:"Test"WebServiceTutorial"WebContent"wsdl"Hello.wsdl. On double-click, the WSDL opens in a graphical editor.

           

           

          1. Right-click on the WSDL file and explore the options to test the web service / publish the WSDL file / generate client / etc.

           

          posted on 2009-10-10 09:57 xiachang88 閱讀(366) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 绥化市| 广安市| 密云县| 汉川市| 垫江县| 大田县| 湖州市| 剑阁县| 大名县| 临猗县| 抚州市| 桐柏县| 丹巴县| 三穗县| 凤冈县| 琼海市| 建宁县| 阿尔山市| 土默特右旗| 辽宁省| 大名县| 页游| 泰顺县| 遵化市| 普格县| 沈阳市| 米脂县| 英山县| 黑龙江省| 黔南| 龙岩市| 简阳市| 崇礼县| 平果县| 子长县| 高碑店市| 大理市| 新竹市| 尚义县| 泊头市| 页游|