axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Holger King (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AXIS2-4607) WSDL2Java generates Java code for databindung (ADBBean) that is never reached when using custom datatypes (Map) within a WSDL: proper object creation fails
Date Tue, 19 Jan 2010 13:01:54 GMT

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

Holger King updated AXIS2-4607:
-------------------------------

    Description: 
When having a WSDL containing a Map (referencing 0..* MapItem) datatype that is used in some
messages (here in "listObjects"):

...
<wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.apache.org/xml-soap">
        <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
        <complexType name="mapItem">
            <sequence>
                <element name="key" nillable="true" type="xsd:anyType"/>
                <element name="value" nillable="true" type="xsd:anyType"/>
            </sequence>
        </complexType>
        <complexType name="Map">
            <sequence>
                <element name="item" minOccurs="0" maxOccurs="unbounded" type="apachesoap:mapItem"/>
            </sequence>
        </complexType>
    </schema>
</wsdl:types>
<wsdl:message name="listObjectsRequest">
    <wsdl:part name="in0" type="xsd:string"/>
    <wsdl:part name="in1" type="apachesoap:Map"/>
    <wsdl:part name="in2" type="xsd:string"/>
    <wsdl:part name="in3" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="listObjectsResponse">
    <wsdl:part name="listObjectsReturn" type="apachesoap:Map"/>
</wsdl:message>
<wsdl:portType name="IdentityService">
    <wsdl:operation name="listObjects" parameterOrder="in0 in1 in2 in3">
        <wsdl:input name="listObjectsRequest" message="impl:listObjectsRequest"/>
        <wsdl:output name="listObjectsResponse" message="impl:listObjectsResponse"/>
    </wsdl:operation>
</wsdl:portType>
...

the "WSDL2JAVA" codegenerator creates following classes "ListObjects.java" and "Map.java":

"ListObjects.java" calls the "parse(reader)" method of the static inner class of the generated
"Map.java":
...
while (!reader.isStartElement() && !reader.isEndElement())
    reader.next();
if (reader.isStartElement() && new javax.xml.namespace.QName("","in1").equals(reader.getName()))
{
        object.setIn1(com.bosch.fs.idm.axis2.types.Map.Factory.parse(reader));
        reader.next();
}  // End of if for expected property start element
...

where the if-condition within the "parse(reader)"-method is never true (according to the below
SOAP-Request!!!) to create a proper Java object containing all transported values:

public static ListObjects parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception
{
...
    if (reader.isStartElement() && new javax.xml.namespace.QName("","item").equals(reader.getName()))
{
        // Process the array and step past its final element's end.
       list1.add(com.bosch.fs.idm.axis2.types.MapItem.Factory.parse(reader));
                                                                
       //loop until we find a start element that is not part of this array
       boolean loopDone1 = false;
       while(!loopDone1) {
           // We should be at the end element, but make sure
           while (!reader.isEndElement())
               reader.next();
           // Step out of this element
           reader.next();
           // Step to next element event.
           while (!reader.isStartElement() && !reader.isEndElement())
               reader.next();
           if (reader.isEndElement()) {
               //two continuous end elements means we are exiting the xml structure
               loopDone1 = true;
           } else {
               if (new javax.xml.namespace.QName("","item").equals(reader.getName())) {
                   list1.add(com.bosch.fs.idm.axis2.types.MapItem.Factory.parse(reader));
               } else {
                   loopDone1 = true;
               }
          }
    }
    // call the converter utility  to convert and set the array
    object.setItem((com.bosch.fs.idm.axis2.types.MapItem[])
    org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(com.bosch.fs.idm.axis2.types.MapItem.class,
list1));
}
...

Here a SOAP-Request for the "listObjects" operation:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<soapenv:Body>
		<ns1:listObjects soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
			xmlns:ns1="urn:webservice.test.com">
			<in0 xsi:type="xsd:string">ROLES</in0>
			<in1 href="#id0" />
			<in2 xsi:type="xsd:string">test</in2>
			<in3 xsi:type="xsd:string">test</in3>
		</ns1:listObjects>
		<multiRef id="id0" soapenc:root="0"
			soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
			xsi:type="ns2:Map" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
			xmlns:ns2="http://xml.apache.org/xml-soap">
			<item>
				<key xsi:type="soapenc:string">searchFilter</key>
				<value href="#id1" />
			</item>
		</multiRef>
		<multiRef id="id1" soapenc:root="0"
			soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
			xsi:type="ns3:Map" xmlns:ns3="http://xml.apache.org/xml-soap"
			xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
			<item>
				<key xsi:type="soapenc:string">role</key>
				<value xsi:type="soapenc:string">*</value>
			</item>
		</multiRef>
	</soapenv:Body>
</soapenv:Envelope>

Important: a proper Java databinding object creation fails!

  was:
When having a WSDL containing a Map (referencing 0..* MapItem) datatype that is used in some
messages (here in "listObjects"):

...
<wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.apache.org/xml-soap">
        <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
        <complexType name="mapItem">
            <sequence>
                <element name="key" nillable="true" type="xsd:anyType"/>
                <element name="value" nillable="true" type="xsd:anyType"/>
            </sequence>
        </complexType>
        <complexType name="Map">
            <sequence>
                <element name="item" minOccurs="0" maxOccurs="unbounded" type="apachesoap:mapItem"/>
            </sequence>
        </complexType>
    </schema>
</wsdl:types>
<wsdl:message name="listObjectsRequest">
    <wsdl:part name="in0" type="xsd:string"/>
    <wsdl:part name="in1" type="apachesoap:Map"/>
    <wsdl:part name="in2" type="xsd:string"/>
    <wsdl:part name="in3" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="listObjectsResponse">
    <wsdl:part name="listObjectsReturn" type="apachesoap:Map"/>
</wsdl:message>
<wsdl:portType name="IdentityService">
    <wsdl:operation name="listObjects" parameterOrder="in0 in1 in2 in3">
        <wsdl:input name="listObjectsRequest" message="impl:listObjectsRequest"/>
        <wsdl:output name="listObjectsResponse" message="impl:listObjectsResponse"/>
    </wsdl:operation>
</wsdl:portType>
...

the "WSDL2JAVA" codegenerator creates following classes "ListObjects.java" and "Map.java":

"ListObjects.java" calls the "parse(reader)" method of the statis inner class of the generated
"Map.java":
...
while (!reader.isStartElement() && !reader.isEndElement())
    reader.next();
    if (reader.isStartElement() && new javax.xml.namespace.QName("","in1").equals(reader.getName()))
{
        object.setIn1(com.bosch.fs.idm.axis2.types.Map.Factory.parse(reader));
        reader.next();
}  // End of if for expected property start element
...


generated class "*Map.java*" where the if-condition is never true (according to the below
SOAP-Request!!!)
...
if (reader.isStartElement() && new javax.xml.namespace.QName("","item").equals(reader.getName()))
{
    // Process the array and step past its final element's end.
    list1.add(com.bosch.fs.idm.axis2.types.MapItem.Factory.parse(reader));
                                                                
    //loop until we find a start element that is not part of this array
    boolean loopDone1 = false;
    while(!loopDone1) {
        // We should be at the end element, but make sure
        while (!reader.isEndElement())
            reader.next();
        // Step out of this element
        reader.next();
        // Step to next element event.
        while (!reader.isStartElement() && !reader.isEndElement())
            reader.next();
        if (reader.isEndElement()) {
            //two continuous end elements means we are exiting the xml structure
            loopDone1 = true;
        } else {
            if (new javax.xml.namespace.QName("","item").equals(reader.getName())) {
                list1.add(com.bosch.fs.idm.axis2.types.MapItem.Factory.parse(reader));
            } else {
                loopDone1 = true;
            }
        }
    }
    // call the converter utility  to convert and set the array
    object.setItem((com.bosch.fs.idm.axis2.types.MapItem[])
    org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(com.bosch.fs.idm.axis2.types.MapItem.class,
list1));
}
...

A SOAP-Request for the "listObjects" operation:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<soapenv:Body>
		<ns1:listObjects soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
			xmlns:ns1="urn:webservice.test.com">
			<in0 xsi:type="xsd:string">ROLES</in0>
			<in1 href="#id0" />
			<in2 xsi:type="xsd:string">test</in2>
			<in3 xsi:type="xsd:string">test</in3>
		</ns1:listObjects>
		<multiRef id="id0" soapenc:root="0"
			soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
			xsi:type="ns2:Map" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
			xmlns:ns2="http://xml.apache.org/xml-soap">
			<item>
				<key xsi:type="soapenc:string">searchFilter</key>
				<value href="#id1" />
			</item>
		</multiRef>
		<multiRef id="id1" soapenc:root="0"
			soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
			xsi:type="ns3:Map" xmlns:ns3="http://xml.apache.org/xml-soap"
			xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
			<item>
				<key xsi:type="soapenc:string">role</key>
				<value xsi:type="soapenc:string">*</value>
			</item>
		</multiRef>
	</soapenv:Body>
</soapenv:Envelope>

        Summary: WSDL2Java generates Java code for databindung (ADBBean) that is never reached
when using custom datatypes (Map) within a WSDL: proper object creation fails  (was: WSDL2Java
generates Java code for databindung (ADBBean) that is never reached when using custom datatypes
(Map) within a WSDL)

> WSDL2Java generates Java code for databindung (ADBBean) that is never reached when using
custom datatypes (Map) within a WSDL: proper object creation fails
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4607
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4607
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.5.1
>         Environment: Axis2 official release 1.5.1
>            Reporter: Holger King
>            Priority: Blocker
>
> When having a WSDL containing a Map (referencing 0..* MapItem) datatype that is used
in some messages (here in "listObjects"):
> ...
> <wsdl:types>
>     <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.apache.org/xml-soap">
>         <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>         <complexType name="mapItem">
>             <sequence>
>                 <element name="key" nillable="true" type="xsd:anyType"/>
>                 <element name="value" nillable="true" type="xsd:anyType"/>
>             </sequence>
>         </complexType>
>         <complexType name="Map">
>             <sequence>
>                 <element name="item" minOccurs="0" maxOccurs="unbounded" type="apachesoap:mapItem"/>
>             </sequence>
>         </complexType>
>     </schema>
> </wsdl:types>
> <wsdl:message name="listObjectsRequest">
>     <wsdl:part name="in0" type="xsd:string"/>
>     <wsdl:part name="in1" type="apachesoap:Map"/>
>     <wsdl:part name="in2" type="xsd:string"/>
>     <wsdl:part name="in3" type="xsd:string"/>
> </wsdl:message>
> <wsdl:message name="listObjectsResponse">
>     <wsdl:part name="listObjectsReturn" type="apachesoap:Map"/>
> </wsdl:message>
> <wsdl:portType name="IdentityService">
>     <wsdl:operation name="listObjects" parameterOrder="in0 in1 in2 in3">
>         <wsdl:input name="listObjectsRequest" message="impl:listObjectsRequest"/>
>         <wsdl:output name="listObjectsResponse" message="impl:listObjectsResponse"/>
>     </wsdl:operation>
> </wsdl:portType>
> ...
> the "WSDL2JAVA" codegenerator creates following classes "ListObjects.java" and "Map.java":
> "ListObjects.java" calls the "parse(reader)" method of the static inner class of the
generated "Map.java":
> ...
> while (!reader.isStartElement() && !reader.isEndElement())
>     reader.next();
> if (reader.isStartElement() && new javax.xml.namespace.QName("","in1").equals(reader.getName()))
{
>         object.setIn1(com.bosch.fs.idm.axis2.types.Map.Factory.parse(reader));
>         reader.next();
> }  // End of if for expected property start element
> ...
> where the if-condition within the "parse(reader)"-method is never true (according to
the below SOAP-Request!!!) to create a proper Java object containing all transported values:
> public static ListObjects parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception
{
> ...
>     if (reader.isStartElement() && new javax.xml.namespace.QName("","item").equals(reader.getName()))
{
>         // Process the array and step past its final element's end.
>        list1.add(com.bosch.fs.idm.axis2.types.MapItem.Factory.parse(reader));
>                                                                 
>        //loop until we find a start element that is not part of this array
>        boolean loopDone1 = false;
>        while(!loopDone1) {
>            // We should be at the end element, but make sure
>            while (!reader.isEndElement())
>                reader.next();
>            // Step out of this element
>            reader.next();
>            // Step to next element event.
>            while (!reader.isStartElement() && !reader.isEndElement())
>                reader.next();
>            if (reader.isEndElement()) {
>                //two continuous end elements means we are exiting the xml structure
>                loopDone1 = true;
>            } else {
>                if (new javax.xml.namespace.QName("","item").equals(reader.getName()))
{
>                    list1.add(com.bosch.fs.idm.axis2.types.MapItem.Factory.parse(reader));
>                } else {
>                    loopDone1 = true;
>                }
>           }
>     }
>     // call the converter utility  to convert and set the array
>     object.setItem((com.bosch.fs.idm.axis2.types.MapItem[])
>     org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(com.bosch.fs.idm.axis2.types.MapItem.class,
list1));
> }
> ...
> Here a SOAP-Request for the "listObjects" operation:
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> 	xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 	<soapenv:Body>
> 		<ns1:listObjects soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 			xmlns:ns1="urn:webservice.test.com">
> 			<in0 xsi:type="xsd:string">ROLES</in0>
> 			<in1 href="#id0" />
> 			<in2 xsi:type="xsd:string">test</in2>
> 			<in3 xsi:type="xsd:string">test</in3>
> 		</ns1:listObjects>
> 		<multiRef id="id0" soapenc:root="0"
> 			soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 			xsi:type="ns2:Map" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> 			xmlns:ns2="http://xml.apache.org/xml-soap">
> 			<item>
> 				<key xsi:type="soapenc:string">searchFilter</key>
> 				<value href="#id1" />
> 			</item>
> 		</multiRef>
> 		<multiRef id="id1" soapenc:root="0"
> 			soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 			xsi:type="ns3:Map" xmlns:ns3="http://xml.apache.org/xml-soap"
> 			xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
> 			<item>
> 				<key xsi:type="soapenc:string">role</key>
> 				<value xsi:type="soapenc:string">*</value>
> 			</item>
> 		</multiRef>
> 	</soapenv:Body>
> </soapenv:Envelope>
> Important: a proper Java databinding object creation fails!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message