File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes How to use enum types with Axis2? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to use enum types with Axis2?" Watch "How to use enum types with Axis2?" New topic

How to use enum types with Axis2?

Ram Charan

Joined: Apr 07, 2004
Posts: 12
I have created a simple webservice with Axis2, which takes in an object of type Event as an input argument. This Event class has a member called EventType. When I generate code using WSDL2Java tool in axis2, I am unable to figure out how to create and event and set event type in it to the proper enum I want. Here are code fragments:

<xs:complexType name="Event">
<xs:element minOccurs="0" name="eventID" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="eventMessage" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="eventType" nillable="true" type="ax22:EventType" />
<xs:complexType name="EventType">
<xs:extension base="xs:Enum">
<xs:element minOccurs="0" name="COMPOSITE_TEST_CREATED_SUCCESSFULLY" nillable="true" type="ax22:EventType" />
<xs:element minOccurs="0" name="COMPOSITE_TEST_START" nillable="true" type="ax22:EventType" />


public class Event implements Serializable
/** Serial UID */
private static final long serialVersionUID = 1L;

/** A unique ID for the event */
private String eventID;

/** Event message */
private String eventMessage;

/** The event type */
private EventType eventType;
// I have get and set methods for above here....



public enum EventType implements Serializable

I am able to create the Event object in the web service client. I am unable to figure out how to set the event type in it...


Peer Reynders

Joined: Aug 19, 2005
Posts: 2930
See: Enums.

I agree. Here's the link:
subject: How to use enum types with Axis2?
jQuery in Action, 3rd edition