Deploying WSDL for a web service in the JAX-WS.jar client

I have a web service created several years ago in C ++ and consumed by the .NET client using C # "wsdl.exe" to create client stubs. For a number of reasons, I also need a Java client and I want to limit the use of Java 6 (JDK 1.6) with JAX-WS. The generated stubs work fine even if they are packaged in .jar, but I have a problem with how JAX-WS Web services clients want to be deployed. It seems that the problem I have is solvable, but none of the suggested methods work.

JAX-WS expects the WSDL to be available, preferably from the network, as it processes the WSDL every time it starts to create bindings. Like jgrowl in creating a web service client with well-known but inaccessible wsdl , the client may not have access to WSDL at the URL used by JAX-WS (which will probably be a file on the build machine or a pointer to localhost). I want to send the WSDL inside the .jar client, but the simplest solution ( -wsdllocation "/path/to/wsdl/in/jar.wsdl") is displaying a warning that I don't want to show.

I would also prefer that the client doesn't do something like a jgrowl solution that seems to work, but not just work. The articles found on WSDL sites are primarily Google’s address servers, but suggest that clients can work with META-INF/jax-ws-catalog.xmlfiles that translate the URL used in -wsdllocationto the path in the .jar file, but they don't seem to work in our testing.

Is there a “recipe” so that I can place the WSDL inside the .jar somewhere and for the JAX-WS client to just work without any extra effort on the part of the client and without warning?

+5
source share
1 answer

URL- WSDL , . -wsdlLocation:

-wsdllocation wsdl/MaintainAddress.wsdl

:

static {
    URL url = null;
    try {
        URL baseUrl;
        baseUrl = demo.ws.service.MaintainAddress_Service.class.getResource(".");
        url = new URL(baseUrl, "wsdl/MaintainAddress.wsdl");
    } catch (MalformedURLException e) {
        logger.warning("Failed to create URL for the wsdl Location: 'wsdl/MaintainAddress.wsdl', retrying as a local file");
        logger.warning(e.getMessage());
    }
    MAINTAINADDRESS_WSDL_LOCATION = url;
}

, , . WSDL wsdl.

.

, spec - , . , wsimport JDK.


, Java EE - . JSR 109. , , jax-ws-catalog.xml .

+3

All Articles