MyEclipse涓媂Fire寮?彂Webservice瀹炰緥 .
聽聽聽聽 鏈?繎鍦ㄧ爺絀禞AVA寮?彂Webservice錛屽彂鐜扮綉緇滀笂姣旇緝嫻佽鐨勫嚑縐嶉?鎷〢XIS銆?strong style="background-color: #ffff66; color: black;">XFire銆丆FX(XFire鐨勪笅涓?唬)錛屽墠鍑犲ぉ杞簡鍑犵瘒鍏充簬杩欎笁縐嶉?鎷╃殑姣旇緝鐨勬枃絝狅紝瀵瑰畠浠凡緇忔湁浜嗕簺姒傚康銆傚喅瀹氳嚜宸卞疄璺典竴涓緥瀛?/p>
聽聽聽聽 鍦ㄥ紑濮嬪墠錛屽厛浠嬬粛涓?簺姒傚康錛?br>
聽聽聽聽 XFire Java SOAP妗嗘灦姒傝堪 (鎽樿嚜錛?a href="http://tech.it168.com/j/e/2006-10-28/200610281432707.shtml">http://tech.it168.com/j/e/2006-10-28/200610281432707.shtml )
聽聽聽 MyEclipse Web Services鏄緩絝嬪湪XFire Java SOAP妗嗘灦鍜屽伐鍏峰熀紜?笂鐨? XFire鏄竴嬈懼紑婧愮殑Java SOAP妗嗘灦銆傚畠鎷ユ湁涓?釜杞婚噺綰х殑淇℃伅澶勭悊妯″潡錛岄?杩嘢TAX鏉ヤ笌SOAP淇℃伅鐩哥粨鍚堛?鎻愪緵浜嗕竴涓伐浣滃湪Web Services涓嬬殑綆?崟API錛屾敮鎸丳OJO鍜宻chema寮?彂. XFire鏀寔 Web Services standards,Spring 鏁村悎, 鏀寔JBI , 鏀寔 JAXB ,XMLBeans,Java 5 鍜孞AX-WS.騫舵敮鎸丠TTP, JMS, XMPP, In-memory浼犺緭鍗忚
涓??鐜閰嶇疆錛歁yEclipse7.0
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 JDK1.6
浜屻?鍒涘緩Web Service Project
聽聽聽聽聽 1錛夊湪MyEclipse涓?鎷〧ile鈥?gt;New鈥?gt;Other錛岄?鎷¦eb Service Project
聽聽聽聽聽聽
聽聽聽聽聽 2錛塒roject Name錛歐ebServiceServer錛孎ramework錛?strong style="background-color: #ffff66; color: black;">XFire錛屽叾浠栭?欏歸粯璁?br>聽 聽 聽
聽聽聽聽 3錛塏ext錛岃繖涓?淇濇寔榛樿鍊?br>聽聽聽聽 4錛塒roject Library閫夋嫨錛岄?鎷?strong style="background-color: #ffff66; color: black;">XFire 1.2聽 Core Libraries
聽聽聽聽
聽聽聽 5錛塅inish錛屽垱寤烘垚鍔熷悗鐪嬪埌鐨勫伐紼嬬洰褰曞涓嬶細
聽聽聽
聽聽聽 6錛夊畬鎴愪互涓?姝ュ悗錛屾煡鐪媁ebRoot/WEB-INF/web.xml
聽 聽 聽 聽聽 杩欓噷鎸囨槑浜嗗綋閬囧埌/services/*璇鋒眰鏃訛紝灝嗛?鐢╔FireConfigurableServlet鏉ュ鐞?聽聽
涓夈?鍒涘緩Web Service Code
聽聽聽 1錛夐?杩嘑ile鈥?gt;New鈥?gt;Other鈥?gt;Web Services鈥?gt;Web Service wizard鍒涘緩JAVA CODE
聽聽聽聽
聽聽聽聽 2錛夐?鎷╅?杩嘕AVA CLASS鍒涘緩Web Service
聽聽聽聽
聽聽聽聽 3錛夊垱寤篐elloWebService.java錛岄?杩嘚ew鍒涘緩com.service package錛屽悜瀵煎皢涓哄伐紼嬭嚜鍔ㄥ垱寤哄搴旂殑鎺ュ彛綾諱笌瀹炵幇綾?br>聽聽聽聽
聽聽聽聽 鍒涘緩鎴愬姛鍚庢煡鐪媁ebServices/services.xml錛屽彂鐜伴厤緗枃浠跺浜嗕互涓嬪唴瀹癸細
聽聽聽聽
聽聽聽 4錛変慨鏀笻elloWebServiceImpl.java
聽聽聽 package com.service;
聽聽聽 //Generated by meteorWJ
聽聽 public class HelloWebServiceImpl implements IHelloWebService {
聽聽聽
聽聽聽聽 public String example(String message) {
聽聽聽 聽聽聽 return getAuthor()+","+message;
聽聽 聽 }
聽聽 聽 private String getAuthor(){
聽聽聽 聽聽聽 return "meteorWJ";
聽聽 聽 }
聽聽聽
聽聽 }
聽
鍥涖?閮ㄧ講騫舵祴璇昗ebSericeServer
聽聽聽 1錛夐儴緗瞁ebServiceServer
聽聽聽
聽聽聽 鍦ㄩ儴緗插悜瀵間腑閫夋嫨欏圭洰銆佹湇鍔″櫒
聽聽聽
聽聽聽 2錛夊惎鍔ㄦ湇鍔″櫒
聽聽聽
聽聽 3錛夋祴璇?strong style="background-color: #a0ffff; color: black;">WebService
聽聽 MyEclipse鎻愪緵浜嗕竴涓猈eb Service Explorer鏉ユ祴璇昗eb Service
聽聽
聽聽 閫夋嫨鍒楄〃涓殑Launch SOAP Web Services Explorer
聽聽 4錛夐?鎷¦SDL妯″紡
聽聽
聽聽 5錛夊湪Explorer涓?鎷¦SDL Main錛屽湪鍙寵竟鐨刄RL涓緭鍏?br>聽聽 http://localhost:9090/WebServiceServer/services/HelloWebService?WSDL錛屽崟鍑?Go"
聽聽 鍏朵腑9090鏄湇鍔″櫒絝彛鍙鳳紝services鍦ㄤ箣鍓嶇殑web.xml涓寚瀹?br>聽聽 鑻ュ湪Status涓樉紺烘垚鍔熸墦寮?SDL鏂囦歡鍒欐祴璇曟垚鍔?br>聽 聽 聽
浜斻?鍒涘緩WebService瀹㈡埛絝?br>緇忚繃浠ヤ笂鍑犳錛屾垜浠凡緇忔垚鍔熷彂甯冧簡涓?釜WebService錛岀幇鍦ㄩ渶瑕佸垱寤轟竴涓鎴風鏉ヨ皟鐢ㄨ鏈嶅姟
聽 1錛夊垱寤篔ava Project錛歐ebServiceClient
聽 2錛夊紩鍏yEclipse Libraries
聽聽聽聽聽聽 鍙抽敭WebServiceClient鈥?gt;Build Path鈥?gt;Add Libraries
聽
聽 閫夋嫨XFire 1.2 HTTP Client Libraries
聽
聽聽 3錛夊垱寤篐elloWebService.java
聽聽 鍦╯rc鐩綍涓嬪垱寤篶om.client.HelloWebService.java
聽聽 package com.client;
聽聽 import java.net.URL;
聽聽 import org.codehaus.xfire.client.Client;
聽聽 public class HelloWebService {
聽聽聽聽聽聽 public static void main(String[] args) throws Exception
聽聽聽聽聽聽 {
聽聽聽 聽聽聽 Client client = new Client(new URL("http://localhost:9090/WebServiceServer/services/HelloWebService?wsdl"));
聽聽聽 聽聽聽 Object[] results = client.invoke("example", new Object[] {"hello"});
聽聽聽 聽聽聽 System.out.println((String) results[0]);
聽聽聽聽聽聽 }
聽聽 }
聽聽 4錛夊湪紜鏈嶅姟鍣ㄥ惎鍔ㄧ殑鎯呭喌涓嬶紝杩愯HelloWebService.java
聽聽 鍙抽敭鐐瑰嚮Run As>Java Application錛屽湪鎺у埗鍙頒腑鐪嬪埌濡備笅杈撳嚭
聽聽
聽
鏈瀹炰緥鍒版灝辯畻瀹屾垚浜嗐?