This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use enum types with Axis2?

 
Ram Charan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See: Enums.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic