There are two things here: 1. The WSDL is not WS-I compliant because it violates the following requirement:
R2105 All xsd:schema elements contained in a wsdl:types element of a DESCRIPTION MUST have a targetNamespace attribute with a valid and non-null value, UNLESS the xsd:schema element has xsd:import and/or xsd:annotation as its only child element(s). [BP2107] 2. To determine the namespace of an element or type definition in a schema, wsdl2java naively walks up the node hierarchy until it finds an element with a targetNamespace attribute. Since your schema doesn't have a targetNamespace attribute, it would take the value from the targetNamespace attribute of the wsdl:definitions element. This results in the "Element ... is referenced but not defined" error message. You can work around this issue by adding targetNamespace="" to the xsd:schema element (provided that you don't want to or can't make the WSDL WS-I compliant). Andreas On Thu, Feb 9, 2012 at 07:22, luckyjun85 <leewei...@tm.com.my> wrote: > > Hi, I get this error when i try to run wsdl2java > > > java.io.IOException: Element Service is referenced but not defined. > at > org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.java:670) > 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) > > > > Here is my WSDL > > ************************************************************ > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" > xmlns:tns="http://www.tm.com.my/hsbb/eai/getCurrentBillStatement/" > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" > name="getCurrentBillStatement" > targetNamespace="http://www.tm.com.my/hsbb/eai/getCurrentBillStatement/"> > <wsdl:types> > <xsd:schema> > <xsd:element name="BusinessEvent"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="100"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="ServiceId"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="100"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="ErrorMessage"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="100"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="TotalAmountOutstanding"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="10"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="Adjustment"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="10"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="PreviousPayment"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="10"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="TotalDue"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="10"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="PaymentDueDate"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="10"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="CurrencyCode"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="10"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="ServiceDescription"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="50"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="ServiceCharges"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:maxLength value="10"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="Request"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="BusinessEvent" minOccurs="0"/> > <xsd:element ref="ServiceId" minOccurs="0"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="getCurrentBillStatement"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="Request" minOccurs="0"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="Service"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="ServiceDescription" minOccurs="0"/> > <xsd:element ref="ServiceCharges" minOccurs="0"/> > <xsd:element ref="CurrencyCode" minOccurs="0"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="ListOfService"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="Service" minOccurs="0" maxOccurs="unbounded"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="Response"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="ErrorMessage" minOccurs="0"/> > <xsd:element ref="TotalAmountOutstanding" minOccurs="0"/> > <xsd:element ref="Adjustment" minOccurs="0"/> > <xsd:element ref="PreviousPayment" minOccurs="0"/> > <xsd:element ref="TotalDue" minOccurs="0"/> > <xsd:element ref="PaymentDueDate" minOccurs="0"/> > <xsd:element ref="ListOfService" minOccurs="0"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="getCurrentBillStatementResponse"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="Response" minOccurs="0"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > </xsd:schema> > </wsdl:types> > <wsdl:message name="getCurrentBillStatement"> > <wsdl:part name="parameters" element="getCurrentBillStatement"/> > </wsdl:message> > <wsdl:message name="getCurrentBillStatementResponse"> > <wsdl:part name="parameters" element="getCurrentBillStatementResponse"/> > </wsdl:message> > <wsdl:portType name="getCurrentBillStatementPort"> > <wsdl:operation name="getCurrentBillStatement"> > <wsdl:input message="tns:getCurrentBillStatement"/> > <wsdl:output message="tns:getCurrentBillStatementResponse"/> > </wsdl:operation> > </wsdl:portType> > <wsdl:binding name="getCurrentBillStatementBinding" > type="tns:getCurrentBillStatementPort"> > <soap:binding style="document" > transport="http://schemas.xmlsoap.org/soap/http"/> > <wsdl:operation name="getCurrentBillStatement"> > <soap:operation > soapAction="http://www.tm.com.my/hsbb/eai/getCurrentBillStatement"/> > <wsdl:input> > <soap:body use="literal"/> > </wsdl:input> > <wsdl:output> > <soap:body use="literal"/> > </wsdl:output> > </wsdl:operation> > </wsdl:binding> > <wsdl:service name="getCurrentBillStatementService"> > <wsdl:port name="getCurrentBillStatementPort" > binding="tns:getCurrentBillStatementBinding"> > <soap:address location="http://localhost/getCurrentBillStatement/"/> > </wsdl:port> > </wsdl:service> > </wsdl:definitions> > > ***************************************** > > > > > > > > > -- > View this message in context: > http://old.nabble.com/Help%3A-Element-is-referenced-but-not-defined-tp33291168p33291168.html > Sent from the Axis - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org