File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes WSDL2Java Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WSDL2Java Error" Watch "WSDL2Java Error" New topic
Author

WSDL2Java Error

Lillo Birillo
Greenhorn

Joined: Aug 04, 2005
Posts: 8
I'm currently running Apache Tomcat 4.1 with Axis 1.2.
I am not able to generate Client side code using WSDL2Java. I am getting this error:

java.io.IOException: Type {http://util.java}Enumeration is referenced but not defined.
at org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.java:665)
at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
at java.lang.Thread.run(Thread.java:534)

I'm using complex objects between server and client.

Thanks!
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
first step is to validate your wsdl using any wsdl validators. This can show any problems with your wsdl.


RR Kumaran
SCJP 1.4
Lillo Birillo
Greenhorn

Joined: Aug 04, 2005
Posts: 8
Thank you RR Kumaran for the answer

The wsdl was generate by Axis 1.2.
I've tried to validate it with XMLSpy 2005.

" Cannot resolve declaration or definition 'Enumeration' in namespace 'http://util.java' ".

How can I resolve the problem?

Thanks again
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
You've referenced a 'thing' (of some type, I can't tell from the error message alone) named 'Enumeration' (in XML Namespace 'http://util.java'), but no definition could be found.

It's probably a type or element in an XML Schema, in which case you either need to import the schema correctly, or add the definition if it's missing.

If you can't work it out, post your schema and perhaps someone can help.


-Tim
Lillo Birillo
Greenhorn

Joined: Aug 04, 2005
Posts: 8
Here's the revelant part of the wsdls file.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl efinitions targetNamespace="http://localhost:8080/axis/services/urn:WebServiceTest"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/axis/services/urn:WebServiceTest"
xmlns:intf="http://localhost:8080/axis/services/urn:WebServiceTest"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://cont1.li.com"
xmlns:tns2="http://cont2.li.com"
xmlns:tns3="http://util.java"
xmlns:tns4="http://cont3.li.com"
xmlns:tns5="http://lang.java"
xmlns:tns6="http://values.li.com"
xmlns:tns7="http://sql.java"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2.1
Built on Jun 14, 2005 (09:15:57 EDT)-->
<wsdl:types>
<schema targetNamespace="http://cont2.li.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://localhost:8080/axis/services/urn:WebServiceTest"/>
<import namespace="http://util.java"/>
<import namespace="http://cont1.li.com"/>
<import namespace="http://cont3.li.com"/>
<import namespace="http://lang.java"/>
<import namespace="http://values.li.com"/>
<import namespace="http://sql.java"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ObjComp1">
<sequence>
<element name="allListNames" nillable="true" type="xsd:anyType"/>
<element name="ObjName" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="ObjComp2">
<sequence/>
</complexType>
<complexType name="ObjComp3">
<sequence>
<element maxOccurs="unbounded" name="javaClass" nillable="true" type="xsd:anyType"/>
<element maxOccurs="unbounded" name="type" nillable="true" type="xsd:string"/>
<element maxOccurs="unbounded" name="length" type="xsd:int"/>
<element name="size" type="xsd:int"/>
<element maxOccurs="unbounded" name="name" nillable="true" type="xsd:string"/>
<element maxOccurs="unbounded" name="ObjComp2" nillable="true" type="tns2 bjComp2"/>
<element name="fieldEnumeration" nillable="true" type="tns3:Enumeration"/>
<element maxOccurs="unbounded" name="mayBeNull" type=" :boolean"/>
<element maxOccurs="unbounded" name="refData" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="ObjComp4">
<sequence>
<element name="enumeration" nillable="true" type="tns3:Enumeration"/>
<element name="refDataTRanslation" type="xsd:boolean"/>
<element name="null" nillable="true" type="xsd:string"/>
<element name="metaData" nillable="true" type="tns2 bjComp3"/>
<element name="attributeCount" type="xsd:int"/>
</sequence>
</complexType>
</schema>
.
.
.
.

</wsdl:types>
.
.
.
.
.


Thanks
Lillo Birillo
Greenhorn

Joined: Aug 04, 2005
Posts: 8
Now I'm seeing a warning from axis :

- The class java.util.Enumeration is defined in a java or javax package and cannot be converted into
an xml schema type. An xml schema anyType will be used to define this class in the wsdl file.

What does it mean ?

The error after launch wsdl2tojava command remains:

java.io.IOException: Type {http://util.java}Enumeration is referenced but not defined.
at org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.java:665)
at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
at java.lang.Thread.run(Thread.java:534)
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
OK, you've imported namespace "http://util.java" and associated it with namespace identifier 'tns3'. You've then referred to a type (presumably) defined by that namespace in lines like these:



However, you aren't providing a schema for namespace "http://util.java", so wsdl2java is complaining. AFAIK, you either need to add an xsi:schemalocation, or (and I find this easier with Axis) rewrite the current schema to not refer to an external one.

If you're not familiar with XML schemas, namespaces and the idea of importing schemas, you really need to learn these concepts before you can fix this problem.

By the way, did you write this schema/WSDL yourself, or generate it with a tool?


-Tim
Lillo Birillo
Greenhorn

Joined: Aug 04, 2005
Posts: 8
The wsdl file was generated by Axis.

I have used Axis just in order not to have to learn these concepts.
But now, I think I'll learn them.

Thanks for now...

Ciao.
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
That was the way I learned too - initially I didn't know the messy details of XML Schema, WSDL, SOAP etc, but in the end I had to learn them to be able to identify and resolve bugs and problems.

Good luck!



-Tim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSDL2Java Error