GeeCON Prague 2014*
The moose likes Web Services and the fly likes Axis WSDL2Java's Error: reference but not defined Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis WSDL2Java Watch "Axis WSDL2Java New topic
Author

Axis WSDL2Java's Error: reference but not defined

Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi All,

I have below wsdl which uses 2 xsd files using schema import element. When I run WSDL2Java program of AXIS 1.2 RC2, I am getting below error. I dont understand this error even though this WSDL has been "validated ok" by wsdl validators. Please suggest ....





Thanks & Regards,


RR Kumaran
SCJP 1.4
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Try adding the following "import" clauses to each <schema> element in your wsdl and then run wsdl2java?


SCJP,SCWCD,SCBCD,SCDJWS1.4, SCDJWS1.5
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi Amit,

Thank you for the response. I have already added the import elements in each of my schema sections of my wsdl. Can you please be more specific ... ?
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

One of the confusing things about all this is that namespace names are URLs; it's
easy to assume that since they're Web addresses, they must be the address of
something. They're not; these are URLs, but the namespace draft doesn't care what
(if anything) they point at.


This example I found has the complete path to the xsd, you only have the name. The
namespace attribute is the name of your defined name space, the schemaLocation is
where to find your xsd.


And in a totally unrelated question, why are you defining the same namespace
twice?

[ March 31, 2005: Message edited by: William Barnes ]

Please ignore post, I have no idea what I am talking about.
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi William Barnes,

Both the xsd's are there in same location of my hard drive and the wsdl, 2 xsd's are validated ok" by xmlspy validator. I think there is no problem regarding schemaLoction and namespace attributes.

Yeah, it is redundant that I have declared 2 namespace but that is not also a problem either.
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

I would suggest using the absolute path to the xsd file. It is a easy
thing to try. Just because xmlspy can find the files doesn't mean
everyone else can find them.
I guess you could put everything into one file, that would get rid of
the problem. Not pretty, but what the hay.
Other than that I don't have any useful suggestions.
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Even if I put the 2 xsd's in the wsdl itself, I am getting the same error
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Hi,
Kindly find modified dcplanlistws.xsd

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://ws.as.com/schemas/dcplanlistws" xmlns:ns1="http://ws.as.com/schemas/dcquickvaluews" targetNamespace="http://ws.as.com/schemas/dcquickvaluews" elementFormDefault="qualified">
<import namespace="http://ws.as.com/schemas/dcplanlistws" schemaLocation="dcplanlistws.xsd"/>
<complexType name="REQUESTDATA">
<complexContent>
<extension base="tns2:bs-request-bean">
<sequence>
<element name="requestEntries" type="tns2 LAN" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="TCINFO">
<complexContent>
<extension base="tns2:bs-data-bean">
<sequence>
<element name="ERRORS" type="xsd:boolean"/>
<element name="NUMPLANS" type="xsd:boolean"/>
<element name="PLAN" type="tns2 LAN" minOccurs="0" maxOccurs="unbounded"/>
<element name="PLANVALUES" type="tns2:TCPlanValues" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>

and dcquickvaluews.xsd to make WSDL2Java working :
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://ws.as.com/schemas/dcplanlistws" xmlns:ns1="http://ws.as.com/schemas/dcquickvaluews" targetNamespace="http://ws.as.com/schemas/dcquickvaluews" elementFormDefault="qualified">
<import namespace="http://ws.as.com/schemas/dcplanlistws" schemaLocation="dcplanlistws.xsd"/>
<complexType name="REQUESTDATA">
<complexContent>
<extension base="tns2:bs-request-bean">
<sequence>
<element name="requestEntries" type="tns2 LAN" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="TCINFO">
<complexContent>
<extension base="tns2:bs-data-bean">
<sequence>
<element name="ERRORS" type="xsd:boolean"/>
<element name="NUMPLANS" type="xsd:boolean"/>
<element name="PLAN" type="tns2 LAN" minOccurs="0" maxOccurs="unbounded"/>
<element name="PLANVALUES" type="tns2:TCPlanValues" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

What was the problem?
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi Amit,

What is the problem and what is your solution ?

Thanks,
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
AXIS was finding problem to find definitions of some elements. I Modified the xsd and was able to generate the necessary code.
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
Hi Amit,

I think you added newly this xmlns:ns1="http://ws.as.com/schemas/dcquickvaluews" but where is that you referring to this ns1 namespace prefix in either any of the xsd's or wsdl ? Can you please confirm ?
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
I just modified XSD file for finding correct refrecned names. I think it should work withput adding that namespace defintion also.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Axis WSDL2Java's Error: reference but not defined