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

查看:92
本文介绍了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,则每个Web服务项目中都会复制常见的JAXB类。

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开始,有一个名为剧集的功能可以用来促进这个。

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天全站免登陆