2010-12-20 23 views
6

Próbuję wywołać usługę WWW z klienta java, używając apache CXF. Poniżej znajduje się fragment kodu mojego klienta.Błąd klienta usługi sieci Web CXF

Client client = new ClientImpl(new URL("http://localhost:8080/socialkast-web/services/skservice?wsdl")); 
Object[] results = client.invoke("uploadVideoMetaData", new Object[] {metaData}); 
    String result = (String)results[0]; 

Otrzymuję błąd parsowania, mimo że mam dostęp do pliku wsdl z przeglądarki. Poniżej znajduje się stos wyjątków.

INFO: Pre-instantiating singletons in org.s[email protected]14f5a31: defining beans [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.corba.CorbaBindingFactory,org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister#0,org.apache.cxf.jaxws.context.WebServiceContextResourceResolver,org.apache.cxf.jaxws.context.WebServiceContextImpl,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder,org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider,org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder,org.apache.cxf.javascript.JavascriptQueryHandlerRegistry,org.apache.cxf.transport.local.LocalTransportFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory,org.apache.cxf.management.InstrumentationManager,org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory,org.apache.cxf.transport.jms.JMSTransportFactory,org.apache.cxf.binding.object.ObjectBindingFactory,org.apache.cxf.binding.http.HttpBindingFactory,org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader,org.apache.cxf.ws.policy.AssertionBuilderRegistry,org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry,org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry,org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder,org.apache.cxf.ws.policy.PolicyBuilder,org.apache.cxf.ws.policy.PolicyEngine,org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider,org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider,org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder,org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMManager,org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMAssertionBuilder,org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister#1]; root of factory hierarchy 
org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service. 
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:69) 
at org.apache.cxf.endpoint.ClientImpl.<init>(ClientImpl.java:152) 
at org.apache.cxf.endpoint.ClientImpl.<init>(ClientImpl.java:121) 
at tv.socialkast.client.ws.WSClient.<init>(WSClient.java:42) 
at tv.socialkast.upload.client.gui.UploadDirectoryChooser$DoneActionListener.actionPerformed(UploadDirectoryChooser.java:382) 
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) 
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) 
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) 
at javax.swing.DefaultButtonModel.setPressed(Unknown Source) 
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) 
at java.awt.Component.processMouseEvent(Unknown Source) 
at javax.swing.JComponent.processMouseEvent(Unknown Source) 
at java.awt.Component.processEvent(Unknown Source) 
at java.awt.Container.processEvent(Unknown Source) 
at java.awt.Component.dispatchEventImpl(Unknown Source) 
at java.awt.Container.dispatchEventImpl(Unknown Source) 
at java.awt.Component.dispatchEvent(Unknown Source) 
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) 
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) 
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) 
at java.awt.Container.dispatchEventImpl(Unknown Source) 
at java.awt.Window.dispatchEventImpl(Unknown Source) 
at java.awt.Component.dispatchEvent(Unknown Source) 
at java.awt.EventQueue.dispatchEvent(Unknown Source) 
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) 
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) 
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) 
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
at java.awt.EventDispatchThread.run(Unknown Source) 
**Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://localhost:8080/socialkast-web/services/skservice?wsdl'.: java.net.ConnectException: Connection refused: connect** 
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source) 
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) 
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) 
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:232) 
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:161) 
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:67) 
... 29 more 

Proszę o poradę, czego tu brakuje.

Dzięki.

Odpowiedz

0

Wystarczająco proste: Twój serwer nie odpowiada.

Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://localhost:8080/socialkast-web/services/skservice?wsdl'.: java.net.ConnectException: Connection refused: connect at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source 
+0

Należy pamiętać, że po uzyskaniu dostępu do tego samego adresu URL wsdl (http: // localhost: 8080/socialkast-web/services/skservice? Wsdl) z przeglądarki, otrzymuję prawidłowy plik wsdl wyświetlany w przeglądarce. – Alex

+0

Czy mógłbyś prawdopodobnie zaniedbać umieszczenie transportu HTTP w ścieżce klas? Polecam opublikowanie JIRA w przypadku testowym na cxf.apache.org, łatwiej byłoby ci tam pomóc. – bmargulies

+0

pewnie opublikuję jirę. Czy możesz opracować kroki dotyczące umieszczania transportu HTTP w ścieżce klas. – Alex

1

To może być coś naprawdę oczywistego, ale czy próbowałeś już trafić na swoją usługę z przeglądarki? Na przykład spróbuj uzyskać wsdl, wskazując swoją przeglądarkę internetową na:

http://localhost:8080/socialkast-web/services/skservice?wsdl 

Jeśli nie możesz się tam dostać, być może twój serwer nie działa.

Powiązane problemy