Details
-
Bug
-
Status: Reopened
-
Blocker
-
Resolution: Unresolved
-
Version 2.4
-
None
-
None
-
Windows OS, WAS 6.1, xbean-2.4.0. AXIS2 with XMLBeans binding for SOAP requests at client side. AXIS2 with ADB bindings at server side.
Description
In my project we are using AXIS2 along with XMLBeans binding to generate the payload classes for the web services. The XSD has an element like <xs:element name="LoanPurposeDesc" type="xs:string" minOccurs="0" />
The generated SOAP request xml contains the empty element for this field "LoanPurposeDesc" with a xsi:nil="true" attribute as shown below.
<mtv1:LoanPurposeDesc xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
This is causing the parsing error message on the receiving end of the SOAP request.
Due to this the parser is throwing the error like for the element that is of SimpleType the only expected attribute is its namespace declaration.
For time being to avoid this issue I have modified following way:
Changed XSD to modify the defintion of that element as:
<xs:element name="LoanPurposeDesc" type="xs:string" minOccurs="0" nillable="true"/>
And changed the printSetterImpls() method of org.apache.xmlbeans.impl.schema.SchemaTypeCodePrinter class so that it calls the unSet methd of a property if the property value is coming as null as below:
if (nillable
&& optional
&& !(javaType >= SchemaProperty.JAVA_FIRST_PRIMITIVE && javaType <= SchemaProperty.JAVA_LAST_PRIMITIVE)) {
emit("if ("safeVarName" == null)
");
}
Please provide a resolution for this or confirm if we can use the changes I have specified.
Attachments
Issue Links
- duplicates
-
XMLBEANS-220 XmlObject.xmlText(XmlOptions) outputs xsi:nil="true" where schema definition is minOccurs="0" and default value for nillable="false"
- Closed