2012-10-09 590 views
1

我在本地主機上部署了一個Web服務。我使用部署服務器上的wsimport命令生成了存根。我應該怎麼做來處理WebServiceException:

TestService serviceObject=null; 
    String url = "http://localhost:9080/ProjWebService/services/Test?wsdl"; 
    QName qname = new QName("http://testservice.test.sw.com", "TestService "); 
    Service service = Service.create(url, qname); 
    pullService = service.getPort(TestService .class); 
    queryResultSet = serviceObject.webMethod("Hello"); 

不過,我收到以下錯誤:

[10/4/12 15:14:23:145 ] 00000033 SystemErr  R **javax.xml.ws.WebServiceException: An attempt was made to construct the ServiceDelegate object with an service name that is not valid: {http://testservice.test.sw.com}TestService**. 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:173) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:118) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at org.apache.axis2.jaxws.spi.ServiceDelegate.<init>(ServiceDelegate.java:218) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:71) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at javax.xml.ws.Service.<init>(Service.java:68) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at javax.xml.ws.Service.create(Service.java:692) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at org.test.poctestservice.ui.bean.testserviceBean.search(testserviceBean.java:425) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at java.lang.reflect.Method.invoke(Method.java:600) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at org.apache.el.parser.AstValue.invoke(AstValue.java:159) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:94) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at javax.faces.component.UICommand.broadcast(UICommand.java:387) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:458) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:763) 
[10/4/12 15:14:23:146 ] 00000033 SystemErr  R  at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:132) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:74) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:31) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:26) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:131) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583) 
[10/4/12 15:14:23:147 ] 00000033 SystemErr  R  at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
[10/4/12 15:14:23:148 ] 00000033 SystemErr  R  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563) 



我已經刪除按照步驟然後我用下面的代碼用在我的客戶端生成的存根我的軸庫來自部署的戰爭中的WEB-INF/lib folder。但是,我仍然得到同樣的例外。在Eclipse中集成的IBM Websphere WAS 7中,相同的代碼運行良好。但是當我在另一個應用程序服務器上部署戰爭時,它會引發上述異常。

我也諮詢過這個帖子:Web Service client generated by wsdl not working with Deployed web sevrice。我使用wsimport實用程序/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/opt/IBM/WebSphere/AppServer/java/bin生成了存根。但是,在代碼中調用時,這兩個存根都會產生相同的錯誤。

+0

現在我得到ècom.ibm.ws.webcontainer.servlet.ServletWrapper服務SRVE0068E:在一個創建uncaught異常應用程序DataMergeAppEAR中servlet TestDataMergeWSClientServlet的服務方法。創建的異常:javax.xml.ws.WebServiceException:端點驗證由於以下錯誤而無法驗證:::無效的端點接口:: :: WSDL portType中的操作名稱與SEI或Web中的方法名稱不匹配服務實現類。 wsdl操作= [getByName getBySSN getByName]調度操作= [null getByName getBySSN] – bilalhaider

+0

仍然在同一個地方。相同的代碼在當地環境中工作正常,但不在生產中。任何指南? – bilalhaider

+1

請檢查QName參數與wsdl – Hemanth

回答

0

我有一個類似的問題,用彈簧JaxWsPortProxyFactoryBean

<bean id="test1WSClient" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean"> 
    <property name="serviceInterface" value="com.yourpackage.app.web.ws.Test1"/> 
    <property name="wsdlDocumentUrl" value="http://localhost:9080/proj7/ws/Test1Service/Test1WebService.wsdl"/> 
    <property name="namespaceUri" value="http://ws.web.app.yourpackage.com/"/> 
    <property name="serviceName" value="Test1WebService"/> 
    <property name="portName" value="Test1Port"/> 
</bean> 

確保你的namespaceURI年底把那個「/」。希望這可以幫助別人!