axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Persche (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Commented: (AXIS-2170) WSDL2JAVA does not create proper code for referenced elements
Date Mon, 22 Aug 2005 21:56:08 GMT
    [ http://issues.apache.org/jira/browse/AXIS-2170?page=comments#action_12319648 ] 

Richard Persche commented on AXIS-2170:
---------------------------------------

This wsdl creates the problem. 


<wsdl:definitions xmlns="http://test.axis.com/wsdl2java/" xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test.axis.com/wsdl2java/" name="axisTest"> 
    <wsdl:types> 
        <xs:schema targetNamespace="http://test.axis.com/wsdl2java/" xmlns="http://test.axis.com/wsdl2java/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">

            <xs:element name="testString" type="xs:string"/> 
            <xs:element name="testDate" type="xs:date"/> 
			<xs:element name="my" type="MyType" nillable="true"/>
            <xs:complexType name="MyType"> 
                <xs:sequence> 
                    <xs:element ref="testString" minOccurs="1" maxOccurs="1"/> 
                </xs:sequence> 
            </xs:complexType> 
            <xs:complexType name="WSDLTest_Type"> 
                <xs:sequence> 
                    <xs:element ref="my" minOccurs="1" maxOccurs="1"/> 
                </xs:sequence> 
                <xs:sequence> 
                    <xs:element ref="testString" minOccurs="1" maxOccurs="1"/> 
                </xs:sequence> 
            </xs:complexType> 
            <xs:complexType name="WSDLTestResponse_Type"> 
                <xs:sequence> 
                    <xs:element ref="testDate" minOccurs="1" maxOccurs="1"/> 
                </xs:sequence> 
            </xs:complexType> 
            <xs:element name="getWSDLTest" type="WSDLTest_Type"/> 
            <xs:element name="getWSDLTestResponse" type="WSDLTestResponse_Type"/> 
        </xs:schema> 
    </wsdl:types> 
    <wsdl:message name="GetWSDLTestRequestMessage"> 
        <wsdl:part name="getWSDLTestRequest" element="getWSDLTest"/> 
    </wsdl:message> 
    <wsdl:message name="GetWSDLTestResponseMessage"> 
        <wsdl:part name="getWSDLTestResponse" element="getWSDLTestResponse"/> 
    </wsdl:message> 
    <wsdl:portType name="GetWSDLTestPortType"> 
        <wsdl:operation name="getWSDLTest"> 
            <wsdl:input message="GetWSDLTestRequestMessage"/> 
            <wsdl:output message="GetWSDLTestResponseMessage"/> 
        </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="GetWSDLTestSoapBinding" type="GetWSDLTestPortType"> 
        <soapbind:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

        <wsdl:operation name="getWSDLTest" > 
            <soapbind:operation style="document" soapAction="http://service.wellsfargo.com/provider/pcs/account/2004/"/>

            <wsdl:input> 
                <soapbind:body parts="getWSDLTestRequest" use="literal"/> 
            </wsdl:input> 
            <wsdl:output> 
                <soapbind:body parts="getWSDLTestResponse" use="literal"/> 
            </wsdl:output> 
        </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="GetWSDLTestService"> 
        <wsdl:port name="getWSDLTest" binding="GetWSDLTestSoapBinding"> 
            <soapbind:address location="http://localhost:7001/services/getWSDLTest/"/>

        </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 


Check the file: MyType.java after wsdl2java

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("http://test.axis.com/wsdl2java/",
"MyType"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("testString");
        elemField.setXmlName(new javax.xml.namespace.QName("http://test.axis.com/wsdl2java/",
"testString"));
       elemField.setXmlType(new javax.xml.namespace.QName("http://test.axis.com/wsdl2java/",
"testString"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
    }

> WSDL2JAVA does not create proper code for referenced elements
> -------------------------------------------------------------
>
>          Key: AXIS-2170
>          URL: http://issues.apache.org/jira/browse/AXIS-2170
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: 1.2.1
>  Environment: JRE 1.4.2_03, Win XP, 
>     Reporter: Richard Persche

>
> When a wsdl contains elements that are defined by ref=?xzy? the code produced by wsdl2java
does not look correct: 
> E.g. 
> [?]
>             <xs:element name="countryCode" type="CompoundCountryCodeIdentifierType"
nillable="true"/>
>             <xs:element name="geoRef" type="CompoundGeoRefIdentifierType" nillable="true"/>
>             <xs:complexType name="MyType">
>                         <xs:choice>
>                                     <xs:sequence>
>                                                 <xs:element name="name" type="xs:string"/>
>                                                 <xs:element name="region" type="xs:string"
nillable="true" minOccurs="0"/>
>                                                 <xs:element ref="geoRef" minOccurs="0"
maxOccurs="unbounded"/>
>                                                 <xs:element ref="countryCode" minOccurs="0"/>
>                                     </xs:sequence>
>                                     <xs:sequence>
>                                                 <xs:element name="myIdentifier" type="MyIdentifierType"
nillable="true" minOccurs="0"/>
>                                     </xs:sequence>
>                         </xs:choice>
>             </xs:complexType>
> [?]
>  
> the code produced by wsdl2java does not look correct: 
>  
> Code:
> MyType.java
>      private static org.apache.axis.description.TypeDesc typeDesc =
>         new org.apache.axis.description.TypeDesc(MyType.class, true);
>  
>     static {
>         typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"MyType"));
>         org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("name");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"name"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"string"));
>         elemField.setNillable(false);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("region");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"region"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"string"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(true);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("geoRef");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"geoRef"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"geoRef"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(false);
>         elemField.setMaxOccursUnbounded(true);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("countryCode");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"countryCode"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"countryCode"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(false);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("MyIdentifier");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"myIdentifier"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"MyIdentifierType"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(true);
>         typeDesc.addFieldDesc(elemField);
>     }
>  
> When I added the following code to the JavaBeanHelperWriter.java to handle referenced
types, the code was created correctly. (see below)
>  
> 1_2_1/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
> Lines 345++
>                     xmlType = elemType.getQName();
>  
>                     //check ref type
>                     if (elemType != null &&
>                            elemType.getRefType() != null &&
>                            elemType.getRefType().getQName() != null) {
>                               xmlType = elemType.getRefType().getQName();
>                             }
>  
>  
> [?]
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("geoRef");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"geoRef"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"CompoundGeoRefIdentifierType"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(false);
>         elemField.setMaxOccursUnbounded(true);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("countryCode");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"countryCode"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"CompoundCountryCodeIdentifierType"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(false);
> [..]
>  

-- 
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


Mime
View raw message