Anne Thomas Manes said:
 
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
 
 
 
I tried that and it worked for the java2wsdl process.  But then I got errors during the wsdl2java process.  myNames is the referenced class
 
C:\axis\axis-1_4>c:\axis\java2wsdl  -e samples.userguide.myTest.myNames -o myTest.wsdl -lhttp:"//localhost:8080/axis/services/myTest -n "urn:myTest" -p"samples
.userguide.myTest" "urn:myTest" samples.userguide.myTest.myTest
 
C:\axis\axis-1_4>java -cp .;C:\axis\jaf-1.1\activation.jar;C:\axis\axis-1_4\lib\axis.jar;C:\axis\axis-1_4\lib\commons-discovery-0.2.jar;C:\axis\axis-1_4\lib\com
mons-logging-1.0.4.jar;C:\axis\axis-1_4\lib\jaxrpc.jar;C:\axis\axis-1_4\lib\saaj.jar;C:\axis\axis-1_4\lib\log4j-1.2.8.jar;C:\axis\axis-1_4\lib\wsdl4j-1.5.1.jar;
C:\javamail\javamail-1.4\mail.jar;C:\xerces\xerces-2_8_0\xml-apis.jar;C:\xerces\xerces-2_8_0\xercesImpl.jar; org.apache.axis.wsdl.Java2WSDL -e samples.userguide
.myTest.myNames -o myTest.wsdl -l"http:"//localhost:8080/axis/services/myTest -n "urn:myTest" -p"samples.userguide.myTest" "urn:myTest" samples.userguide.myTest
.myTest
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.
C:\axis\axis-1_4>..\jw2
 
C:\axis\axis-1_4>c:\axis\wsdl2java -o . -d Session -s -S true  -Nurn:myTest -i  samples.userguide.myTest myTest.wsdl
 
C:\axis\axis-1_4>java -cp .;C:\axis\jaf-1.1\activation.jar;C:\axis\axis-1_4\lib\axis.jar;C:\axis\axis-1_4\lib\commons-discovery-0.2.jar;C:\axis\axis-1_4\lib\com
mons-logging-1.0.4.jar;C:\axis\axis-1_4\lib\jaxrpc.jar;C:\axis\axis-1_4\lib\saaj.jar;C:\axis\axis-1_4\lib\log4j-1.2.8.jar;C:\axis\axis-1_4\lib\wsdl4j-1.5.1.jar;
C:\javamail\javamail-1.4\mail.jar;C:\xerces\xerces-2_8_0\xml-apis.jar;C:\xerces\xerces-2_8_0\xercesImpl.jar; org.apache.axis.wsdl.WSDL2Java -o . -d Session -s -
S true  -Nurn:myTest -i  samples.userguide.myTest myTest.wsdl
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.
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)
C:\axis\axis-1_4>
 
Newly generated WSDL:
<?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>
 
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;
        }
 
}
 
 
Thank You
 
 
Brad Taylor

Reply via email to