锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精华国产精华精华液好用,亚洲AV无码国产精品永久一区,亚洲AV无码一区二区三区网址http://m.tkk7.com/yjlongfei/category/41623.htmlzh-cnSun, 18 Oct 2009 01:31:27 GMTSun, 18 Oct 2009 01:31:27 GMT60MyEclipse6.5涓婂熀浜嶫AX-WS寮鍙慦ebservice(涓枃紺轟緥)http://m.tkk7.com/yjlongfei/archive/2009/10/17/298714.html蹇椿鏋楅┛绔?/dc:creator>蹇椿鏋楅┛绔?/author>Sat, 17 Oct 2009 14:50:00 GMThttp://m.tkk7.com/yjlongfei/archive/2009/10/17/298714.htmlhttp://m.tkk7.com/yjlongfei/comments/298714.htmlhttp://m.tkk7.com/yjlongfei/archive/2009/10/17/298714.html#Feedback0http://m.tkk7.com/yjlongfei/comments/commentRss/298714.htmlhttp://m.tkk7.com/yjlongfei/services/trackbacks/298714.html鍏抽敭瀛? webservice

1. Introduction
This document will outline the process of developing a JAX-WS web service and deploying it using MyEclipse 6.5 to the internal MyEclipse Tomcat server. The web service used in this tutorial will be a very simple calculator service that provides add, subtract, multiply and divide operations to the caller.

MyEclipse also supports developing web services using the existing XFire framework from previous MyEclipse releases. For folks needing to develop and deploy WebSphere JAX-RPC or WebSphere JAX-WS web services, please take a look at our MyEclipse Blue Edition of the MyEclipse IDE.

Additional resources covering web service creation using JAX-RPC, JAX-WS or XFire are included in the Resources section of this document.


2. System Requirements
This tutorial was created with MyEclipse 6.5. If you are using another version of MyEclipse (possibly newer), most of these screens and instructions should still be very similar.

If you are using a newer version of MyEclipse and notice portions of this tutorial looking different than the screens you are seeing, please let us know and we will make sure to resolve any inconsistencies.

3.鏂板緩涓涓伐紼?
寮濮嬫垜浠柊寤轟竴涓猈eb Service Project宸ョ▼File->New->Web Service Project(Optional Maven Support)

 
Note:A JAX-WS web service can also be generated in any existing Java EE 5 web project.

鎴戜滑緇欒繖涓伐紼嬪彇鍚嶄負WebServiceProject.娉ㄦ剰JAX-WS鏀寔鍙湪javaEE5鎴栨洿楂樼増鏈殑宸ョ▼涓槸鍙鐨勩傚鏋滀綘闇瑕佷嬌鐢ㄤ綆鐗堟湰鐨勫伐紼嬬被鍨?java1.4鎴栬?.3)錛岄偅涔堝彧鑳戒嬌鐢╔Fire Web Service浠f浛JAX-WS銆?

 

榪欓噷鎴戜滑浣跨敤涓婇潰鐨凧AX鈥擶S銆?
4.鍒涘緩鏈嶅姟綾?
鏈嶅姟綾誨氨鏄竴涓櫘閫氱殑java綾伙紝璐熻矗鎻愪緵鎴戜滑鎯寵鍙戝竷鐨勬墽琛屾柟娉曘傝繖閲屾垜浠啓涓涓畝鍗曠殑璁$畻鍣ㄧ被錛屽疄鐜板嚑涓吀鍨嬬殑璁$畻鍣ㄥ簲鐢ㄦ柟娉曪紝濡傚姞鍑忎箻闄ゃ?
棣栧厛鎴戜滑鍏堝緩涓涓寘錛學ebServiceProject->src->new->package,鍙栧悕com.myeclipseide.ws

璁╁悗鎴戜滑鍦ㄨ繖涓寘涓嬪緩涓涓被,Calculator.java.


鏍規嵁涓婇潰鎻愬埌鐨勶紝榪欎釜璁$畻鍣ㄧ被瀹炵幇璁$畻鍣ㄧ殑鍔犲噺涔橀櫎綆楁硶錛岀畝鍗曞疄鐜幫細
Java浠g爜

package com.myeclipseide.ws; 

public class Calculator 
public int add(int a, int b) 
return (a + b); 
}
 

public int subtract(int a, int b) 
return (a - b); 
}
 

public int multiply(int a, int b) 
return (a * b); 
}
 

public int divide(int a, int b) 
return (a / b); 
}
 
}
 


鍙互鐪嬪嚭錛岃繖涓被涓殑鏂規硶鏄潪甯哥畝鍗曠殑錛屾病鏈夌敤鍒扮壒孌婄殑娉ㄩ噴榪樻湁鎺ュ彛錛岀埗綾諱箣綾葷殑涓滆タ銆?
5.鍒涘緩涓涓猈eb Service
鍦ㄤ笂闈㈢殑宸ュ叿鏉′腑鐐瑰嚮鏂板緩Web Service

Note錛氬鏋滄病鏈夌殑璇濆彲浠ile->New->others->Myeclipse->WebService->webService
鐐瑰嚮涔嬪悗鍑虹幇鐨勫睆騫曪紝鍦⊿trategy涓夋嫨Bottom-up scenario錛屽洜涓烘垜浠凡緇忓緩绔嬪ソ浜咰alculator綾昏屼笖鎯蟲牴鎹畠寤虹珛JAX-WS鏈嶅姟銆?br />

涓嬮潰鏄垱寤虹殑鏈鍚庝竴涓睆騫曪紝浣犻渶瑕侀夋嫨鎻愪緵webService鏂規硶鐨刯avaBean錛屽湪鎴戜滑榪欎釜渚嬪瓙涓氨鏄垜浠凡緇忓緩绔嬪ソ鐨凜alculator綾匯?br />

濉ソ涔嬪悗錛孧yeclipse浼氳嚜鍔ㄥ府鎴戜滑濉弧鍏朵粬鐨勯」錛孲elect Generate WSDL in project and hit Finish.


鐐瑰嚮瀹屾垚涔嬪悗錛孧yeclipse浼氳嚜鍔ㄧ敓鎴怌alculatorDelegate浠g悊綾伙紝榪樻湁涓浜涘繀欏葷殑JAX-WS鎻忚堪絎︼紝鑰屼笖浼氳嚜鍔ㄥ湪鏈嶅姟鍣ㄧ洰褰曚笅鐨剋eb.xml涓厤緗甒ebService鐨勪竴浜沵appings錛屾柟渚垮皢webService閮ㄧ講鍒版湇鍔″櫒涓?

鍒版web service宸茬粡寤虹珛濂戒簡錛屾垜浠紑濮嬮儴緗插畠鐒跺悗榪涜嫻嬭瘯銆?
6.閮ㄧ講鍜屾祴璇晈ebService銆?
榪欓噷鎴戜滑涓嶄嬌鐢ㄧ敤Myeclipse鑷甫鐨則omcat鏈嶅姟鍣紝浣跨敤鑷繁搴旂粡鍦ㄧ數鑴戜腑閮ㄧ講濂界殑tomcat5.5銆?
鍦╯erver闈㈡澘涓彸鍑伙紝閫夋嫨configure


閮ㄧ講鑷繁鐨則omcat娉ㄦ剰閫夋嫨jdk瑕佽窡欏圭洰涓殑鐩稿悓銆?

鐜板湪瑕佸悜宸ョ▼涓鍏AX-WS鐨刯ar鍖?
鍦ㄩ」鐩悕縐頒笂鍙沖嚮->properties->Add Library->Myeclipse Libraries->鏈鍚庨潰鐨勪袱涓?

鐐瑰嚮瀹屾垚錛屽鍏ユ垚鍔熴?
Note錛歁yeclipse鑷甫鐨則omcat涓湁鑷甫鐨勮繖涓や釜jar鍖咃紝鍙互涓嶇敤瀵煎叆銆?

6.1閮ㄧ講
鍦ㄩ儴緗插ソ鐨則omcat鏈嶅姟鍣ㄤ笂鍙沖嚮閫夋嫨Add Deployment


鐐瑰嚮瀹屾垚銆?
6.2嫻嬭瘯
榪愯tomcat鏈嶅姟鍣紝鍦ㄥ伐鍏鋒爮涓偣鍑籰aunch WebService Explorer

鎵撳紑鍚庯紝鐐瑰嚮鍙充笂瑙掔殑WSDL瑙嗗浘錛屽彲浠ョ湅鍒頒笅闈㈢殑灞忓箷

鍦╓SDL URL涓~鍐欒礬寰勶細http://localhost:8888/WebServiceProject/CalculatorPort?WSDL
瑙i噴涓嬭礬寰勭粍鎴愶細
http://localhost:8888/鏄湇鍔″櫒鐨勮礬寰勶紝鎴戠殑绔彛鍙鋒槸8888錛屽彲浠ユ牴鎹嚜宸辯殑鏇存敼錛屼竴鑸兘鏄?080銆?
/WebServiceProject = We know by default the Web Context-root that is used to deploy(閮ㄧ講) web projects matches the name of the projects. (鍥犱負鎴戜滑娌℃湁涓鴻繖涓伐紼嬭嚜瀹氫箟鎴戜滑鐨刉eb Context-root錛屾墍浠ヤ粬灝辨槸榪欎釜宸ョ▼鐨勫悕瀛?
/CalculatorPort = As we saw from the last screenshot in Section #5, when our JAX-WS web service was generated, it was bound using a servlet-mapping in the web.xml file to the /CalculatorPort path.
XML浠g爜
  

<servlet>     
    
<description>JAX-WS endpoint - CalculatorService</description>     
    
<display-name>CalculatorService</display-name>     
    
<servlet-name>CalculatorService</servlet-name>     
    
<servlet-class>     
        com.sun.xml.ws.transport.http.servlet.WSServlet      
    
</servlet-class>     
    
<load-on-startup>1</load-on-startup>     
  
</servlet>     
  
<servlet-mapping>     
    
<servlet-name>CalculatorService</servlet-name>     
    
<url-pattern>/CalculatorPort</url-pattern>     
  
</servlet-mapping>    
<servlet>  
    
<description>JAX-WS endpoint - CalculatorService</description>  
    
<display-name>CalculatorService</display-name>  
    
<servlet-name>CalculatorService</servlet-name>  
    
<servlet-class>  
        com.sun.xml.ws.transport.http.servlet.WSServlet   
    
</servlet-class>  
    
<load-on-startup>1</load-on-startup>  
  
</servlet>  
  
<servlet-mapping>  
    
<servlet-name>CalculatorService</servlet-name>  
    
<url-pattern>/CalculatorPort</url-pattern>  
  
</servlet-mapping>

 WSDL = This is a universal query string argument that can be added to the end of any web service which will tell the web service to return it's full WSDL to the caller. In this case, the WSDL is returned to our Web Services Explorer tool which loads it up, and displays the web services exposed operations to us.
寮勬竻妤氫箣鍚庯紝鎴戜滑寮濮嬫祴璇曪紝姣斿鎴戜滑閫夋嫨add鏂規硶錛?
濉啓args錛岀偣鍑籫o錛屽湪status涓氨浼氭樉紺虹粨鏋溿?nbsp; 

緇撴灉鏄紜殑銆?
7.鍒涘緩Webservice Client
鐜板湪鎴戜滑宸茬粡閮ㄧ講濂絎ebservice錛岃屼笖搴旂粡嫻嬭瘯榪囦簡錛岄偅鎴戜滑鏂板緩涓涓猈ebservice client錛屾潵璋冪敤Webservice鎻愪緵鐨勬柟娉曘?
7.1鏂板緩涓涓猨ava project錛岀粰浠栧彇涓悕瀛椼傛瘮濡傛垜浠彨瀹僀lientofWebService


鍦ㄥ伐鍏鋒潯涓偣鍑籲ew Web Service Client

鐒跺悗鎸夌収浠ヤ笅姝ラ鎿嶄綔錛?


The last step of the web service client creation is to specify either a WSDL File or a WSDL URL for the wizard to retrieve the web service WSDL from. In our case we are using the URL and generate the client into the new package com.myeclipseide.ws.client:

http://localhost:8888/WebServiceProject/CalculatorPort?WSDL


鐐瑰嚮Next鐭ラ亾瀹屾垚銆?
鍙互鐪嬪埌鍦ㄦ柊寤虹殑java project ClientofWebService涓紝src鏂囦歡澶逛笅浜х敓浜嗚澶氱殑鏂囦歡錛屾牴鎹悕縐版垜浠ぇ浣撳彲浠ヤ簡瑙e叾鎰忔濓紝鍙互鎵撳紑鐪嬩竴涓嬫簮浠g爜錛屽叾瀹炰笉闅劇悊瑙c傛瘮濡俛dd鏂囦歡錛屽氨鏄疌alculator綾諱腑add鏂規硶鐨勪袱涓弬鏁扮殑get鍜宻et鏂規硶銆傚叾浠栫被浼箋?
鎴戜滑鍦ㄦ枃浠跺す涓嬭涓涓被test.java鍐欎竴涓猰ain鍑芥暟嫻嬭瘯
Java浠g爜     

public static void main(String[] args) {    
    
/* Create the service instance */    
    CalculatorService service 
= new CalculatorService();    
    CalculatorDelegate delegate 
= service.getCalculatorPort();    
  
    
/* Using the web service, perform the 4 calculations */    
    System.out.println( 
"1. 3+7=" + delegate.add(37));    
    System.out.println( 
"2. 12-2=" + delegate.subtract(122));    
    System.out.println( 
"3. 9*9=" + delegate.multiply(99));    
    System.out.println( 
"4. 40/2=" + delegate.divide(402));    
}
   

 榪愯寰楀埌濡備笅緇撴灉錛?
1. 3+7=10
2. 12-2=10
3. 9*9=81
4. 40/2=20
嫻嬭瘯瀹屾垚銆?

鏈枃鏉ヨ嚜CSDN鍗氬錛岃漿杞借鏍囨槑鍑哄錛歨ttp://blog.csdn.net/foart/archive/2009/06/21/4287515.aspx



]]>
主站蜘蛛池模板: 亚洲av无码不卡| 亚洲国产成人一区二区精品区| 久久精品国产亚洲av日韩| 成全视频高清免费观看电视剧| 国产精品免费大片| 亚洲国产一区二区a毛片| 人妻无码久久一区二区三区免费| 国产亚洲综合一区柠檬导航| 日本亚洲免费无线码| 一本岛v免费不卡一二三区| 亚洲成人免费电影| 亚洲欧洲国产成人精品| EEUSS影院WWW在线观看免费| 3344免费播放观看视频| 亚洲三级在线免费观看| 免费av欧美国产在钱| 性色av极品无码专区亚洲| 99久久99久久精品免费看蜜桃| 亚洲人成电影网站| 蜜臀91精品国产免费观看| 亚洲色四在线视频观看| 亚洲高清视频免费| 亚洲精品无码不卡在线播放| 亚洲AV永久无码精品一区二区国产| 亚美影视免费在线观看| 亚洲激情在线视频| 在线中文高清资源免费观看| 免费的黄色的网站| 亚洲国产精品一区二区久久| 国产免费AV片在线播放唯爱网| 青青免费在线视频| 超pen个人视频国产免费观看| 九九九国产精品成人免费视频| 久久精品国产99精品国产亚洲性色| 无人在线直播免费观看| 久久丫精品国产亚洲av| 免费羞羞视频网站| a毛片免费全部播放完整成| 亚洲丰满熟女一区二区v| 亚洲AV无码专区日韩| 四虎免费影院ww4164h|