WSDL2java fails with an error code "Type ... is referenced but not defined" 
when run against valid schema.
----------------------------------------------------------------------------------------------------------

         Key: AXIS-2058
         URL: http://issues.apache.org/jira/browse/AXIS-2058
     Project: Apache Axis
        Type: Bug
  Components: WSDL processing  
    Versions: current (nightly)    
 Environment: Windows XP, JDK 1.5, Axis 1.2 (newly downloaded)
    Reporter: Robin Taylor


Can anyone help ? I'm trying to run wsdl2java against some wsdl published by 
the IMS Global Learning Consortium but without success. I'm 90% sure there is a 
bug somewhere but there is a possibility that my XML knowledge is letting me 
down. I have attached a cutdown version of the original very complex wsdl. It 
may look a bit pointless but that is because I have left in just enough code 
for it to be valid and still produce the error. The problem lies in an imported 
piece of XML schema in the third file ...

        <element name = "createResourceListRequest">
                <complexType>
                        <sequence>
                                <element name = "test1" type = "xsd:string" 
maxOccurs = "unbounded"/>   
                        </sequence>
                </complexType>
        </element>

        <element name = "test2" type = "xsd:string"/>
        <element name = "createResourceListResponse">
                <complexType>
                        <sequence>
                                <element ref = "tns:test2" maxOccurs = 
"unbounded"/>    
                        </sequence>
                </complexType>
        </element>

The two elements "createResourceListRequest" and "createResourceListResponse" 
should be essentially the same but are coded differently to illustrate the 
problem. wsdl2java prodoces the following error relating to test2...


C:\Documents and Settings\RTAYLOR3\My Documents>java 
org.apache.axis.wsdl.WSDL2J ava --server-side --skeletonDeploy true -v -D 
"Z:\Resource List project\min IMS spec\imsRLIManServiceSync_v1p0.wsdl"
Parsing XML file:  Z:\Resource List project\min IMS 
spec\imsRLIManServiceSync_v1 p0.wsdl Retrieving document at 
'imsRLIManAbstractSync_v1p0.wsdl', relative to 'file:/Z:/ Resource List 
project/min IMS spec/imsRLIManServiceSync_v1p0.wsdl'.
Retrieving schema at 'imsRLIManMessSchema_v1p0.xsd', relative to 
'file:/Z:/Resou rce List project/min IMS spec/imsRLIManAbstractSync_v1p0.wsdl'.
java.io.IOException: Type {urn:namespace3}test2 is referenced but not defined.
        at org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(Symbol
Table.java:663)
        at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:543
)
        at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:516)
        at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:493)
        at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:360)
        at java.lang.Thread.run(Thread.java:595)


Strangely, if I remove the maxOccurs attribute from the ref to tns:test2 then 
the command runs successfully. This is what makes me pretty sure this is a bug 
rather than duff code. I have attached below the entire wsdl/xml which 
comprises 3 files. I am running a recently downloaded version of Axis 1.2 with 
J2SE 5.0.

Any help would be greatly appreciated.

Thanks, Robin Taylor.
Edinburgh University.

**** First file 
*************************************************************************************************************************

<?xml version = "1.0" encoding = "UTF-8"?>

<wsdl:definitions name = "ResourceListManagementServiceSync" targetNamespace = 
"urn:namespace1" 
        xmlns:tns = "urn:namespace1" 
        xmlns:absr = "urn:namespace2" 
        xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"; 
        xmlns:wsdl = "http://schemas.xmlsoap.org/wsdl/";
        xmlns = "http://schemas.xmlsoap.org/wsdl/"; 
        xmlns:xsi = "http://www.w3.org/2000/10/XMLSchema-instance"; 
xsi:schemaLocation = "http://schemas.xmlsoap.org/wsdl/ 
http://www.imsglobal.org/services/schemas/wsiwsdlv1p1.xsd";>

        <wsdl:import namespace = "urn:namespace2" location = 
"imsRLIManAbstractSync_v1p0.wsdl"/>
        
        <wsdl:binding name = "ResourceListManagementServiceSyncSoap" type = 
"absr:ResourceListManagementServiceSync">
                <soap:binding transport = 
"http://schemas.xmlsoap.org/soap/http"; style = "document"/> 
                <wsdl:operation name = "createResourceList">
                        <soap:operation soapAction = 
"http://www.imsglobal.org/soap/rli/createResourceList"; style = "document"/>
                        <wsdl:input>
                                <soap:body use = "literal" parts = 
"parameters"/>
                                <soap:header message = 
"absr:createResourceListRequest" part = "headerInfoRequest" use = "literal" 
wsdl:required = "true"/> 
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body use = "literal" parts = "response"/>
                                <soap:header message = 
"absr:createResourceListResponse" part = "headerInfoResponse" use = "literal" 
wsdl:required = "true"/>
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:binding>
        
        <wsdl:service name = "ResourceListManagementServiceSync">
                <wsdl:port name = "ResourceListManagementServiceSyncSoap" 
binding = "tns:ResourceListManagementServiceSyncSoap">
                        <soap:address location = 
"http://imsglobal.org/services/ResourceListManagementService/"/> 
                </wsdl:port>
        </wsdl:service>

</wsdl:definitions>

***** Second file 
***************************************************************************************************************
<?xml version = "1.0" encoding = "UTF-8"?>

<wsdl:definitions name = "ResourceListManagementServiceSync" targetNamespace = 
"urn:namespace2" 
        xmlns:tns = "urn:namespace2" 
        xmlns:imsrli = "urn:namespace3"
        xmlns:wsdl = "http://schemas.xmlsoap.org/wsdl/"; 
        xmlns = "http://schemas.xmlsoap.org/wsdl/"; 
        xmlns:xsd = "http://www.w3.org/2001/XMLSchema";> 

        <wsdl:types>
                <xsd:schema>    
                        <xsd:import namespace = "urn:namespace3" schemaLocation 
= "imsRLIManMessSchema_v1p0.xsd"/>
                </xsd:schema>
        </wsdl:types>

        <wsdl:message name = "createResourceListRequest">
                <wsdl:part name = "parameters" element = 
"imsrli:createResourceListRequest"/>

        </wsdl:message>

        <wsdl:message name = "createResourceListResponse">
                <wsdl:part name = "response" element = 
"imsrli:createResourceListResponse"/>

        </wsdl:message>

        <wsdl:portType name = "ResourceListManagementServiceSync">
                <wsdl:operation name = "createResourceList">
                        <wsdl:input message = "tns:createResourceListRequest"/>
                        <wsdl:output message = 
"tns:createResourceListResponse"/>
                </wsdl:operation>
        </wsdl:portType>

</wsdl:definitions>

******** Third file, with the problem 
code.***************************************************************************************

<?xml version = "1.0" encoding = "UTF-8"?>

<schema xmlns = "http://www.w3.org/2001/XMLSchema";
         targetNamespace = "urn:namespace3"
         xmlns:tns = "urn:namespace3"
         xmlns:xsd = "http://www.w3.org/2001/XMLSchema";
         elementFormDefault = "qualified">

        <element name = "createResourceListRequest">
                <complexType>
                        <sequence>
                                <element name = "test1" type = "xsd:string" 
maxOccurs = "unbounded"/>   
                        </sequence>
                </complexType>
        </element>

        <element name = "test2" type = "xsd:string"/>
        <element name = "createResourceListResponse">
                <complexType>
                        <sequence>
                                <element ref = "tns:test2" maxOccurs = 
"unbounded"/>    
                        </sequence>
                </complexType>
        </element>

</schema>






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

Reply via email to