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 "qin bethune (JIRA)" <ax...@ws.apache.org> on 2006/02/14 12:35:09 UTC

[jira] Created: (AXIS-2405) WSDL2Java can't generate correct java class for complex type derived by extending a simple type which is further derived by restricting from build-in type.

WSDL2Java can't generate correct java class for complex type derived by extending a simple type which is further derived by restricting from build-in type.
-----------------------------------------------------------------------------------------------------------------------------------------------------------

         Key: AXIS-2405
         URL: http://issues.apache.org/jira/browse/AXIS-2405
     Project: Apache Axis
        Type: Bug
  Components: WSDL processing  
 Environment: Windows XP
    Reporter: qin bethune


Run  WSDL2Java against the attached WSDL, the  generated java class can't be compiled.


test\HuntSequenceWorkingTelephoneNumber.java:18: Object() in java.lang.Object ca
nnot be applied to (java.lang.String)
        super(_value);
        ^
1 error


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


[jira] Commented: (AXIS-2405) WSDL2Java can't generate correct java class for complex type derived by extending a simple type which is further derived by restricting from build-in type.

Posted by "qin bethune (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2405?page=comments#action_12366325 ] 

qin bethune commented on AXIS-2405:
-----------------------------------

fail to upload the WSDL as attachment, so just paste it here.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://test" 
xmlns:impl="http://test-impl" 
xmlns:intf="http://test" 
xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://test">
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <simpleType name="WorkingTelephoneNumberType">
     <restriction base="string">
       <pattern value="[0-9]{10,36}"/>
    </restriction>
  </simpleType>
  <complexType name="HuntSequenceWorkingTelephoneNumber">
    <simpleContent>
       <extension base="intf:WorkingTelephoneNumberType">
           <attribute name="Index" use="required">
              <simpleType>
                    <restriction base="integer">
                            <totalDigits value="4"/>
                     </restriction>
              </simpleType>
           </attribute>
       </extension>
    </simpleContent>
  </complexType>
  </schema>
 </wsdl:types>

   <wsdl:message name="getPhoneNumberRequest">

      <wsdl:part name="in0" type="xsd:int"/>

   </wsdl:message>

   <wsdl:message name="getPhoneNumberResponse">

      <wsdl:part name="getPhoneNumberReturn" type="intf:HuntSequenceWorkingTelephoneNumber"/>

   </wsdl:message>

   <wsdl:portType name="TelephoneInterface">

      <wsdl:operation name="getPhoneNumber" parameterOrder="in0">

         <wsdl:input name="getPhoneNumberRequest" message="intf:getPhoneNumberRequest"/>

         <wsdl:output name="getPhoneNumberResponse" message="intf:getPhoneNumberResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="SoapBinding" type="intf:TelephoneInterface">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="getPhoneNumber">

         <wsdlsoap:operation soapAction="getPhoneNumber"/>

         <wsdl:input name="getPhoneNumberRequest">

            <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://test"/>

         </wsdl:input>

         <wsdl:output name="getPhoneNumberResponse">

            <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://test"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

</wsdl:definitions>

> WSDL2Java can't generate correct java class for complex type derived by extending a simple type which is further derived by restricting from build-in type.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXIS-2405
>          URL: http://issues.apache.org/jira/browse/AXIS-2405
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>  Environment: Windows XP
>     Reporter: qin bethune

>
> Run  WSDL2Java against the attached WSDL, the  generated java class can't be compiled.
> test\HuntSequenceWorkingTelephoneNumber.java:18: Object() in java.lang.Object ca
> nnot be applied to (java.lang.String)
>         super(_value);
>         ^
> 1 error

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


[jira] Commented: (AXIS-2405) WSDL2Java can't generate correct java class for complex type derived by extending a simple type which is further derived by restricting from build-in type.

Posted by "qin bethune (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2405?page=comments#action_12367880 ] 

qin bethune commented on AXIS-2405:
-----------------------------------

This fix works for pasted WSDL file.

Index: src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
===================================================================
--- src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java	(revision 381218)
+++ src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java	(working copy)
@@ -316,9 +316,10 @@
                         // extending another simpleContent type and will
                         // already have a "value".
 
-                        if (extendsOrRestrictsType == null ||
-                            extendsOrRestrictsType.isBaseType())
-                        {
+                        if (extendsOrRestrictsType == null
+                                || extendsOrRestrictsType.isBaseType()
+                                || isRealSimple(extendsOrRestrictsType,
+                                        symbolTable)) {
                         // Return an element declaration with a fixed name
                         // ("value") and the correct type.
                         Vector v = new Vector();
@@ -429,7 +430,23 @@
         return null;
     }
 
+    // fix for Axis-2405
     /**
+     * a real simple type is a simple type restricted from a built-in style
+     * directly or indirectly without adding any attributes in the hierarchy.
+     * 
+     * @param type
+     * @param symbolTable
+     * @return
+     */
+    private static boolean isRealSimple(TypeEntry type, SymbolTable symbolTable) {
+        while (type != null && type.getContainedAttributes() == null) {
+            type = SchemaUtils.getBaseType(type, symbolTable);
+        }
+        return type == null;
+    }    
+	
+    /**
      * Invoked by getContainedElementDeclarations to get the child element types
      * and child element names underneath a Choice Node
      *


> WSDL2Java can't generate correct java class for complex type derived by extending a simple type which is further derived by restricting from build-in type.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXIS-2405
>          URL: http://issues.apache.org/jira/browse/AXIS-2405
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>  Environment: Windows XP
>     Reporter: qin bethune

>
> Run  WSDL2Java against the attached WSDL, the  generated java class can't be compiled.
> test\HuntSequenceWorkingTelephoneNumber.java:18: Object() in java.lang.Object ca
> nnot be applied to (java.lang.String)
>         super(_value);
>         ^
> 1 error

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