WebServiceException

时间:2024-03-26 16:04:50

在用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”注解才可以!