我試圖在java中使用web服務,使用從wsdl文件與wsdl2java生成的客戶端。javax.xml.ws.WebServiceException:端口{http://tempuri.org/}WSHttpBinding_IDWService找不到
我使用的Eclipse版本赫利俄斯和JDK 1.6.0_20,我已經產生使用wsld2java與選項的.class文件:
「-dc:\ WebServices的\生成-client -verbose -compile -autoNameResolution -p org.dwservice -sn DWService -wsdlLocation /WEB-INF/wsdl/DWService.wsdl c:\ WebServices \ DWService.wsdl「
我將生成的文件打包到一個.jar文件中,並將其添加到我的項目中編譯好。 但是當我嘗試使用web服務,我得到異常:
javax.xml.ws.WebServiceException: Port {http://tempuri.org/}WSHttpBinding_IDWService not found.
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:311)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:302)
at javax.xml.ws.Service.getPort(Service.java:92)
at org.dwservice.DWService.getWSHttpBindingIDWService(DWService.java:63)
這是我的代碼:
import org.dwservice.*;
...
private DWService dwService = new DWService();
private IDWService iDWService = ***dwService.getWSHttpBindingIDWService()***;
任何想法將是非常讚賞。
您的Web服務端口和WSDL是否可以使用瀏覽器進行訪問? – Pushkar 2011-03-11 10:03:24