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

Andreas Veithen updated AXIS-2644:
----------------------------------

    Fix Version/s:     (was: 1.4)
    
> Deserializer omits one layer of elements in the response object
> ---------------------------------------------------------------
>
>                 Key: AXIS-2644
>                 URL: https://issues.apache.org/jira/browse/AXIS-2644
>             Project: Axis
>          Issue Type: Bug
>          Components: Serialization/Deserialization
>    Affects Versions: 1.4
>         Environment: Windows XP/JDK1.4
>            Reporter: Ping Ning
>            Priority: Critical
>
> I define in an XSD a Submission element which contains up to 100 Envelope 
> elements but does not have
> any other elements besides the envelopes, i.e., the Submission element is a 
> pure wrapper container:
> <xs:element name="Submission">
> <xs:complexType>
>   <xs:sequence>
>          <xs:element name="Envelope" maxOccurs="100">
>                  <xs:complexType>
>                            <xs:sequence>
>                                      <xs:element name="PlanData">
>                                                     <xs:complexType>
>                                                                <xs:sequence>
>                                                                         
> <xs:element name="PlanName" type="xs:string">
>                                                                         
> <xs:element name="PlanStatus" type="xs:string">
>                                                                </xs:sequence>
>                                                     </xs:complexType>
>                                      </xs:element name="PlanData">
>                            </xs:sequence>
>                  </xs:complexType>
>          </xs:element>
>   </xs:sequence>
> </xs:complexType>
> </xs:element>
> The Submission element is used to define a response type in a SOAP message:
> <xs:element name="FilingYearResponse" type="FilingYearResponseType"/>
> <xs:complexType name="FilingYearResponseType">
>     <xs:sequence>
>           <xs:element ref="sub:Submission"/>
>     </xs:sequence>
> </xs:complexType>
> WSDL2Java generates one type SubmissionEnvelope:
>         typeDesc.setXmlType(new 
> javax.xml.namespace.QName("http://www.pbgc.gov/plan_admin/efiling/Submission";,
>  ">>Submission>Envelope"));
>         org.apache.axis.description.ElementDesc elemField = new 
> org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("planData");
>         elemField.setXmlName(new 
> javax.xml.namespace.QName("http://www.pbgc.gov/plan_admin/efiling/Submission";,
>  "PlanData"));
>         elemField.setXmlType(new 
> javax.xml.namespace.QName("http://www.pbgc.gov/plan_admin/efiling/Submission";,
>  ">>>Submission>Envelope>PlanData"));
>         elemField.setNillable(false);
>         typeDesc.addFieldDesc(elemField);
> The filingYearREsponse object has a getter returning  SubmissionEnvelop[].
> The resultant XML message from AXIS is (simplied version without namespace 
> etc.):
> <soapenv:Body>
>      <FilingYearResponse>
>            <Submission>
>                  <PlanData>
>                         <PlanName>MyPlanName1</PlanName>
>                         <PlanStatus>Open</PlanStatus>
>                  </PlanData>
>            </Submission>
>            <Submission>
>                  <PlanData>
>                         <PlanName>MyPlanName2</PlanName>
>                         <PlanStatus>Open</PlanStatus>
>                  </PlanData>
>            </Submission>
>      </FilingYearResponse>
> </soapenv:Body>
> The Submission and Envelope are collapsed into one layer. What I expect to 
> see is:
> <soapenv:Body>
>      <FilingYearResponse>
>            <Submission>
> <Envelope>
>                  <PlanData>
>                         <PlanName>MyPlanName1</PlanName>
>                         <PlanStatus>Open</PlanStatus>
>                  </PlanData>
> </Envelope>
> <!--
>            </Submission>
>            <Submission>
> -->
> <Envelope>
>                  <PlanData>
>                         <PlanName>MyPlanName2</PlanName>
>                         <PlanStatus>Open</PlanStatus>
>                  </PlanData>
> </Envelope>
>            </Submission>
>      </FilingYearResponse>
> </soapenv:Body>
> The type mapping seems to have the correct information:
>       <typeMapping
>         xmlns:ns="http://www.pbgc.gov/plan_admin/efiling/Submission";
>         qname="ns:>>Submission>Envelope"
>         
> type="java:gov.pbgc.pps.commonservice.types.submission.SubmissionEnvelope"
>         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
>         deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
>         encodingStyle=""
>       />
> The deserializer should create a <Submission> element first, then use the the 
> array to create a list of <Envelope>
> elements under this <Submission> element. The meta data seems to be there in 
> the type mapping. So my guess is, 
> the deserializer does not make use of the meta data properly. 
> WSDL2Java could have generated two types, Submission and SubmissionEnvelope. 
> FilingYearREsponse contains 
> a Submission while the Submission element contains an array of 
> SubmissionEnvelope.  That would have been cleaner. 
> But even with the current WSDL2Java generating only one type, the meta data 
> is still sufficient to generate two levels of 
> elements (Submission and Envelope) instead of just one (Submission). It's 
> certainly much more trickier, because the
> deserializer needs to know about generating Submission as a container for an 
> array of SubmissionEnvelopes that are
> mapped to Envelope elements.
> Please let me know if there is any way to get around this. Thanks!

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to