I have a question about the static initializer that WSDL2Java places
in service stubs.

When using wsdl2java to generate code, my service classes have static
initializers like the following:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    static {
        URL url = 
CompanyService.class.getResource("data/wsdl/dfp-CompanyService.wsdl");
        if (url == null) {
            java.util.logging.Logger.getLogger(CompanyService.class.getName())
                .log(java.util.logging.Level.INFO,
                     "Can not initialize the default wsdl from {0}",
        "data/wsdl/dfp-CompanyService.wsdl");
        }
        WSDL_LOCATION = url;
    }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The path "data/wsdl/dfp-CompanyService.wsdl" is the wsdl argument
given to wsdl2java.

I'm a little confused about this initializer.  getResource(...) finds
named a item in the JVM's classpath; and for me, that would be a path
inside a jar file.

I thought, "No problem -- I'll just package the wsdls in a jar, using
the same relative paths that I gave to wsdl2java".  However

  getResource("data/wsdl/dfp-CompanyService.wsdl")

returns a null pointer.  To get a jar:file: URL from getResource(),
you'd need a leading slash:

  getResource("/data/wsdl/dfp-CompanyService.wsdl")

I'd like to avoid the "Can not initialize ..." message every time my
JVM loads a Service class.  How should I be specifying the wsdl
location to wsdl2java to avoid this?

Thanks in advance.

Steve

Attachment: pgpf9uo0jGwmW.pgp
Description: PGP signature

Reply via email to