That seems like a nice idea, but I'm unsure if that would be JSR-224
compliant (JAX-WS 2.1, May 2007).  

Section 2.7:  Conformance: A generated service class MUST have a default
(i.e. zero-argument) public construc-
tor. This constructor MUST call the protected constructor declared in
javax.xml.ws.Service, passing
as arguments the WSDL location and the service name. -->The values of the
actual arguments for this call
MUST be equal (in the java.lang.Object.equals sense) to the values specified
in the mandatory
WebServiceClient annotation on the generated service class itself.<--

>From the --> <-- section above, it appears that whatever the value of the
wsdlLocation in @WebServiceClient must be used as the URL for the
constructor.

Section 7.5, 7.5 javax.xml.ws.WebServiceClient:  "wsdlLocation:  The URL for
the WSDL description of the service.

When resolving the URI specified as the wsdlLocation element or any document
it may transitively
reference, a JAX-WS implementation MUST use the catalog facility defined in
section 4.4."

wsdlLocation must be a URL then, which would preclude the classpath: option.

I would check Section 4.4--using a catalog might help you here.  Also,
another issue, I have not found that the hardcoded file must be located
relative to the JVM.  For my DoubleIt example, it hardcodes to a specific
directory:

url = new
URL("file:/work/workspace/DoubleIt/trunk/service-war/src/main/webapp/WEB-INF/wsdl/DoubleIt.wsdl");

Perhaps you can use a relative path as well--which would give you a little
bit more flexibility without needing a catalog.

HTH,
Glen



sreuland wrote:
> 
> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
> Service class throws a MalFormed exception. The only way I've managed to
> get the URL() constructor to find my.wsdl is when i specify a 'file'
> scheme such as 'file:my.wsdl', then the URL constructor finds the file but
> it has to be relative to the starting directory of the jvm(not embedded in
> a jar). I figured if code generation in wsdl2java could recognize
> 'classpath:' scheme in wsdlLocation param and generate url =
> Service.class.getClassLoader().getResource("my.wsdl");  instead of try {
> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
> runtime should find wsdl from classpath since java.net.URL constructor
> won't.
> 

-- 
View this message in context: 
http://www.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p20301958.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to