butek 02/04/08 10:33:53 Modified: java/src/org/apache/axis/wsdl/toJava SymbolTable.java java/test/wsdl Wsdl2javaTestSuite.xml Added: java/test/wsdl/_import ImportMessagesXSDImport.wsdl Log: Fixed Bugzilla bug #7744: WSDL2Java does not work properly if xsd:import is used. And added a test for the fix. Revision Changes Path 1.53 +4 -7 xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java Index: SymbolTable.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- SymbolTable.java 5 Apr 2002 21:24:32 -0000 1.52 +++ SymbolTable.java 8 Apr 2002 17:33:52 -0000 1.53 @@ -407,17 +407,14 @@ if (doc != null) { populateTypes(doc); - // If def == null, then WSDL4J doesn't provide any import logic - // for this xml file. Recurse on Document imports rather than - // Definition imports. - if (def == null && addImports) { - // Recurse through children nodes, looking for imports + if (addImports) { + // Add the symbols from any xsd:import'ed documents. lookForImports(context, doc); } } if (def != null) { if (addImports) { - // Add the symbols from the imported WSDL documents + // Add the symbols from the wsdl:import'ed WSDL documents Map imports = def.getImports(); Object[] importKeys = imports.keySet().toArray(); for (int i = 0; i < importKeys.length; ++i) { @@ -489,7 +486,7 @@ return url; } // getURL /** - * Recursively find all import objects and call populate for each one. + * Recursively find all xsd:import'ed objects and call populate for each one. */ private void lookForImports(URL context, Node node) throws IOException { NodeList children = node.getChildNodes(); 1.94 +10 -0 xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml Index: Wsdl2javaTestSuite.xml =================================================================== RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- Wsdl2javaTestSuite.xml 5 Apr 2002 21:24:32 -0000 1.93 +++ Wsdl2javaTestSuite.xml 8 Apr 2002 17:33:53 -0000 1.94 @@ -340,6 +340,16 @@ <mapping namespace="urn:messages.import.test" package="test.import2.messages"/> </wsdl2java> + <!-- Import Test 3: all namespace->package mappings from the --> + <!-- command line. Make sure an xsd:import --> + <!-- statement inside a schema inside a type --> + <!-- works properly. --> + <wsdl2java url="test/wsdl/_import/ImportMessagesXSDImport.wsdl" + output="build/work" + noimports="no"> + <mapping namespace="urn:types.import.test" package="test.import.test3"/> + </wsdl2java> + <!-- InOut Sample --> <wsdl2java url="test/wsdl/inout/inout.wsdl" output="build/work" 1.1 xml-axis/java/test/wsdl/_import/ImportMessagesXSDImport.wsdl Index: ImportMessagesXSDImport.wsdl =================================================================== <?xml version="1.0" encoding="UTF-8"?> <definitions targetNamespace="urn:messages.import.test" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:addressTypes="urn:types.import.test"> <type> <schema targetNamespace="urn:types.import.test" xmlns:tns="urn:types.import.test" xmlns="http://www.w3.org/2001/XMLSchema/"> <import schemaLocation="Phone.xsd" namespace="urn:types.import.test"> </import> <complexType name="Address"> <all> <element name="streetNum" type="int"/> <element name="streetName" type="string"/> <element name="city" type="string"/> <element name="state" type="string"/> <element name="zip" type="int"/> <element name="phoneNumber" type="tns:PhoneNumber"/> </all> </complexType> </schema> </type> <message name="empty"/> <message name="InaddEntryRequest"> <part name="key" type="xsd:string"/> <part name="value" type="addressTypes:Address"/> </message> <message name="IngetAddressFromNameRequest"> <part name="key" type="xsd:string"/> </message> <message name="OutgetAddressFromNameResponse"> <part name="value" type="addressTypes:Address"/> </message> <message name="Fault"> <part name="value" type="xsd:string"/> </message> </definitions>