使用CXF的wsdl2java,是否有一种更简单的方法可以从没有版本号的xml命名空间生成包名称?

发布于 2024-09-10 08:31:41 字数 391 浏览 4 评论 0原文

我正在使用 Apache CXF 的 wsdl2java 实用程序来创建一些 JAXB 对象和一些 Web 服务代码。我的 WSDL 中的模式有很多名称空间,末尾带有版本号。例如:

http://example.org/sample/namespace/1.0

当 CXF 生成我的 JAXB 对象时,包最终的包名称如下:

org.example.sample.namespace.1_0

由于这是一个具有许多不同命名空间的大型模式,我必须花费大量时间重构代码或使用 -p 选项手动将命名空间映射到包名称。这两个过程都非常耗时。

所以,我想知道是否有人知道是否有更简单的路线。或者我太挑剔了,我应该按原样接受包名称?

I'm using Apache CXF's wsdl2java utility to create some JAXB objects and some web service code. The schema in my WSDL has a lot of namespaces with version numbers on the end. For example:

http://example.org/sample/namespace/1.0

When CXF generates my JAXB objects the packages wind up with package names like this:

org.example.sample.namespace.1_0

Since this is a large schema with many different namespaces I have to spend quite a bit of time either re-factoring code, or using the -p option to manually map the namespaces to package names. Both processes are very time consuming.

So, I'm wondering if anyone knows if there is an easier route. Or am I being too fussy and I should just accept the package names as is?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

杯别 2024-09-17 08:31:41

看起来一堆 -p 标志可能是将名称空间映射到包名称的最快方法。在我的研究中,我还发现您可以通过使用 -b 选项传入 JAXB 绑定文件来实现此目的(我对 JAXB 有点陌生)。这也是一个很好的解决方案,但比使用一堆 -p 标志需要更多的努力。此外,从长远来看,JAXB 绑定文件可能更好,因此您可以根据需要重复该过程。

Looks like a bunch of -p flags is probably the quickest way to map namespaces to package names. In my research I've also found that you can achieve this by using the -b option to pass in a JAXB binding file (I'm a little new to JAXB). This is also a good solution but requires a little more effort than using a bunch of -p flags. Also, the JAXB binding file is probably better in the long run, so you can repeat the process if necessary.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文