On Mon, Mar 24, 2008 at 1:00 PM, Kalle Korhonen <[EMAIL PROTECTED]> wrote:
> On Sun, Mar 23, 2008 at 7:57 PM, Jervis Liu <[EMAIL PROTECTED]> wrote: > > > On Mon, Mar 24, 2008 at 5:39 AM, Kalle Korhonen < > > [EMAIL PROTECTED]> > > > On Sat, Mar 22, 2008 at 10:47 PM, Glen Mazza <[EMAIL PROTECTED]> > > > > machine locally, running wsdl2java and then coding your SOAP client > > > > using the wsdl2java artifacts generated, similar to here[1]. Once > > done, > > > > any missing XSD's from the server should no longer be a concern for > > you. > > > But it is a concern. I have the generated service stubs, but if I > create > > > service by specifying the the server url (Service.create(new > > > URL("http://<http://some.server/service?wsdl>..."), > > > it'll try to fetch the xsds and fails because of that. The same > doesn't > > > happen if I point to a wsdl from classpath. I need to be able to > specify > > > the > > > service location in code, > > > > You've got it almost right. You need to point your client to use a local > > copy of wsdl file and xsds etc. But you do not need to hard code the > wsdl > > location in your client. Take a look into any CXF sample, for example, > > samples\hello_world. You can see the WSDL location is passed in from > > command > > line or from ant script as below: > > > > I think you misunderstood what we are talking about here; not the the wsdl > location but the location of the service (port) (and originally, how > references to imported resources can and should be resolved). I thought the problem you ran into is that the service your client wants to consume somehow does not come with xsds. Then you work around this by using a local copy of WSDL and xsds. You do not need to reset endpoint address as long as you have set it correclty in your local WSDL, e.g "<http:address location="http://localhost:9000/XMLService/XMLPort"/>". In case you want to override endpoint address, you can use ENDPOINT_ADDRESS_PROPERTY as this is the most standard way to do it. Another thing is that I dont think you need to use Service.create(new URL("http://<http://some.server/service?wsdl>..."). You have run wsdltojava to generate client stubs, havent you? A concrete service implementation class should have been generated by wsdltojava (per JAX-WS 2.1 spec 4.1.1.2, Static case), its easier to use this class directly instead of using Service.create(). eg: StockQuoteService ss = new StockQuoteService(wsdlURL, serviceQname); Greeter port = ss.getSoapPort(); other than Service ss = Service.create(new URL("http://< http://some.server/service?wsdl>", serviceQname); Greeter port = (Greeter)ss.getPort(....); Having said that, the StockQuoteService indeed calls Service.create(...) internally. So if you really want to use Service.create(...) direclty, just make sure you provide it with a local copy of wsdl, also make sure the endpoint address in your local wsdl is correct. Cheers, Jervis > > Kalle >