You must add this switch to your java2wsdl command:

-e, --extraClasses <argument>
A space or comma separated list of class names to be added to
the type section.

On 6/7/06, Taylor, Clarence B <[EMAIL PROTECTED]> wrote:



I am trying to create a web service the returns an array of objects.  I get an error when running WSDL2Java  "classname referenced  but not defined" where classname is an element in the array of objects I want to return.  Details below
 
 
 
1). I compile myTest.java to create myTest.class
2). I run Jav2wsdl as below: to create myTest.wsdl
 
c:\axis\java2wsdl -o myTest.wsdl -l"http:"//localhost:8080/axis/services/myTest -n "urn:myTest" -p"samples.userguide.myTest" "urn:myTest" samples.userguide.myTest.myTest
 
3). I run wsdl2java as below: and get the the error
 
c:\axis\wsdl2java -o . -d Session -s -S true  -Nurn:myTest -i  samples.userguide.myTest myTest.wsdl
 
java.io.IOException: Type {urn:myTest}myNames 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(Unknown Source)

 
Java source for Java2WSDL:
 
package samples.userguide.myTest;
 
public interface myTest extends java.rmi.Remote {
    public samples.userguide.myTest.myNames[] getmyTest() throws java.rmi.RemoteException;
}
 
Java source for the class the defines myNames:
 
package samples.userguide.myTest;
public class myNames {
        public String FirstName;
        public String LastName;
        public String Adddress;
        public String PhoneNumber;
        public myNames(String sFirstName, String sLastName, String sAdddress, String sPhoneNumber) {
                super();
                FirstName = sFirstName;
                LastName = sLastName;
                Adddress = sAdddress;
                PhoneNumber = sPhoneNumber;
        }
 
}
 
Generated WSDL from java2wsdl:
 
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:myTest" xmlns:apachesoap="
http://xml.apache.org/xml-soap" xmlns:impl="urn:myTest" xmlns:intf="urn:myTest" xmlns:soapenc=" http://schemas.xmlsoap.org/soap/encoding/" 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.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema targetNamespace="urn:myTest" xmlns="
http://www.w3.org/2001/XMLSchema ">
   <import namespace="
http://schemas.xmlsoap.org/soap/encoding/"/ >
   <complexType name="ArrayOfmyNames">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:myNames[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
 </wsdl:types>
   <wsdl:message name="getmyTestResponse">
      <wsdl:part name="getmyTestReturn" type="impl:ArrayOfmyNames"/>
   </wsdl:message>
   <wsdl:message name="getmyTestRequest">
   </wsdl:message>
   <wsdl:portType name="myTest">
      <wsdl:operation name="getmyTest">
         <wsdl:input message="impl:getmyTestRequest" name="getmyTestRequest"/>
         <wsdl:output message="impl:getmyTestResponse" name="getmyTestResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="myTestSoapBinding" type="impl:myTest">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/ >
      <wsdl:operation name="getmyTest">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getmyTestRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/ " namespace="urn:myTest" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="getmyTestResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/ " namespace="urn:myTest" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="myTestService">
      <wsdl:port binding="impl:myTestSoapBinding" name="myTest">
         <wsdlsoap:address location="http://localhost:8080/axis/services/myTest"/ >
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>
 
 
Thank You
 
 
Brad Taylor

Reply via email to