使用 HTTP 身份验证和 maven-jaxb2-plugin 为 WSDL 生成模式 [英] Generate a schema for WSDL with HTTP authentication and the maven-jaxb2-plugin

查看:122
本文介绍了使用 HTTP 身份验证和 maven-jaxb2-plugin 为 WSDL 生成模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 jaxb2 插件生成可从安全 URL 访问的 WSDL(使用用户 ID 和密码进行基本身份验证).

I want to use jaxb2 plugin to generate a WSDL accessible from a secure URL (basic authentication with user id and password).

我应该在哪里指定凭据来生成架构?如果不提供它们,我会在模式生成过程中收到一个 401 错误.

Where should I specify the credentials to generate the schema? Without providing them, I get one 401 error during schema generation.

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.13.1</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <schemaLanguage>WSDL</schemaLanguage>
        <generatePackage>hello.wsdl</generatePackage>
        <schemas>
            <schema>
                <url>http://www.webservicex.com/stockquote.asmx?WSDL</url>
            </schema>
        </schemas>
    </configuration>
</plugin>

推荐答案

目前不支持下载 schemas 的 HTTP 身份验证,添加它的拉取请求被拒绝,因此不会实施.这是因为最好下载 WSDL 并在本地处理它,而不是在每次构建期间下载它:

HTTP authentication to download schemas is currently not supported, and a pull request to add it was declined, so it won't be implemented. This is because it is always preferable to download the WSDL and work on it locally, rather than downloading it during each build:

  • 它使构建高度依赖于 WSDL 的可用性,这可能无法保证并且最终可能无缘无故地导致构建失败;
  • 构建不再可重复,这与 Maven 所追求的相反,因为您不一定控制远程 WSDL 的更新方式和时间.

一种有点hacky的方式改为使用 Apache CXF Codegen 插件执行此操作,但我真的不推荐它.

There is a somewhat hacky way to do this with Apache CXF Codegen Plugin instead, but I really wouldn't recommend it.

这篇关于使用 HTTP 身份验证和 maven-jaxb2-plugin 为 WSDL 生成模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆