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  很好

 

 



你可能感兴趣的:(java,eclipse,.net,webservice,WCF)