A WSDL representation as below :
<xs:simpleType name="customerType">
<xs:restriction base="xs:string">
<xs:enumeration value="PRIVATE"/>
<xs:enumeration value="BUSINESS"/>
</xs:restriction>
</xs:simpleType>
resulted in the code as below by cxf-codegen-plugin:
public enum CustomerType {
PRIVATE, BUSINESS
}
Can be represented in WSDL as:
How can we represent enum in WSDL so that the cxf-codegen-plugin can generate code as below:
public enum CustomerType {
PRIVATE{public BigInteger getNcid() {
return new BigInteger("1");
},
BUSINESS{public BigInteger getNcid() {
return new BigInteger("2");
}
public abstract BigInteger getNcid();
}
If we can't have cxf-codegen generate this what is the best way we can handle this case in java. I really appreciate your help.
WSDL Elements. Definition − It is the root element of all WSDL documents. It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document, and contains all the service elements described here. Data types − The data types to be used in the messages are in the form of XML schemas.
By default, the associated constant values of enum members are of type int; they start with zero and increase by one following the definition text order. You can explicitly specify any other integral numeric type as an underlying type of an enumeration type.
WSDL uses the W3C XML Schema specification as its default choice to define data types. If the service uses only XML Schema built-in simple types, such as strings and integers, then types element is not required. WSDL allows the types to be defined in separate elements so that the types are reusable with multiple web services.
An enumeration type (or enum type) is a value type defined by a set of named constants of the underlying integral numeric type. To define an enumeration type, use the enum keyword and specify the names of enum members: C#. enum Season { Spring, Summer, Autumn, Winter }.
That is not a representation of the same thing.
You haven't said which programming language you're using, but it looks like you intend for PRIVATE to be associated with the value 1, and BUSINESS to be associated with the value 2. That is not represented in the WSDL.
WSDL uses XML Schema to describe the shape of data. XML Schema has no concept equivalent to an enum
in a programming language. In most programming languages I know, an enum
is a named constant. The enumeration
facet in XML Schema does not describe named values. It simply says that the value at that point can be one of the listed (string) values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With