You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <bi...@basistech.com> on 2007/08/08 21:57:46 UTC

wsdl2java versus ?wsdl URL processing

I've just used wsdl2java in CXF for the first time. My goal here is to
migrate an existing service from a C++ web service toolkit to CXF. While
I'm starting with an existing WSDL, from here I'd like to treat the
generated JAXB/JAX-WS code as normative.

So, I'd like to ensure that the usual ?wsdl URL behaves itself via the
usual mechanism.

Question 1: If I just change the generated @javax.jws.WebService to take
out the wsdl location option, will the default collapse to the standard
?wsdl location?

Question 2: Does CXF has a side-door so that I can put a WSDL file on
classpath and have its contents served up as the response to ?wsdl?
Obviously, if I avail myself of this, I'm continuing to treat the wsdl
as normative, but I'm avoiding having to make my own arrangements to
serve it up.

Re: wsdl2java versus ?wsdl URL processing

Posted by Daniel Kulp <dk...@apache.org>.
Benson,

On Wednesday 08 August 2007 15:57, Benson Margulies wrote:
> Question 1: If I just change the generated @javax.jws.WebService to
> take out the wsdl location option, will the default collapse to the
> standard ?wsdl location?

Not sure what that question is asking.   On the server side, what will 
happen is it will use the annotations in the code to produce a wsdl if 
someone asks for it via ?wsdl.    On the client side, you'll just need 
to specify the ?wsdl location when you create the service.   


> Question 2: Does CXF has a side-door so that I can put a WSDL file on
> classpath and have its contents served up as the response to ?wsdl?
> Obviously, if I avail myself of this, I'm continuing to treat the wsdl
> as normative, but I'm avoiding having to make my own arrangements to
> serve it up.

There are always side/back doors for these things...   :-)

1) Leave the wsdlLocation annotations, but use a "classpath:" URL.
wsdlLocation="classpath:/wsdl/MyService.wsdl"

2) Leave the wsdlLocation, but point to something that is setup with a 
JAX-WS catalog.  (little complex)

3) If you are programatically creating the endpoint with 
Endpoint.publish(...), you can do:
Endpoint ep = Endpoint.create(....);
ep.setProperty(MessageContext.WSDL_DESCRIPTION, "/path/to/wsdl");
ep.publish(...);

4) You can completely configure the wsdl stuff via the ServiceFactory 
stuff if you want.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: wsdl2java versus ?wsdl URL processing

Posted by Willem Jiang <ni...@iona.com>.
Hi Benson,

Please see the comments in the mail.
Benson Margulies wrote:
> I've just used wsdl2java in CXF for the first time. My goal here is to
> migrate an existing service from a C++ web service toolkit to CXF. While
> I'm starting with an existing WSDL, from here I'd like to treat the
> generated JAXB/JAX-WS code as normative.
>
> So, I'd like to ensure that the usual ?wsdl URL behaves itself via the
> usual mechanism.
>
> Question 1: If I just change the generated @javax.jws.WebService to take
> out the wsdl location option, will the default collapse to the standard
> ?wsdl location?
>
>   
If you specify the wsdl location in the WebService annotation , CXF will 
load the wsdl to build up the service model.
If you do not specify the wsdl location in the WebService annotation. 
CXF will build the service model from Java class (SEI).

And CXF's ?wsdl  function is based on the service model to wsdl file.
If we can make sure the service models which we build from the wsdl and 
which we build from the java class are same to each other,
there should be no difference whether you set the wsdl location in the 
WebService annotation or not.

In most case , I can say it is true in CXF and I prefer the wsdl first 
approach if you are jump between C++ and Java.

> Question 2: Does CXF has a side-door so that I can put a WSDL file on
> classpath and have its contents served up as the response to ?wsdl?
> Obviously, if I avail myself of this, I'm continuing to treat the wsdl
> as normative, but I'm avoiding having to make my own arrangements to
> serve it up.
>
>   
As I had said , we just do not support to response the ?wsdl with your 
specified wsdl file now.
But we have a JIRA [1]task for it . Maybe you can monitor it to see if 
it is ready to use.
 
[1] https://issues.apache.org/jira/browse/CXF-341

Willem.