如何从使用现有 XSD 类型的 WSDL 构建 Java
我正在尝试创建一个使用现有类型的新网络服务。这些类型是在我们从第三方收到的现有 XSD 以及匹配的 JAR 文件中定义的。如果我只是将该 XSD 导入到 WSDL 中并构建 Java(使用 wsconsume),那么也会构建所有现有类型。由于我们已经有一个包含所有这些 Java 类型的 JAR,因此我们不想再次生成它们。
作为后备选项,我可以让 ant 删除这些冗余文件,但我宁愿找到一种方法来首先不生成它们。
有什么建议吗?
I'm trying to create a new web service that uses existing types. The types are defined in an existing XSD that we received, along with a matching JAR file, from a third party. If I just import that XSD into my WSDL and build the Java (using wsconsume), then all the existing types are also built. Since we already have a JAR that contains all these Java types, we don't want to generate them again.
As a fallback option I can have ant delete these redundant files, but I'd rather find a way to not generate them in the first place.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

我的建议是使用 Spring WebServices 它应该可以帮助您实现这样的实现,它
@PayloadRoot
注释的方法的@Endpoint
类并使用JAR 中的类型参数您拥有的
生成 WSDL如果您拥有的 JAR 具有带有 JAXB 注释的类,那么您可以直接使用 JAXB,如果没有 - 您始终可以使用其他绑定技术。
My suggestion is to use Spring WebServices which should help you with such implementation, it:
@Endpoint
class with methods annotated with e.g.@PayloadRoot
and using parameters of types from the JAR you've got<sws:dynamic-wsdl />
If the JAR you've got has classes with JAXB annotations then you can use JAXB directly, if not - you can alway use other binding technologies.