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 2009/09/23 17:17:25 UTC

Re: WSDL2Java and javax.xml.ws.Service => Why is WSDL Required for Instanciation?

On Wed September 23 2009 5:09:43 am Jens Meuller wrote:
> Hello,
> 
> I would be kind to help me with my question. As the CFX Website states in
> the (WSDL2Java) "Consumer" examples, for a Consumer it is always necessary
> to have the "Original" WSDL File available from whicht the Code was
> generated. This WSDL is either passed (see cited text below) via the
> Parametered-Constructor or seems to be implicitly called at the original
> adress if the Service ist instanciated via the default Constructor. (The
> Code generated by CXF WSDL2Java seems to generate a static member with the
> URL and then uses the parametered Constructor for Instanciation...)
> 
> 1. Isn't that an enourmous waste of resources if the WSDL file is called
>  for every (or at least the first) invocation (in case this url is cached
>  somehow)? 

The WSDL is cached, so it is a first client creation hit.   That said, 
internally, we need schema for various reasons so if the WSDL is not used (no 
schema provided), we have JAXB create a Schema for us so the end result may be 
about the same if wsdl is used or not.  (except for possibly delays obtaining 
the wsdl like via https or slow connections or similar)


> 2. What is the idea behind the retrieval of the WSDL file? 

Not everything in the wsdl is generated into code per jaxws spec.   The 
primary missing piece is that actual endpoint URL.   No where in the generated 
code is the actual URL to communicate with.      


> As the client
> Code has already been generated via WSDL2Java any change in the WSDL file
> can't be "integrated" in the code anymore. The code is static and compiled
> and has all the information needed to run properly(?) Why is the WSDL file
> useful here and retrieved at all?

There are others cases as well.   RPC/Lit has issues if operation namespaces 
don't match the service namespace (rare).   WSDL's with policies in them (like 
security policies and mtom and ws-addressing and such) also don't result in 
the policies being output into the generated code.   Thus, the WSDL is needed 
for them.      Policies are the big one really.   You COULD update a security 
policy or turn on ws-addressing or something in the wsdl and not have to 
regenerate the code.   


-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog