You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2007/08/27 19:47:54 UTC
Re: Why does Service need the WSDL again when using classes generated from WSDL?
Per,
Technically, JAX-WS doesn't need the WSDL again at runtime if you don't
want it. However, it does require a bit of extra configuration. The
main use of grabbing the wsdl at runtime is to grab the "live"
soap:address location. Basically, you could publish a static wsdl at a
known location and if the server moves, just update the soap:address in
that static wsdl and clients would be all OK. Also, the "live" wsdl
may have some WS-Policy assertions or something in it that doesn't get
recorded in the JAX-WS annotations.
If you don't want the wsdl, that's fine. It's a bit more work though.
Service service = new Service(serviceQName);
service.addPort(portName,
SOAPBinding.SOAP11HTTP_BINDING,
endpointURL);
Foo foo = service.getPort(portName, Foo.class);
foo.bar(bleech);
Dan
On Monday 27 August 2007, Per Olesen wrote:
> Hi,
>
> I use the cxf-codegen-plugin maven plugin to generate java classes for
> a wsdl of mine. I then use the generated service like this:
>
> new FooService(wdlUrl, serviceQname).getFoo().bar(bleech)
>
> But why does the FooService actually need the wsdlUrl again? I can see
> it resolves it. I thought, that when i chose the path of generating
> classes from WSDL to java, I had done all the wsdl access I needed to
> do offline.
>
> Guess this is a problem with understanding from my part. Understanding
> of why it (cxf/jaxws) needs the wsdl again!?
>
> Regards, Per
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
Re: Why does Service need the WSDL again when using classes
generated from WSDL?
Posted by Per Olesen <po...@nordija.com>.
Hi Andrew,
>
> You can use
>
> Service.create(serviceQName)
>
> to avoid having to subclass Service.
Thanks for the input. I am using that now, as it seems just a little bit
cleaner :)
Re: Why does Service need the WSDL again when using classes
generated from WSDL?
Posted by Andrew Dinn <ad...@redhat.com>.
Per Olesen wrote:
> Hi Daniel,
>
> Thanks! You led me in the right direction, even though I was unable to use
> your code directly as shown. You wrote:
>
>> Service service = new Service(serviceQName);
>
> But that constructor is protected. And the no-args one uses a default
> place for the wsdl (where it was at stub-generation time).
You can use
Service.create(serviceQName)
to avoid having to subclass Service.
regards,
Andrew Dinn
-----------
JBoss, a Division of Red Hat
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire,
SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David
Owens (Ireland)
Re: Why does Service need the WSDL again when using classes
generated from WSDL?
Posted by Per Olesen <po...@nordija.com>.
Hi Daniel,
Thanks! You led me in the right direction, even though I was unable to use
your code directly as shown. You wrote:
> Service service = new Service(serviceQName);
But that constructor is protected. And the no-args one uses a default
place for the wsdl (where it was at stub-generation time).
What I ended up doing was this:
QName fooServiceQName = new QName("myns", "FooService");
FooService service = new FooService(null, fooServiceQName);
QName portName = new QName("myns", "Foo");
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointURL);
Foo port = service.getPort(portName, Foo.class);
Giving null to the FooService constructor for wsdl-url makes it not read
it. Kind of un-documented, I think, but works.
Thanks again for the help.
/Per