XFire问题Service class cannot be abstract解决

 使用xfire的eclipse插件提供的代码生成工具,根据WSDL生成的代码测试时出现异常: Exception in thread "main" org.codehaus.xfire.annotations.AnnotationException: Service class cannot be abstract: com.webserviceproject.xifre.echoimplservice.EchoImplServicePortType at org.codehaus.xfire.annotations.AnnotationServiceFactory.assertValidImplementationClass(AnnotationServiceFactory.java:268) at org.codehaus.xfire.annotations.AnnotationServiceFactory.create(AnnotationServiceFactory.java:177) at org.codehaus.xfire.service.binding.ObjectServiceFactory.create(ObjectServiceFactory.java:284) at com.webserviceproject.xifre.echoimplservice.EchoImplServiceClient.create0(EchoImplServiceClient.java:59) at com.webserviceproject.xifre.echoimplservice.EchoImplServiceClient.(EchoImplServiceClient.java:26) at testclient.ClientTest.main(ClientTest.java:21)

是加载的包不一致,而出现,下载最新的lib就可以了.


利用XFire生成 http://www.webservicex.net/stockquote.asmx?WSDL
的客户端程序
测试代码为:

package  com.net.webservicex;
import  java.util.Properties;
public   class  Test  {
 
public static void main(String[] args) {
  StockQuoteClient client 
= new StockQuoteClient();
  StockQuoteSoap StockQuote 
= client.getStockQuoteSoap();
  
//如果是代理服务器就加上下面三句话就可了
  Properties prop = System.getProperties(); 
  prop.put(
"http.proxyHost","17.31.13.3"); 
  prop.put(
"http.proxyPort","8080"); 
  System.out.println(StockQuote.getQuote(
"601988.SS"));
 }

}

另外推荐一个常用的webService地址可以直接调用:

http://www.webservicex.net/WCF/Default.aspx  很好

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值