Handling optional attributes in Web Service
Posted on 2011-04-26
Hi, I am invoking a web service using the stub classes. When Axis converts Java object into SOAP request (on invoking _call operation), it also inserts the attributes which Ihave not set with null value. The tag looks like:
<AttributeName xmlns="" xsi:nil="true" />
The problem is that the XSD on the server does not accept "nil" value for the attribute. Either the attribute should not be there, or it should have some value other than "nil".
One way to handle this would be to apply XSLT transformation in Axis handlers to remove unwanted attributes, but I don't find it very clean. Is there anything else I can do rmeove the unwanted attributes? May be some kind of option in Axis to include only those attributes which have been set in the Java object.
Any sugeestions please?