Search code examples
soapsoap-clientmaven-jaxb2-pluginjaxb2-maven-plugin

how can JAXB2 directly use WSDL url instead of .WSDL file


I have installed the JAXB2 maven plugin in my project. The .WSDL file which generated from my SOAP WebService is located in the project directory, But I want JAXB2 to directly use WSDL URL instead of using the .wsdl file.


Solution

  • For maven-jaxb2-plugin see:

    https://github.com/highsource/maven-jaxb2-plugin/wiki/Specifying-What-To-Compile

    For WSDL it will be something like:

    <configuration>
        <schemaLanguage>WSDL</schemaLanguage>
        <schemas>
            <schema>
                <url>https://www.acme.com/my.WSDL</url>
            </schema>
        </schemas>
    </configuration>
    

    schemaLanguage is optional, defaults to autodetection.

    Having said this, I normally do not recommend compiling online resources unless you want your builds to fail unpredictably due to networking or HTTPS problems.

    Instead, make a local copy and use catalog files to rewrite URLs.