夢幻之旅

          DEBUG - 天道酬勤

             :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            671 隨筆 :: 6 文章 :: 256 評論 :: 0 Trackbacks

          接口:

          package test;

          public interface IHelloWorld
          {   
              
          public String sayHello(String name);
          }

          接口實現類:

          package test;


          public class HelloWorldImpl implements IHelloWorld
          {

              
          public String sayHello(String name)
              
          {
                  
          return name + "say: Hello world!";
              }
             

          }


          測試類
          package test;

          import java.net.URL;

          import org.codehaus.xfire.client.Client;


          public class TestCanUse
          {   
              
          public static void main(String[] args) throws Exception 
               Client client 
          = new Client(new 
               URL(
          "http://localhost:8080/services/abc?wsdl")); 
               Object[] results 
          = client.invoke("sayHello"new Object[] {"Huyvanpull"}); 
               System.out.println((String) results[
          0]);
              }

          }


          配置:
          <?xml version="1.0" encoding="GBK"?>
          <beans xmlns="http://xfire.codehaus.org/config/1.0">
              
          <service>
                  
          <name>abc</name>
                  
          <namespace>http://localhost:8080/services/hello</namespace>
                  
          <serviceClass>test.IHelloWorld</serviceClass>
                  
          <implementationClass>test.HelloWorldImpl</implementationClass>
              
          </service>
          </beans>
          posted on 2010-07-22 14:54 HUIKK 閱讀(145) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 密云县| 湖北省| 泽州县| 马关县| 文昌市| 长宁区| 盐津县| 焉耆| 石林| 珲春市| 台前县| 冷水江市| 宜宾县| 攀枝花市| 疏勒县| 合水县| 香格里拉县| 灵武市| 陆良县| 甘孜县| 会同县| 临安市| 台安县| 琼中| 资兴市| 镇江市| 盈江县| 济宁市| 澎湖县| 兴国县| 西宁市| 绥化市| 华容县| 叶城县| 靖江市| 阳新县| 宜章县| 兴安县| 蒙自县| 察隅县| 沾益县|