axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcello Sales" <msa...@collab.net>
Subject RE: "Element is referenced but not defined", except that it is defined...
Date Wed, 18 Apr 2007 18:35:49 GMT
Hello Brodiee,

As the exception says, the element cannot be found in your types... That
means you have to go to your types definition to look for it. Remember
that if you use the document/literal binding style, you have to
reference global elements defined in your types section. In this way,
you can see that FooException is a ComplexType instead, and for this
reason, there's no such element FooException. 

In order to solve this exception, create an element on the global types
section of the WSDL as follows:

<element name="FooException" type="cl:FooException"></element>

Watch the namespaces defined and create any more additional elements
when necessary. The best way to author a WSDL file is by hand... Just
remember if your binding style is document/literal, your messages' parts
should refer to global elements instead of complexTypes. Axis 1.4 might
check this before generating the stubs/skeletons from your classes...

Additional readings about XML, XML Schema and WSDL files are found at
www.w3schools.com

               Marcello Sales - Software Engineer
(   (                
      _)__)         CollabNet, Inc.          
   .-"(    `-..-.        
  |`-._`( _.-'|  )     8000 Marina Boulevard, Suite 600
   L    ""   J  /      Brisbane, California 94005 USA
   |         |.'      
 .-J         F-.      office: +1 650.228.2632 
(   `-.___.-'   )  mobile: +1 408.679.5272  
`-._________.-'     
                skype: marcellosalesjr

-----Original Message-----
From: Brodie Thiesfield [mailto:brofield2@jellycan.com] 
Sent: Wednesday, April 18, 2007 3:23 AM
To: axis-user@ws.apache.org
Subject: "Element is referenced but not defined", except that it is
defined...

Hi,

I'm getting an IOException from WSDL2Java from the checkForUndefined
method. It is complaining that it is undefined, however the definition
is definitely there. The WSDL is successfully parsed by the VC2003/5
wsdl.exe tool (for what it's worth).

A minimalized testcase of the WSDL is included, along with the error
that this testcase produces. I'm using Axis 1.4. The original WSDL
(from which this testcase was extracted) was generated by gsoap2 2.7.9d.

Would someone please show me where the WSDL is incorrect?

Regards,
Brodie

=== ERROR ===

>java org.apache.axis.wsdl.WSDL2Java problem.wsdl
2007/04/12 17:22:26 org.apache.axis.utils.JavaUtils
isAttachmentSupported (warning removed...)
java.io.IOException: (japanese removed...) / [en]-(Element
{http://example.com/foo/schema}FooException is re
ferenced but not defined.)
at
org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(Symbol
Table.java:670)
at
org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545
)
at
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:518)
at
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:495)
at
org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
at java.lang.Thread.run(Thread.java:595)

=== WSDL ===

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="foo"
targetNamespace="http://example.com/foo"
xmlns:tns="http://example.com/foo"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:cl="http://example.com/foo/schema"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">

<types>

<schema targetNamespace="http://example.com/foo/schema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:cl="http://example.com/foo/schema"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<!-- fault element type -->
<complexType name="FooException">
<sequence>
<element name="err" type="xsd:string" minOccurs="1" maxOccurs="1"
nillable="false"/>
<element name="msg" type="xsd:string" minOccurs="1" maxOccurs="1"
nillable="false"/>
</sequence>
</complexType>
<!-- operation request element -->
<element name="DoSomething">
<complexType>
<sequence>
<element name="in" type="xsd:string" minOccurs="0" maxOccurs="1"
nillable="true"/>
</sequence>
</complexType>
</element>
<!-- operation response element -->
<element name="DoSomethingResponse">
<complexType>
<sequence>
<element name="out" type="xsd:long" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
</element>
</schema>

</types>

<message name="DoSomething">
<part name="parameters" element="cl:DoSomething"/>
</message>

<message name="DoSomethingResponse">
<part name="parameters" element="cl:DoSomethingResponse"/>
</message>

<message name="FooExceptionFault">
<part name="fault" element="cl:FooException"/>
</message>

<portType name="fooPortType">
<operation name="DoSomething">
<input message="tns:DoSomething"/>
<output message="tns:DoSomethingResponse"/>
<fault name="FooException" message="tns:FooExceptionFault"/>
</operation>
</portType>

<binding name="foo" type="tns:fooPortType">
<SOAP:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="DoSomething">
<SOAP:operation soapAction=""/>
<input>
<SOAP:body parts="parameters" use="literal"/>
</input>
<output>
<SOAP:body parts="parameters" use="literal"/>
</output>
<fault name="FooException">
<SOAP:fault name="FooException" use="literal"/>
</fault>
</operation>
</binding>

<service name="foo">
<port name="foo" binding="tns:foo">
<SOAP:address location="http://localhost:12000/foo/foo.cgi"/>
</port>
</service>

</definitions>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message