This is part of the JAX-WS spec: Greeter port = service.getSoapPort(); BindingProvider provider = (BindingProvider)port; provider.getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
Dan On Tuesday 22 January 2008, Yadav, Yogendra (IT) wrote: > Hi Dan, > I looked hard could not find out how to set ENDPOINT_ADDRESS on the > client. The generated service class has nothing to this effect. Do you > have an example for this ? > > Thanx > -yogen > > > > -----Original Message----- > From: Daniel Kulp [mailto:[EMAIL PROTECTED] > Sent: Monday, January 21, 2008 4:16 PM > To: cxf-user@incubator.apache.org > Cc: Yadav, Yogendra (IT) > Subject: Re: WSDL retrieval at runtime, is it required? > > > It's not "totally required". You CAN call the service constructor > passing "null" for the wsdl and it should create the service fine. > You'll need to manually set the ENDPOINT_ADDRESS property on the > client to tell it the URL to hit, but that's not too hard to do. > > One note: when you run wsdl2java, you CAN specify a "wsdlLocation" > flag to specify a different location to be burned in. A popular > setting would be the URL of the endpoint with the ?wsdl on it. > > Dan > > On Friday 18 January 2008, Yadav, Yogendra (IT) wrote: > > Hi, > > I have already used "wsdl2java -client" to generate client code to > > access a CXF service. The WSDL that I provided does include service > > endpoint information. I see that, now at runtime the client code > > tries > > > > to retrieve the WSDL again (see the stacktrace below), why? Does it > > only do it to extract the service location information? Why didn't > > the > > > > generated code cache location information? Is there anyway to avoid > > it? > > > > Exception in thread "main" javax.xml.ws.WebServiceException: > > org.apache.cxf.service.factory.ServiceConstructionException: Failed > > to > > > >create service. > > at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:132) > > at > > org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(Provider > >Im pl .java:65) > > at javax.xml.ws.Service.<init>(Service.java:56) > > at > > msjava.examples.calculator.client.CalculatorService.<init>(Calculato > >rS er vice.java:41) > > at > > msjava.examples.calculator.client.Calculator_CalculatorJettyHTTPPort > >_C li ent.main(Calculator_CalculatorJettyHTTPPort_Client.java:53) > > Caused by: > > org.apache.cxf.service.factory.ServiceConstructionException: Failed > > to > > > >create service. > > at > > org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.j > >av a: 83) > > at > > org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:13 > >8) at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:130) > > ... 4 more > > Caused by: javax.wsdl.WSDLException: WSDLException: > > faultCode=PARSER_ERROR: Problem parsing > > 'http://pa912c1n5:8091/Calculator/Calculator'.: > > 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 > >.j av a:199) > > at > > org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl. > >ja va > > > > :163) > > > > at > > org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.j > >av a: 81) > > > > Thanx > > -yogen > > -------------------------------------------------------- > > > > NOTICE: If received in error, please destroy and notify sender. > > Sender > > > > does not intend to waive confidentiality or privilege. Use of this > > email is prohibited when received in error. > > -- > J. Daniel Kulp > Principal Engineer, IONA > [EMAIL PROTECTED] > http://www.dankulp.com/blog > -------------------------------------------------------- > > NOTICE: If received in error, please destroy and notify sender. Sender > does not intend to waive confidentiality or privilege. Use of this > email is prohibited when received in error. -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog