WebServiceException

在用cxf做webservice的时候,在写客户端程序的时候,出现以下异常:

Could not find wsdl:binding operation info for web method test

 

Exception in thread "main" javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method test.
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:113)
	at $Proxy29.test(Unknown Source)
	at com.abc.test.UserTest.main(UserTest.java:10)

 原因:无法接收(绑定)返回的类型

 

解决办法:在接受的类文件(接口)的上面加上一个annotation注解。

 

 

import javax.jws.WebService;
@WebService//很重要
public interface UserService {
	public String test(String userName);
}

 然后就OK了,有的webservice的方法上面还要添加“@WebMethod”注解才可以!

posted @ 2014-07-25 10:36  哈特中尉  阅读(1474)  评论(0编辑  收藏  举报