梦幻之旅

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 阅读(130) 评论(0)  编辑  收藏 所属分类: Java

只有注册用户登录后才能发表评论。


网站导航: