I have created a simple type
<xsd:simpleType name="IntOrBlank"> <xsd:union memberTypes="xsd:int"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value=""/> </xsd:restriction> </xsd:simpleType> </xsd:union> </xsd:simpleType>
I then create stubs using wsdl2java from axis2, the sending works and receiving seemed to work until I try to obtain the integer value from this type. My code is as such:
IntOrBlank get_part_custom_field7 = each_record[0].get_part_custom_field7();
Object object = get_part_custom_field7.getObject();
The object is null now. eventhough the SOAP message is coming in as
<bm:_part_custom_field7>9</bm:_part_custom_field7>
I trace through the code and I found that wsdl2java has generated the stubs incorrectly. The object that was created was java.math.BigInteger while the stubs did a check to make sure the object is an instance of Integer, as a result, the object is null without throwing any exception. I changed the type to
and solved the problem