Hello *

*I have a question re: the form of the generated Service subclass code that
is created when running the wsdl2java tool in CXF
(org.apache.cxf.tools.wsdlto.WSDLToJava) - I am using CXF 2.5.1

When using JAX-WS RI's/Metro's *wsimport *tool (from the 2.1 release),
there is a *generated* static block of code of the form:

    static {
        BOOKORDERMANAGERSERVICE_WSDL_LOCATION =
com.acme.book.webservices.BookOrderManagerService_Service.class.getResource("/META-INF/wsdl/BookOrderManagerService.wsdl");
        WebServiceException e = null;
        if (BOOKORDERMANAGERSERVICE_WSDL_LOCATION == null) {
            e = new WebServiceException("Cannot find
'/META-INF/wsdl/BookOrderManagerService.wsdl' wsdl. Place the resource
correctly in the classpath.");
        }
        BOOKORDERMANAGERSERVICE_EXCEPTION = e;
    }
**
This uses the WSDL file packaged in the JAR file and pulled from the
/META-INF/wsdl location of that JAR using the class.getResource() method as
shown, and works perfectly.

Similar code *generated* with the CXF tools produces this similar block in
the following form:


    static {
        URL url = null;
        try {
            url = new URL("/META-INF/wsdl/BookOrderManagerService.wsdl");
        } catch (MalformedURLException e) {
java.util.logging.Logger.getLogger(BookOrderManagerService.class.getName())
                .log(java.util.logging.Level.INFO,
                     "Can not initialize the default wsdl from {0}",
"META-INF/wsdl/BookOrderManagerService.wsdl");
        }
        WSDL_LOCATION = url;
    }

The client code works in EITHER case but the CXF generated code produces
the message:

Jan 7, 2012 8:59:11 AM com.acme.book.webservices.BookOrderManagerService
<clinit>
INFO: Can not initialize the default wsdl from
/META-INF/wsdl/BookOrderManagerService.wsdl
Jan 7, 2012 8:59:21 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL


Obviously it is 2 different approaches with the first one working since the
class.getResource() is always available in the classpath.  The CXF code
accomplishes a similar thing but produces the exception message shown, yet
continues successfully to create the instance...

Jan 7, 2012 3:06:52 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {
http://webservices.book.acme.com/}BookOrderManagerService from WSDL:
jar:file:/C:/Users/xxxxxxxxx/workspace/EclipseIndigo/CXFTestWSClient/deploy/CXFTestWSClient.jar!/META-INF/wsdl/BookOrderManagerService.wsdl

Any insight would be appreciated.

Thanks

Reply via email to