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(ProviderIm
>pl .java:65)
>       at javax.xml.ws.Service.<init>(Service.java:56)
>       at
> msjava.examples.calculator.client.CalculatorService.<init>(CalculatorS
>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.jav
>a: 83)
>       at
> org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:138)
>       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.jav
>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

Reply via email to