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 WSDL generation in Axis - item is referenced 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 "WSDL generation in Axis - item is referenced but not defined" Watch "WSDL generation in Axis - item is referenced but not defined" New topic
Author

WSDL generation in Axis - item is referenced but not defined

Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
I'm new to web services and axis, but I've been having some success with developing them so far.
My current task is to create a web service from a WSDL that's been handed to me, I have not been given much information on how it was created, but it seems that there has to be something wrong with it. I'm not able to generate code from it for one error after another. Usually that error is "<something> is referenced but not defined"
However, all these types are indeed defined in the WSDL

It's a long one but here it is:


So why won't it recognize the types that it has defined? Why is it looking outside of the document?

I'm using Axis 1.4 and WSDL2Java via an ant task

thanks for your help.
[ August 28, 2007: Message edited by: Gran Roguismo ]

EOL
Rajiv Arora
Greenhorn

Joined: Mar 25, 2007
Posts: 26
I had faced this issue once earlier and the cause for it was that the XSDs referenced from my WSDL were different from the ones that should have been there. So try checking the referenced schemas within your WSDL and whether they really contain the element definitions that it is throwing error for.

-Kamal
Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
thanks for your reply Kamal,
My gut does say that it's something to do with that XSD, which is why I actually assigned the schema the same XSD target name space. (at least that's what I thought I was doing) Because, as I said, all definitions are in the actual document. None of them are missing from what I can see, especially the ones it's calling out.
Is there a way to force it to recognize that?
Rajiv Arora
Greenhorn

Joined: Mar 25, 2007
Posts: 26
I see that in the wsdl that you specified, the namespace "ns" points to the XSD and there are complex elements within your wsdl (like ItineraryFlightSegment)which use this namespace for their definition. So I believe even if the definition of these elements lies within the same WSDL, its searching them in the referenced XSD as they are bound by the namespace "ns". So just try modifying your wsdl by removing this "ns" namespace from the elements which refer it like below:

Before modification:
-------------------
"<xsd:element maxOccurs="1" minOccurs="0" name="ArrivingFlightSegment" type="ns:ItineraryFlightSegment" />"

After modification
-------------------
"<xsd:element maxOccurs="1" minOccurs="0" name="ArrivingFlightSegment" type="ItineraryFlightSegment" />"

(Namespace "ns" removed from type definition)
This is a tedious job, but I think this should help you.

-Kamal
Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
I went ahead and did that, and it jumped to a different definition, but same error really

"ItineraryNameValue is referenced but not defined."

I made a couple other modifications as well. Here is the new file:


[ August 29, 2007: Message edited by: Gran Roguismo ]
[ August 29, 2007: Message edited by: Gran Roguismo ]
Gran Roguismo
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
Thanks for your help. I was able to get the WSDL to generate by adding the name spaces back in. The original issue was with me using ns: on some items and not using it on others in that namespace.
 
 
subject: WSDL generation in Axis - item is referenced but not defined