File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to use enum types with Axis2?" Watch "How to use enum types with Axis2?" New topic
Author

How to use enum types with Axis2?

Ram Charan
Greenhorn

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:

WSDL:
<xs:complexType name="Event">
<xs:sequence>
<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:sequence>
</xs:complexType>
<xs:complexType name="EventType">
<xs:complexContent>
<xs:extension base="xs:Enum">
<xs:sequence>
<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" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>


Event:

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....

}

EventType:

public enum EventType implements Serializable
{
COMPOSITE_TEST_START,
COMPOSITE_TEST_CREATED_SUCCESSFULLY;

EventType()
{
}
}
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...

-Ram


thanks
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
See: Enums.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use enum types with Axis2?