You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "Andreas Beeker (Jira)" <ji...@apache.org> on 2022/02/11 21:03:00 UTC

[jira] [Resolved] (XMLBEANS-426) Generated XML from an XSD contains xsi:nil="true" attribute for an optional (minOccurs="0") SimpleType element causing issue while processing of SOAP request

     [ https://issues.apache.org/jira/browse/XMLBEANS-426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Beeker resolved XMLBEANS-426.
-------------------------------------
    Fix Version/s: Version 5.1.0
       Resolution: Not A Problem

Piccolo has been removed for a while, so this is not an issue anymore.

> Generated XML from an XSD contains xsi:nil="true" attribute for an optional (minOccurs="0") SimpleType element causing issue while processing of SOAP request
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XMLBEANS-426
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-426
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: Binding
>    Affects Versions: Version 2.4 
>         Environment: 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.
>            Reporter: Pundarikakshaiah Ganduri
>            Priority: Blocker
>             Fix For: Version 5.1.0
>
>   Original Estimate: 504h
>  Remaining Estimate: 504h
>
> 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){");
> 				emit("\tunset" + propertyName + "();");
> 				emit("return;");
> 				emit("}");
> 				
> 			}
> Please provide a resolution for this or confirm if we can use the changes I have specified.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org