我有兩個webservices A和B.需要調用b中的webMethods之一。 如何實現此目的? 我正在使用Maven的wsimport插件來構建A.這是爲B生成必要的存根,並將它們作爲Webservice A的一部分。但是,當我嘗試調用b方法時,我得到一個異常。任何人都可以告訴我發生了什麼事? 下面是代碼和異常跟蹤: 代碼:如何從另一個webservice調用webservice
BBeanService bbs = new BBeanService();
BBean bb = bbs.getBBeanPort();
bb.invokeWebService(); // this is throwing exception
這是異常跟蹤:在com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault
顯示java.lang.NullPointerException。 java:188)at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:116)at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)at com .sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)at $ Proxy175.getCase(未知源)在sun.reflect的com.kebok.ais.billing.server.ejb.impl.ChargeManagerBean.generateBillDetails(ChargeManagerBean.java:144)。在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)上的NativeMethodAccessorImpl.invoke0(Native方法)位於java.lang.reflect.Method.invoke(Method。 java:597)at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1011)at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:175)at com.sun.ejb .containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2920)at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4011)at com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:190 )at $ proxy173.generateBillDetails(Unknown Source)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25)在java.la ng.reflect.Method.invoke(Method.java:597)at com.sun.enterprise.webservice.InvokerImpl.invoke(InvokerImpl.java:78)at com.sun.enterprise.webservice.EjbInvokerImpl.invoke(EjbInvokerImpl.java: 82)在com.sun.xml.ws.server.InvokerTube $ 2.invoke(InvokerTube.java:146)at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)at com。在com.sun.xml的com.sun.xml.ws.api.pipe.Fiber .__ doRun(Fiber.java:595)處提供sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)。 ws.api.pipe.Fiber._doRun(Fiber.java:554)位於com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)位於com.sun.xml.ws.api。在com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:106)上的pipe.Fiber.runSync(Fiber.java:436)at com.sun.enterprise.webservice.MonitoringPipe.process(可以在com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)at com.sun.xml.ws.api.pipe.Fiber .__ doRun(Fiber。 java:595)at com.sun.xml.ws.api.pipe.Fiber。 _doRun(Fiber.java:554)at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber。 java:436)at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:106)at com.sun.xml.ws.tx.service.TxServerPipe.process(TxServerPipe.java: 317)at com.sun.enterprise.webservice.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:222)at com.sun.enterprise.webservice.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:133)at com.sun.xml.ws.api .pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)at com.sun.xml.ws.api.pipe.Fiber .__ doRun(Fiber.java:595)at com.sun.xml.ws.api.pipe .Fiber._doRun(Fiber.java:554)at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)at com.sun.xml.ws.api.pipe.Fiber.runSync (Fiber.java:436)at com.sun.xml.ws.server.WSEndpointImpl $ 2.process(WSEndpointImpl.java:243)at com.sun.xml.ws.transport.http.HttpAdapter $ HttpToolkit.handle(HttpAdapter。 java:444)at com.sun.xml.ws.transport。 http.HttpAdapter.handle(HttpAdapter.java:244)at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost( Ejb3MessageDispatcher.java:113)com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:87)at com.sun.enterprise.webservice.EjbWebServiceServlet。dispatchToEjbEndpoint(EjbWebServiceServlet.java:228)在com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServiceServlet.java:157)在javax.servlet.http.HttpServlet.service(HttpServlet.java:847)在com.sun.enterprise .web.AdHocContextValve.invoke(AdHocContextValve.java:114)在org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)在org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593 )位於org.apache.catalina.core.StandardHostValve處的com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:87)處的org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)處。在org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)處調用(StandardHostValve.java:222)org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) .catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)位於org.a的org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096) pache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)在org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)在org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline。 java:593)at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)at org.apache.coyote.tomcat5 .CoyoteAdapter.service(CoyoteAdapter.java:288)在com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647)在com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess (DefaultProcessorTask.java:579)在com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)在com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java :341)at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)at com.sun.en在com.sun.enterprise.web.portunif.PortUnificationPipeline上的terprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214):com.sun.enterprise.web上的$ PUTask.doTask(PortUnificationPipeline.java:380)。 connector.grizzly.TaskBase.run(TaskBase.java:265)at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)導致:javax.xml.ws.WebServiceException: java.lang.NullPointerException在com.sun.enterprise.security.jmac.config.PipeHelper.makeFaultResponse(PipeHelper.java:328)at com.sun.enterprise.security.jmac.config.PipeHelper.getFaultResponse(PipeHelper.java:366 )at com.sun.enterprise.webservice.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:227)at com.sun.enterprise.webservice.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:133)at com.sun.xml.ws.api。 pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)at com.sun.xml.ws.api.pipe.Fiber .__ doRun(Fiber.java:595)at com.sun.xml.ws.api.pipe。纖維。 _doRun(Fiber.java:554)at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber。 java:436)at com.sun.xml.ws.server.WSEndpointImpl $ 2.process(WSEndpointImpl.java:243)at com.sun.xml.ws.transport.http.HttpAdapter $ HttpToolkit.handle(HttpAdapter.java:444 )at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:113)at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:87)at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpoint( EjbWebServiceServlet.java:228)在com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServiceServlet.java:157)在javax.servlet.http.HttpServlet.service(HttpServlet.java:847)在com.sun.enterprise.web .AdHocContextValve.invoke(AdHocContextValve.java:114)at org.a位於org.apache.catalina的pache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)。
這也是對http://stackoverflow.com/questions/2695215的回答/ how-to-invoke-a-webservice-from-one-container-in-another-container-in-glassfish ?? – vkraemer 2010-05-07 22:14:02
你應該打開一個您在此答案中嵌入的查詢的其他問題。 – vkraemer 2010-05-07 22:22:18
@vkraemer是這是它的答案http://stackoverflow.com/questions/2695215/how-to-invoke-a-webservice-from-one-container-in-another-container-in-glassfish 以及。 – missionE46 2010-05-13 21:23:34