java wsimport 重命名/不同的 ObjectFactory.java

发布于 2024-11-10 08:22:10 字数 449 浏览 2 评论 0原文

我在使用 wsimport 时遇到问题。在我的一个必须进行 wsimport 的 wsdl 中,我有一个名为 "objectFactory" 的复杂类型。有什么方法可以告诉命令 wsimport 创建,同时导入不同的类来维护 JAXB 连接,例如 ObjectFactory.java。换句话说,我可以告诉 wsimport 而不是创建 ObjectFactory.java 一些自定义类,如 MyCustomFactory.java 吗?

是否可以以 complexType name="objectFactory" 映射到具有不同名称的对象(例如 MyObjectFactory.java)的方式自定义映射?

谢谢

I'm having problem with wsimport. In one of my wsdl which has to be wsimported I have a complexType with name "objectFactory". Is there any way to tell command wsimport to create while importing different class for maintaining JAXB connections such is ObjectFactory.java. In other words can I tell wsimport instead of creating ObjectFactory.java some custom class like MyCustomFactory.java?

Is it possible to customize mapping in such a way that complexType name="objectFactory" would map to object with different name like MyObjectFactory.java?

Thx

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

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

发布评论

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

评论(1

眼睛会笑 2024-11-17 08:22:10

JAX-WS(wsimport 是其中的一部分)使用 JAXB 生成 XML 绑定文件(并进行实际绑定)。因此,您需要查看有关自定义 JAXB 绑定的文档。它也适用于您的情况。

在您的情况下,您将使用类似以下内容:

<xsd:complexType name="objectFactory">
  <xsd:annotation>
  <xsd:appinfo>
     <jxb:class name="MyObjectFactory" />
  </xsd:appinfo>
  </xsd:annotation>
  <!-- ... rest of your specification ... ->
</xsd:complexType>

此示例用于 XML 架构/WSDL 中的内联自定义。您还可以将此信息作为外部配置提供。

JAX-WS (of which wsimport is a part) uses JAXB for generating the XML binding files (and for doing the actual binding). So you'll want to check out this documentation on customizing JAXB bindings. It applies just as well to your case.

In your case you'd use something like this:

<xsd:complexType name="objectFactory">
  <xsd:annotation>
  <xsd:appinfo>
     <jxb:class name="MyObjectFactory" />
  </xsd:appinfo>
  </xsd:annotation>
  <!-- ... rest of your specification ... ->
</xsd:complexType>

This example is for inline customization in your XML Schema/WSDL. You can also provide this information as external configuration.

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