Skip to main content

JAXB 2.0 or JAX-WS 2.0 isuue with enums

2 replies [Last post]
hr_stoyanov
Offline
Joined: 2004-04-01

Hi all-,
I have class with an enum inside:
------------------------------------
@XmlRootElement
public class FilingResult {
public enum Status {OK, ERROR};
...
}
------------------------------------

I ran wsgen to get a WSDL file/schema1.xsd pair and then wsimport to generate back classes purely for the client side. What I got back is:
------------------------------------
//Generated .../jaxws/FilingResult.java
@XmlAccessorType(AccessType.FIELD)
@XmlType(name = "filingResult")
public class FilingResult {
protected FilingResult$Status status;
...
public FilingResult$Status getStatus() {
return status;
}
}

//Generated .../jaxws/FilingResult$Status.java
@XmlEnum(String.class)
public enum FilingResult$Status {

@XmlEnumValue("ERROR")
ERROR,
@XmlEnumValue("OK")
OK;
}
------------------------------------

What puzzles me is that wsimport produced an illegal class called FilingResult$Status and even compiled it!

Any clue how to fix this? here is the realted extract from the schema1.xsd file as well:

------------------------------------------
...

...
-------------------------------------------

Thanks,
Hristo

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09

Today with JAXB, if I have the following Java code:

[code]
import javax.xml.bind.annotation.*;

@XmlRootElement
public class Test {
public enum Status {OK, ERROR};
public Status status;
}[/code]

I get the following schema:

[code]












[/code]

So perhaps this issue is already fixed?

hr_stoyanov
Offline
Joined: 2004-04-01

Hmmm ... since I am bound to JAX-WS EA2 and use the bundled JAXB stuff, I have to wait a little for Doug&Co. to release the next weekly?

Thanks,
Hristo