I’m creating a web services and generating a contract (WSDL) with Axis2 like a POJO web service which is in turn giving me an output like this
<xs:element minOccurs="0" name="acHolderName" nillable="true" type="xs:string"/>
Whereas the required one is this <xs:element minOccurs="0" name="acHolderName" type="xs:string"/>
Is there any annotation which can get me do this or any other better implementation??
The nil attribute is documented here.
From an java object serialization point of view it allows an object attribute to have a NULL value and still be a valid XML document. This is the default way to represent Java objects in an XML schema, because objects attributes are not forced to be populated in Java.
If you want more control over the WSDL you need to consider using something like JAXWS. Problem here is that support form this technology is not very mature in Axis2, and it’s more complicated to deploy, in my opinion.
If you want absolute control over your WSDL (using it as an interface specification) it is probably best to use it to generate the Java code instead of hoping your java will conform to someone else’s specification.