我该怎么做才能处理WebServiceException:

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了我该怎么做才能处理WebServiceException:相关的知识,希望对你有一定的参考价值。

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

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

答案

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

另一答案

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

以上是关于我该怎么做才能处理WebServiceException:的主要内容,如果未能解决你的问题,请参考以下文章

我该怎么做才能使href文本可以通过c#更改?

我该怎么做才能使整数每次都随机[重复]

尝试打开 phpmyadmin 时出现错误 403。我该怎么做才能纠正它?

我该怎么做才能有没有符号的数字?

在某些情况下,我该怎么做才能使这个 SQL 返回结果?

我该怎么做才能让画布在不同的浏览器中工作[关闭]