WSDL2Java generates Java code for databindung (ADBBean) that is never reached when using custom datatypes (Map) within a WSDL -----------------------------------------------------------------------------------------------------------------------------
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 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"): {code} ... <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> ... {code} the "WSDL2JAVA" codegenerator creates following classes "ListObjects.java" and "Map.java": generated class "*ListObjects.java*" calls the "parse(reader)" method of the statis inner class of the generated "Map.java": {code} ... 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 ... {code} generated class "*Map.java*": ... 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 "listObjects" contains the following structure: <?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> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.