首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

2013-04-20 
MyEclipse涓媂Fire寮?彂Webservice瀹炰緥 .聽聽聽聽 鏈?繎鍦ㄧ爺絀禞AVA寮?彂Webservice錛屽彂鐜扮綉緇滀笂

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
聽聽聽聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽聽聽 2錛塒roject Name錛歐ebServiceServer錛孎ramework錛?strong style="background-color: #ffff66; color: black;">XFire錛屽叾浠栭?欏歸粯璁?br>聽 聽 聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽聽 3錛塏ext錛岃繖涓?淇濇寔榛樿鍊?br>聽聽聽聽 4錛塒roject Library閫夋嫨錛岄?鎷?strong style="background-color: #ffff66; color: black;">XFire 1.2聽 Core Libraries

聽聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽 5錛塅inish錛屽垱寤烘垚鍔熷悗鐪嬪埌鐨勫伐紼嬬洰褰曞涓嬶細
聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽 6錛夊畬鎴愪互涓?姝ュ悗錛屾煡鐪媁ebRoot/WEB-INF/web.xml

聽 聽 聽 聽聽 杩欓噷鎸囨槑浜嗗綋閬囧埌/services/*璇鋒眰鏃訛紝灝嗛?鐢╔FireConfigurableServlet鏉ュ鐞?聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥


涓夈?鍒涘緩Web Service Code
聽聽聽 1錛夐?杩嘑ile鈥?gt;New鈥?gt;Other鈥?gt;Web Services鈥?gt;Web Service wizard鍒涘緩JAVA CODE
聽聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽聽 2錛夐?鎷╅?杩嘕AVA CLASS鍒涘緩Web Service
聽聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽聽 3錛夊垱寤篐elloWebService.java錛岄?杩嘚ew鍒涘緩com.service package錛屽悜瀵煎皢涓哄伐紼嬭嚜鍔ㄥ垱寤哄搴旂殑鎺ュ彛綾諱笌瀹炵幇綾?br>聽聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽聽 鍒涘緩鎴愬姛鍚庢煡鐪媁ebServices/services.xml錛屽彂鐜伴厤緗枃浠跺浜嗕互涓嬪唴瀹癸細
聽聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽 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
聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽 鍦ㄩ儴緗插悜瀵間腑閫夋嫨欏圭洰銆佹湇鍔″櫒
聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽聽 2錛夊惎鍔ㄦ湇鍔″櫒
聽聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥
聽聽 3錛夋祴璇?strong style="background-color: #a0ffff; color: black;">WebService
聽聽 MyEclipse鎻愪緵浜嗕竴涓猈eb Service Explorer鏉ユ祴璇昗eb Service
聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥
聽聽 閫夋嫨鍒楄〃涓殑Launch SOAP Web Services Explorer
聽聽 4錛夐?鎷¦SDL妯″紡
聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽 5錛夊湪Explorer涓?鎷¦SDL Main錛屽湪鍙寵竟鐨刄RL涓緭鍏?br>聽聽 http://localhost:9090/WebServiceServer/services/HelloWebService?WSDL錛屽崟鍑?Go"
聽聽 鍏朵腑9090鏄湇鍔″櫒絝彛鍙鳳紝services鍦ㄤ箣鍓嶇殑web.xml涓寚瀹?br>聽聽 鑻ュ湪Status涓樉紺烘垚鍔熸墦寮?SDL鏂囦歡鍒欐祴璇曟垚鍔?br>聽 聽MyEclipse涓媂Fire寮?彂Webservice瀹炰緥
浜斻?鍒涘緩WebService瀹㈡埛絝?br>緇忚繃浠ヤ笂鍑犳錛屾垜浠凡緇忔垚鍔熷彂甯冧簡涓?釜WebService錛岀幇鍦ㄩ渶瑕佸垱寤轟竴涓鎴風鏉ヨ皟鐢ㄨ鏈嶅姟
聽 1錛夊垱寤篔ava Project錛歐ebServiceClient
聽 2錛夊紩鍏yEclipse Libraries
聽聽聽聽聽聽 鍙抽敭WebServiceClient鈥?gt;Build Path鈥?gt;Add Libraries
MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽 閫夋嫨XFire 1.2 HTTP Client Libraries
MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

聽聽 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錛屽湪鎺у埗鍙頒腑鐪嬪埌濡備笅杈撳嚭

聽聽 MyEclipse涓媂Fire寮?彂Webservice瀹炰緥

鏈瀹炰緥鍒版灝辯畻瀹屾垚浜嗐?

热点排行