java - No use of nillable="0" in SOAP Webservice -
i have received xsd 3rd party supplier generated java based system; used create soap endpoint receive data transfers. xsd not make use of nillable attribute defined within w3c/xsd namespace, example:
<xs:complextype name="customer"> <xs:sequence> <xs:element minoccurs="1" maxoccurs="1" name="id" type="xs:integer"/> <xs:element minoccurs="0" maxoccurs="1" name="titleid" type="xs:integer"/> <xs:element minoccurs="0" maxoccurs="1" name="firstname" type="xs:string"/> <xs:element minoccurs="0" maxoccurs="1" name="familyname" type="xs:string"/> <xs:element minoccurs="0" maxoccurs="1" name="previousname" type="xs:string"/> <xs:element minoccurs="0" maxoccurs="1" name="dateofbirth" type="xs:date"/> </xs:sequence> </xs:complextype>
when speaking supplier mentioned "where minoccurs="0" , no value, elements omitted".
when use xsd schema definition tool create classes; classes generated correctly 2 exceptions: dateofbirth , titleid properties not nullable.
unless nillable="true" declared within xsd simple types, value types or not created nullable despite minoccurs="0" configuration. after research feel interpretation correct given information in following articles:
- http://www.w3schools.com/xml/schema_complex_indicators.asp
- https://www.w3.org/tr/xmlschema-0/
- https://www.w3.org/tr/xmlschema-1/#xsi_nil
- https://www.w3.org/tr/xmlschema-0/
- http://www.w3schools.com/xml/el_element.asp
- http://docstore.mik.ua/orelly/xml/schema/ch11_03.htm
- https://msdn.microsoft.com/en-us/library/2b314yt2(v=vs.100).aspx
- what correct way represent null xml elements?
i have concluded above minoccurs="0" definition states element within xml optional, not have particular meaning. clear within soap message; communicate no value particular element nill="true" should used within empty element.
when presenting our supplier; have argued missing nillable attributes leaves xsd ambiguous , lacks intent when referenced standards, given omitting elements not state null, implied. w3c states if message needs indicate element null, should explicitly stated. representative disagreed , argued if there no dateofbirth (for example) remove element in soap message. believe acceptable , conforms standards. have read here, minoccurs/nillable have same behavior in java (maybe why feel don't have use nillable attribute)
i know can work around ultimately; (potentially) has significant increase on amount of additional code required sake of our supplier not wanting use nill/nillable attribute in xsd , soap message. building our soap api in wcf; upon deserialization have check specified properties generated check missing elements. because value types not not referenced in xml message assigned default values. alternatively, go through xsd , add them myself, feel bad idea. changing definitions , new releases require same effort, every 3-6 months.
my questions are:
- are arguments correct? if not, why?
- am correct in suggestion java treats these configurations same?
- if wrong, there way can tell .net create nullable types minoccurs="0"?
Comments
Post a Comment