1

我在 localhost 上部署了一个 Web 服务。我在部署服务器上使用 wsimport 命令生成了存根。然后,我使用以下代码在客户端中使用了生成的存根:

    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 上运行良好。但是当我在另一个应用程序服务器上部署战争时,它会抛出上述异常。

我还咨询了这个线程:由 wsdl 生成的 Web Service client not working with Deployed web sevrice。我使用 wsimport 实用程序 at/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin和 at生成了存根/opt/IBM/WebSphere/AppServer/java/bin。但是,当在代码中调用时,两个存根都会产生相同的错误。

4

2 回答 2

0

查看http://www-01.ibm.com/support/docview.wss?uid=swg1PM31409 尝试添加 JVM 属性:jaxws.ignore.extraWSDLOps=true

于 2013-07-24T01:22:56.040 回答
0

我有一个类似的问题,使用 spring 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 的末尾。希望这对某人有帮助!

于 2013-05-09T21:22:22.703 回答