views:

405

answers:

1

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?

+1  A: 

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.

QuickRecipesOnSymbianOS
Here is what the JSR-172 specification says...5.2.5 EnumerationThe JAX-RPC Subset does not provide support for XML enumerations.5.2.6 Simple Types Derived By RestrictionThe 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>. Hmmm...doesn't look like that will work.
chrish