You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Antanas Radzius (JIRA)" <ax...@ws.apache.org> on 2006/02/03 17:20:34 UTC

[jira] Updated: (AXIS-2380) String constructor is not generated for classes derived from simple types.

     [ http://issues.apache.org/jira/browse/AXIS-2380?page=all ]

Antanas Radzius updated AXIS-2380:
----------------------------------

    Attachment: patch.txt

Attached you find a patch.

> String constructor is not generated for classes derived from simple types.
> --------------------------------------------------------------------------
>
>          Key: AXIS-2380
>          URL: http://issues.apache.org/jira/browse/AXIS-2380
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization, WSDL processing
>     Versions: 1.3
>     Reporter: Antanas Radzius
>  Attachments: patch.txt
>
> Location of bad code:
> Class: org.apache.axis.wsdl.toJava.JavaBeanWriter
> Method: writeSimpleConstructors()
> Relevant code snipet from from writeSimpleConstructors():
>         // Simple types without simpleValueTypes are derived classes.
>         // Inherit the simple constructor.
>         if (simpleValueTypes.size() == 0)
>         {
>            if (extendType != null)
>            {
>                // Find the java type of the most base type.
>                TypeEntry baseType = type;
>                while (true)
>                {
>                    TypeEntry superType = SchemaUtils.getBaseType(
>                        baseType, emitter.getSymbolTable());
>                    if (superType == null)
>                        break;
>                    else
>                        baseType = superType;
>                }
>                String baseJavaType = baseType.getName();
>                pw.println("    public " + className + "("
>                        + baseJavaType + " _value) {");
>                pw.println("        super(_value);");
>                pw.println("    }");
>                pw.println();
>            }
>         }
> It doesnt generate string constructor for this case and as result serialzation/deserialization is broken for such generated classes.
> Sample WSDL:
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by ah (ee) -->
> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://unions.test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://unions.test" name="Untitled">
> 	<types>
> 		<xsd:schema targetNamespace="http://unions.test" xmlns:tns="http://unions.test" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
> 			<xsd:simpleType name="TestUnion">
> 				<xsd:union memberTypes="xsd:int xsd:string"/>
>                         </xsd:simpleType>
> 			<xsd:complexType name="TestUnion_ID">
> 				<xsd:simpleContent>
> 					<xsd:extension base="tns:TestUnion">
> 						<xsd:attribute name="id" type="xsd:ID"/>
> 					</xsd:extension>
> 				</xsd:simpleContent>
> 			</xsd:complexType>
> 			<xsd:simpleType name="TestDateUnion">
> 				<xsd:union memberTypes="xsd:date xsd:gYear"/>
>                         </xsd:simpleType>
> 			<xsd:element name="TestUnionRequest" type="tns:TestUnion"/>
> 			<xsd:element name="TestUnionResponse" type="tns:TestUnion_ID"/>
> 			<xsd:element name="TestDateUnionRequest" type="tns:TestDateUnion"/>
> 			<xsd:element name="TestDateUnionResponse" type="tns:TestDateUnion"/>
> 		</xsd:schema>
> 	</types>
> 	<message name="TestResponseMsg">
> 		<part name="parameter" element="tns:TestUnionResponse"/>
> 	</message>
> 	<message name="TestRequestMsg">
> 		<part name="parameter" element="tns:TestUnionRequest"/>
> 	</message>
> 	<message name="TestDateUnionRequestMsg">
> 		<part name="parameter" element="tns:TestDateUnionRequest"/>
> 	</message>
> 	<message name="TestDateUnionResponseMsg">
> 		<part name="parameter" element="tns:TestDateUnionResponse"/>
> 	</message>
> 	<portType name="TestUnions">
> 		<operation name="TestOperation">
> 			<input message="tns:TestRequestMsg"/>
> 			<output message="tns:TestResponseMsg"/>
> 		</operation>
> 		<operation name="TestOperation2">
> 			<input message="tns:TestDateUnionRequestMsg"/>
> 			<output message="tns:TestDateUnionResponseMsg"/>
> 		</operation>
> 	</portType>
> 	<binding name="TestUnionsBinding" type="tns:TestUnions">
> 		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> 		<operation name="TestOperation">
> 			<soap:operation soapAction="capeconnect:TestService:TestUnions#TestOperation" style="document"/>
> 			<input>
> 				<soap:body use="literal" namespace="http://unions/binding"/>
> 			</input>
> 			<output>
> 				<soap:body use="literal" namespace="http://unions/binding"/>
> 			</output>
> 		</operation>
> 		<operation name="TestOperation2">
> 			<soap:operation soapAction="capeconnect:TestService:TestUnions#TestOperation2" style="document"/>
> 			<input>
> 				<soap:body use="literal" namespace="http://unions/binding"/>
> 			</input>
> 			<output>
> 				<soap:body use="literal" namespace="http://unions/binding"/>
> 			</output>
> 		</operation>
> 	</binding>
> 	<service name="TestUnionstService">
> 		<port name="TestUnionsPort" binding="tns:TestUnionsBinding">
> 			<soap:address location="http://localhost:80/axis/services/TestUnionsPort"/>
> 		</port>
> 	</service>
> </definitions>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira