为什么在 WTK 枚举存根生成器中使用 java.io.ObjectStreamException?

发布于 2024-07-21 15:06:11 字数 1604 浏览 2 评论 0原文

我正在使用 WCF 中实现的 Web 服务,该服务在接口中定义了枚举。 我正在尝试从 Java BlackBerry 客户端调用此函数。 我正在使用 Eclipse 为 BlackBerry 开发 Java 应用程序。 我正在使用 Sun Java Wireless Toolkit (WTK) 2.5.2 生成存根代码,因为 Web 服务相当大(已被 Windows Mobile 客户端使用)。

当我尝试使用 WTK 生成存根代码时,我在 Eclipse 中收到有关枚举的错误。 在下面的函数中,它抱怨 java.io.ObjectStreamException 无法解析为类型。

private Object readResolve()
    throws java.io.ObjectStreamException {
    return fromValue(getValue());
}

运行存根生成器时,有一个用于 CLDC 1.0 或 CLDC 1.1 的开关。 使用这两个选项生成会导致相同的问题。

我在 Sun 上找到了关于此问题的 论坛帖子,但没有回复。 这篇文章中的人指出,“现在 java.io.ObjectStreamException 不在 CLDC 中,而是在 CDC 中。是否有一个好的工具可以为 J2ME 特别是 CLDC 1.0/1.1 创建 Web 服务存根?” 我通过查看[文档 3< 验证了它在 CLDC 1.1 中不存在/a>)。

Eclipse 中有两个快速修复程序可以修复这种情况:1)在包“java.io”中创建类“ObjectStreamException”或 2)修复项目设置(需要我添加引用)。

更新:

这是 JSR-172 规范的内容...

5.2.5 枚举 JAX-RPC 子集不提供对 XML 枚举的支持。

5.2.6 通过限制派生的简单类型 JAX-RPC 子集不提供对通过限制派生简单类型的支持。

WCF 枚举的 WSDL 生成 ,其中 包含 。 那么我是否只是说这个字段是一个 int 并定义常量?

这只是 WTK 中的一个错误吗? 如果是的话,我向 Sun 提交了一份错误报告,看看他们是否回应。 为什么工具包不将其标记为错误?

所以现在我需要更改接口,使其符合 JSR-172。 是否有工具可以读取 WSDL 并指出合规性问题?

I am using a web service implemented in WCF which has enums defined in the interface. I am trying to call this from a Java BlackBerry client. I am using Eclipse to develop the Java application for BlackBerry. I am using the Sun Java Wireless Toolkit (WTK) 2.5.2 to generate stub code since the web service is rather large (already in use by a Windows Mobile client).

When I try generating stub code using the WTK, I get errors in Eclipse about the enums. In the following function, it complains that java.io.ObjectStreamException cannot be resolved to a type.

private Object readResolve()
    throws java.io.ObjectStreamException {
    return fromValue(getValue());
}

When running the Stub Generator, there is a switch for either CLDC 1.0 or CLDC 1.1. Generating with both options result in the same issue.

I found a forum post about this at Sun with no response. The person in this post states that, "Now java.io.ObjectStreamException is not in CLDC but is in CDC instead. Is there a good tool out there for creating Stubs for Web Services for J2ME specifically CLDC 1.0/1.1 ?" I verified that it doesn't exist in CLDC 1.1 by looking at the [documentation 3).

There are two quick fixes available in Eclipse to fix this situation: 1) Create class 'ObjectStreamException' in package 'java.io' or 2) Fix project setup (which is wanting me to add a reference).

Update:

Here is what the JSR-172 specification says...

5.2.5 Enumeration
The JAX-RPC Subset does not provide support for XML enumerations.

5.2.6 Simple Types Derived By Restriction
The JAX-RPC Subset does not provide support for deriving simple types by restriction.

The WSDL for the WCF enumeration generates a <xs:simpleType> with <xs:restriction> containing <xs:enumeration>. So do I just say this field is an int instead and define constants?

Is this just a bug in the WTK? In case it was, I filed a bug report with Sun and will see if they respond. Why wouldn't the toolkit flag this as an error?

So now I need to change the interface so that it is JSR-172 compliant. Are there tools to read WSDL and point out compliancy issues?

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

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

发布评论

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

评论(1

心凉 2024-07-28 15:06:11

CLDC 和 Wireless Toolkit 都使用 Java Micro Edition。
JavaME 基于 java 语言的第 2 版,这意味着没有泛型和枚举。

研究 Blackberry 手机 Web 服务的第一步是阅读 JSR-172 规范。

CLDC and the Wireless Toolkit both use Java Micro Edition.
JavaME is based on version 2 of the java language, which means no generics and no enums.

The first step in investigating Web Services for your Blackberry handset would be to read the JSR-172 specifications.

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