wsimport - 如何在单独的项目/文件夹中生成服务端点类和 JAXB 类 [英] wsimport - how to generate service endpoint classes and JAXB classes in separate projects/folders

查看:24
本文介绍了wsimport - 如何在单独的项目/文件夹中生成服务端点类和 JAXB 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于具有多个 Web 服务(多个 WSDL)的项目,我们正在使用自上而下的方法.每个 Web 服务都需要设置为单独的项目并部署为单独的战争.

We are using a top-down approach for a project with multiple web services (multiple WSDL's). Each web service needs to be set up as a separate project and deployed as a separate war.

问题在于 WSDL 共享一些常见的 .xsd 文件.目前,如果我们为每个 WSDL 运行 wsimport,公共 JAXB 类将在每个 Web 服务项目中复制.

The problem is that the WSDL's share a few common .xsd files. Currently if we run wsimport for each WSDL, the common JAXB classes are being duplicated in each web service project.

理想情况下,我们希望在公共共享项目中单独生成 JAXB 类,然后在每个 Web 服务项目中重用 JAXB 类项目,但是 wsimport 不提供跳过 JAXB 类生成的选项或指定JAXB 类的不同位置.

Ideally we would want to generate the JAXB classes separately in a common shared project, and then reuse the JAXB classes project in each of the web service projects, but wsimport does not provide the option to skip the JAXB class generation OR to specify a different location for the JAXB classes.

对如何在不同的 JAX-WS Web 服务端点之间共享 JAXB 类有任何想法吗?

Any thoughts on how I can share the JAXB classes between different JAX-WS web service endpoints?

推荐答案

我知道这个问题很老了,但我想为那些正在寻找的人分享答案.我知道我花了一段时间才找到答案.

I know that this question is very old, but I wanted to share the answer for those that are looking. I know it took me a while to find the answer.

从 JAXB 2.1 RI 开始,有一个名为episodes"的特性,您可以使用它来促进这一点.

As of JAXB 2.1 RI, there's a feature called "episodes" that you can use to facilitate this.

假设您有一个名为 myschema.xsd 的架构.然后你会想要调用以下内容:

Let's say you have a schema called myschema.xsd. Then you would want to call the following:

xjc -episode myschema.episode myschema.xsd

如果您使用单个调用编译多个 xsd 文件,这也适用.该调用将生成绑定以及 myschema.episode 文件.

This also works if you are compiling multiple xsd files using a single call. The call will produce the bindings as well as the myschema.episode file.

剧集文件是一个特殊的绑定文件.然后,您可以将这个文件与 wsimport 一起使用,如下所示:

The episode file is a special bindings file. You can then use this file with wsimport, like so:

wsimport mywsdl.wsdl -b myschema.episode

wsimport 现在将使用之前生成的 JAXB 文件,并生成任何缺失的内容.

wsimport will now use the previously generated JAXB files, and will generate anything that is missing.

有关详细信息,请参阅此页面.

See this page for more information.

这篇关于wsimport - 如何在单独的项目/文件夹中生成服务端点类和 JAXB 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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