锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲第一天堂,中文字幕色一区二区,亚洲欧洲在线视频http://www.aygfsteel.com/nikon/category/28514.htmlzh-cnSat, 29 Dec 2007 19:05:10 GMTSat, 29 Dec 2007 19:05:10 GMT60XFIRE鐨勪竴涓緥瀛愶紝鍙戠幇宸eb service鐪熸槸綆鍗曞緱瑕佸懡錛侊紒 渚ч潰鍗拌瘉浜?jiǎn)鍐欎唬鐮伃憡鏉キ憡娌″墠閫斾簡(jiǎn)錛屽搱http://www.aygfsteel.com/nikon/archive/2007/12/29/171540.html鏉庣珛娉?/dc:creator>鏉庣珛娉?/author>Sat, 29 Dec 2007 06:59:00 GMThttp://www.aygfsteel.com/nikon/archive/2007/12/29/171540.htmlhttp://www.aygfsteel.com/nikon/comments/171540.htmlhttp://www.aygfsteel.com/nikon/archive/2007/12/29/171540.html#Feedback0http://www.aygfsteel.com/nikon/comments/commentRss/171540.htmlhttp://www.aygfsteel.com/nikon/services/trackbacks/171540.html鎺ュ彛 interface
import J2EE鎶鏈殑鐖櫕.util.Collection;
import J2EE鎶鏈殑鐖櫕.util.List;

public interface IMathService {
 /**
  * 鍔?br />   * @param a
  * @param b
  * @return
  */
 public int add(int a,int b);
 /**
  * 鍑?br />   * @param a
  * @param b
  * @return
  */
 public int sub(int a,int b);
/**
涓婁紶浜岃繘鍒舵枃浠?br /> */
  public String sendFile(String fileName,byte[] file );
 
}

瀹炵幇 implements

import J2EE鎶鏈殑鐖櫕.io.File;
import J2EE鎶鏈殑鐖櫕.io.FileOutputStream;
import J2EE鎶鏈殑鐖櫕.sql.Connection;
import J2EE鎶鏈殑鐖櫕.sql.ResultSet;
import J2EE鎶鏈殑鐖櫕.sql.Statement;
import J2EE鎶鏈殑鐖櫕.util.ArrayList;
import J2EE鎶鏈殑鐖櫕.util.Collection;
import J2EE鎶鏈殑鐖櫕.util.List;

import com.newsoft.oa.bean.User;
import com.newsoft.oa.uitl.Connector;
import com.thoughtworks.xstream.XStream;

public class MathServiceImpl implements IMathService{
  public int add(int a,int b){
   return a+b;
  }
 
  public int sub(int a,int b){
   return a-b;
  }
  public String getWelComeStr(String name){
   return "hi "+name+"! 嬈㈣繋浣?;
  }
  public List getUsers(){
   List l=new ArrayList();
   l.add("name");
   l.add("password");
   l.add("sex");
   return l;
  }

public String sendFile(String fileName, byte[] filebytes) {
 try{
  String path="";
   if(filebytes!=null&&filebytes.length>0){
    File file=new File("/"+fileName);
   
    file.createNewFile();
    FileOutputStream fos=new FileOutputStream(file);
    fos.write(filebytes);
    fos.close();
    path=file.getAbsolutePath();
    System.out.println(path);
   
    file=null;
   
   }
  
   return path;
 }catch(Exception ex){
  return "false";
 }
}

}

閰嶇疆鏂囦歡

鏀懼湪 Classes/META-INF/xfire/service.xml錛涢噷闈?br />

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
 <service>
  <name>MathService</name>
  <namespace>newsoft/oa/MathService</namespace>
  <serviceClass>
   com.newsoft.oa.services.IMathService
  </serviceClass>
  <implementationClass>
   com.newsoft.oa.services.MathServiceImpl
  </implementationClass>

 </service>
</beans>

鍏跺疄鏄熼壌浜?jiǎn)Spring鐨勫啓娉曪紝鐢ㄨ繃Spring涓嶄細(xì)瀵圭潃闄岀敓錛岋紙Application-context.xml錛?br />
WEB-XML鍔犱笂

<servlet>
  <servlet-name>XFireServlet</servlet-name>
  <servlet-class>
   org.codehaus.xfire.transport.http.XFireConfigurableServlet
  </servlet-class>
 </servlet>

 <servlet-mapping>
  <servlet-name>XFireServlet</servlet-name>
  <url-pattern>/servlet/XFireServlet/*</url-pattern>
 </servlet-mapping>

 <servlet-mapping>
  <servlet-name>XFireServlet</servlet-name>
  <url-pattern>/services/*</url-pattern>
 </servlet-mapping>


鏈鍚庡氨鏄鎴風(fēng)浜?

/ /Create a metadata of the service             
 Service serviceModel = new ObjectServiceFactory().create(IMathService.class);
// Create a proxy for the deployed service     
 
 XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());  
 String serviceUrl = "http://localhost:8080/ws/services/MathService";
  client = null;      
 try {         
   client = (IMathService) factory.create(serviceModel, serviceUrl); 
   File file=new File("c:\\SUPERMAP 鐧界毊涔?pdf");
   FileInputStream fis=new FileInputStream(file);
   byte[] b=new byte[fis.available()];
   fis.read(b);
  System.out.println(client.sendFile(file.getName(), b));
 } catch (Exception ex) {        
   ex.printStackTrace();
 }                           //Invoke the service   
 int serviceResponse = 0;
 int a=10,b=20;

灝辨槸

Service serviceModel = new ObjectServiceFactory().create(IMathService.class); 
 XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());  
 String serviceUrl = http://localhost:8080/ws/services/MathService;

涓夎瀛楀緩绔嬭繛鎺ヨ姹傦紝

澶交鏉句簡(jiǎn)

浼犺緭鏂囦歡閫熷害涔熷彲浠ワ紝浜岃繘鍒訛紝2M澶氱殑鏂囦歡錛屼篃鑳借交鏉句紶閫?br />
鐢?net鍜宒elphi騫沖彴嫻嬭瘯錛屽吋瀹規(guī)ф病闂錛堟寜閬撶悊 soap,涔熶笉搴旇鏈夐棶棰橈級(jí)

榪欐槸涓哄鎴鋒惌寤虹殑鍦?妗f緋葷粺鍜孫A瀹℃壒闂翠綔鏂囦歡褰掓。鐨勫皾璇曢」鐩?br />
鍝堬紝瀹屾暣鐨勯」鐩唬鐮侊紝灝變笉鏂逛究璁蹭簡(jiǎn)銆?br />

]]>
主站蜘蛛池模板: 鄂伦春自治旗| 龙南县| 三河市| 汉寿县| 夏津县| 白山市| 远安县| 霍州市| 高安市| 凌云县| 资兴市| 安塞县| 阿图什市| 阜新市| 十堰市| 德钦县| 临洮县| 青海省| 大荔县| 嘉鱼县| 婺源县| 宁晋县| 景谷| 麻江县| 永城市| 镶黄旗| 酉阳| 榕江县| 梨树县| 措勤县| 郯城县| 陈巴尔虎旗| 错那县| 大石桥市| 舞阳县| 汉源县| 阿勒泰市| 金坛市| 枣庄市| 湖南省| 谷城县|