On Sunday 09 January 2011 1:43:14 pm Benson Margulies wrote:
> Are you sure that you don't have a global proxy config for your
> browser that you haven't established in the java program?
> 
> Have you tried writing a tiny Java program to just connect to that URL?

That would be my suggestion as well.  Immediately before your call to the 
DynamicClientFactory, just do something like:


URL url = new URL( 
"http://localhost:8080/multiModuleProjectArtifactIdWeb/testservice/testservice?wsdl";);
url.getContent();

or similar to see if it can get it.   If not, then it's more of a JVM level 
issue.

Dna



> 
> On Fri, Dec 31, 2010 at 3:44 PM, kbhatt <kbh...@rediffmail.com> wrote:
> > Hello,
> > 
> > I have written a simple(cxf based) web service. When I try to access it
> > from(cxf based web service) client, I am getting the connection refused
> > error.
> > 
> > My web service is as follows:
> > 
> > @WebService
> > public interface ITest {
> > 
> >        String sayHi(String name);
> > 
> > }
> > 
> > @WebService(targetNamespace ="http://localhost.ws";, name="testSOAP")
> > public class Test implements ITest {
> >   @Override
> >        public String sayHi(String name) {
> >                return "Hi "+name;
> >        }
> > }
> > 
> > 
> > Client code is as follows
> > 
> > Client client =
> > dcf.createClient("http://localhost:8080/multiModuleProjectArtifactIdWeb/t
> > estservice/testservice?wsdl"); Object[] results = client.invoke("sayHi",
> > "kamlesh");
> > String result = (String)results[0];
> > 
> > When I run this client, I am getting the "connection refused" error. I am
> > invoking this client code from swing UI button click action. I am using
> > cxf version 2.2.10.
> > 
> > Please note I am able to access the wsdl at above url from browser.
> > 
> > Following is the exception stack of the client.
> > 
> > INFO: Pre-instantiating singletons in
> > org.springframework.beans.factory.support.defaultlistablebeanfact...@1f94
> > a1f: defining beans
> > [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.
> > spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250
> > BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org
> > .apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configu
> > rer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport
> > .DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManag
> > er,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.
> > apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLife
> > CycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoi
> > nt.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,
> > org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoi
> > nt.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apac
> > he.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContrac
> > tResolverRegistry,org.apache.cxf.binding.corba.CorbaBindingFactory,org.ap
> > ache.cxf.binding.corba.wsdl.WSDLExtensionRegister#0,org.apache.cxf.jaxws.
> > context.WebServiceContextResourceResolver,org.apache.cxf.jaxws.context.We
> > bServiceContextImpl,org.apache.cxf.binding.soap.SoapBindingFactory,org.ap
> > ache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.cu
> > stomEditorConfigurer,org.apache.cxf.binding.xml.XMLBindingFactory,org.apa
> > che.cxf.ws.addressing.policy.AddressingAssertionBuilder,org.apache.cxf.ws
> > .addressing.policy.AddressingPolicyInterceptorProvider,org.apache.cxf.ws.
> > addressing.policy.UsingAddressingAssertionBuilder,org.apache.cxf.javascri
> > pt.JavascriptQueryHandlerRegistry,org.apache.cxf.transport.local.LocalTra
> > nsportFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBui
> > lder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.
> > apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache
> > .cxf.transport.http.ClientOnlyHTTPTransportFactory,org.apache.cxf.managem
> > ent.InstrumentationManager,org.apache.cxf.transport.http_jetty.JettyHTTPT
> > ransportFactory,org.apache.cxf.transport.jms.JMSTransportFactory,org.apac
> > he.cxf.binding.object.ObjectBindingFactory,org.apache.cxf.binding.http.Ht
> > tpBindingFactory,org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader
> > ,org.apache.cxf.ws.policy.AssertionBuilderRegistry,org.apache.cxf.ws.poli
> > cy.PolicyInterceptorProviderRegistry,org.apache.cxf.ws.policy.attachment.
> > external.DomainExpressionBuilderRegistry,org.apache.cxf.ws.policy.attachm
> > ent.external.EndpointReferenceDomainExpressionBuilder,org.apache.cxf.ws.p
> > olicy.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.MTOMPolicyInterc
> > eptorProvider,org.apache.cxf.ws.rm.RMManager,org.apache.cxf.ws.rm.policy.
> > RMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMAssertionBuilder,org.a
> > pache.cxf.binding.corba.wsdl.WSDLExtensionRegister#1]; root of factory
> > hierarchy
> > org.apache.cxf.service.factory.ServiceConstructionException: Could not
> > resolve URL
> > "http://localhost:8080/multiModuleProjectArtifactIdWeb/testservice/testse
> > rvice?wsdl". at
> > org.apache.cxf.endpoint.dynamic.DynamicClientFactory.composeUrl(DynamicCl
> > ientFactory.java:566) at
> > org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(Dynamic
> > ClientFactory.java:253) at
> > org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(Dynamic
> > ClientFactory.java:198) at
> > org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(Dynamic
> > ClientFactory.java:191) at
> > org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(Dynamic
> > ClientFactory.java:146) at
> > tv.socialkast.client.ws.WSClient.<init>(WSClient.java:56) 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: java.net.ConnectException: Connection refused: connect
> >        at java.net.PlainSocketImpl.socketConnect(Native Method)
> >        at java.net.PlainSocketImpl.doConnect(Unknown Source)
> >        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> >        at java.net.PlainSocketImpl.connect(Unknown Source)
> >        at java.net.SocksSocketImpl.connect(Unknown Source)
> >        at java.net.Socket.connect(Unknown Source)
> >        at sun.net.NetworkClient.doConnect(Unknown Source)
> >        at sun.net.www.http.HttpClient.openServer(Unknown Source)
> >        at sun.net.www.http.HttpClient.openServer(Unknown Source)
> >        at sun.net.www.http.HttpClient.<init>(Unknown Source)
> >        at sun.net.www.http.HttpClient.New(Unknown Source)
> >        at sun.net.www.http.HttpClient.New(Unknown Source)
> >        at
> > sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
> > Source)
> >        at
> > sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
> > at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
> > at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
> > Source)
> >        at
> > org.apache.cxf.resource.URIResolver.tryFileSystem(URIResolver.java:167)
> > at org.apache.cxf.resource.URIResolver.<init>(URIResolver.java:90) at
> > org.apache.cxf.endpoint.dynamic.DynamicClientFactory.composeUrl(DynamicCl
> > ientFactory.java:558) ... 31 more
> > java.lang.NullPointerException
> >        at
> > tv.socialkast.client.ws.WSClient.invokeUploadMetaDataService(WSClient.jav
> > a:68) at
> > tv.socialkast.upload.client.gui.UploadDirectoryChooser$DoneActionListener
> > .actionPerformed(UploadDirectoryChooser.java:383)
> > 
> > 
> > 
> > --
> > View this message in context:
> > http://cxf.547215.n5.nabble.com/CXF-Client-connection-refused-error-tp33
> > 23904p3323904.html Sent from the cxf-user mailing list archive at
> > Nabble.com.

-- 
Daniel Kulp
dk...@apache.org
http://dankulp.com/blog

Reply via email to