夢幻之旅

          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 閱讀(142) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 中宁县| 河东区| 商河县| 综艺| 东乌珠穆沁旗| 天门市| 满洲里市| 突泉县| 苍梧县| 五莲县| 绥棱县| 天柱县| 卢湾区| 东明县| 封开县| 玛曲县| 阿拉善左旗| 洛浦县| 类乌齐县| 潍坊市| 犍为县| 广宁县| 武定县| 河源市| 雅江县| 邻水| 济宁市| 始兴县| 建昌县| 桃源县| 曲靖市| 长沙县| 额尔古纳市| 庐江县| 桃园县| 海口市| 香港| 长顺县| 齐齐哈尔市| 房产| 南乐县|