butek 02/05/14 08:17:19 Modified: java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java java/test/wsdl Wsdl2javaTestSuite.xml Added: java/test/wsdl/import2/interface1/interface2 importinterface.wsdl java/test/wsdl/import2/service1/service2 testimport.wsdl java/test/wsdl/import2/types1/types2 importtypes.wsdl Log: Import patch and test from Thomas Sandholm ([EMAIL PROTECTED]). Revision Changes Path 1.4 +21 -14 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java Index: SymbolTable.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SymbolTable.java 9 May 2002 18:38:22 -0000 1.3 +++ SymbolTable.java 14 May 2002 15:17:19 -0000 1.4 @@ -511,24 +511,16 @@ // See if we have a good URL. URL url = null; try { - url = new URL(contextURL, path); + if (contextURL != null && contextURL.getProtocol().equals("file")) { + url = getFileURL(contextURL, path); + } else { + url = new URL(contextURL, path); + } } catch (MalformedURLException me) { // try treating is as a file pathname - if (contextURL == null) { - url = new URL("file", "", path); - } else { - // get the parent directory of the contextURL, and append - // the spec string to the end. - String contextFileName = contextURL.getFile(); - String parentName = new File(contextFileName).getParent(); - if (parentName != null) { - url = new URL(new URL("file", "", parentName + '/'), path); - } else { - url = new URL("file", "", path); - } - } + url = getFileURL(contextURL, path); } // Everything is OK with this URL, although a file url constructed @@ -536,6 +528,21 @@ // accessed. return url; } // getURL + + private static URL getFileURL(URL contextURL, String path) + throws IOException { + if (contextURL != null) { + // get the parent directory of the contextURL, and append + // the spec string to the end. + String contextFileName = contextURL.getFile(); + String parentName = new File(contextFileName).getParent(); + if (parentName != null) { + return new URL("file", "", parentName + "/" + path); + } + } + return new URL("file", "", path); + } // getFileURL + /** * Recursively find all xsd:import'ed objects and call populate for each one. */ 1.97 +12 -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.96 retrieving revision 1.97 diff -u -r1.96 -r1.97 --- Wsdl2javaTestSuite.xml 7 May 2002 16:08:51 -0000 1.96 +++ Wsdl2javaTestSuite.xml 14 May 2002 15:17:19 -0000 1.97 @@ -358,6 +358,7 @@ <mapping namespace="urn:importBinding1" package="test.wsdl.import.binding1"/> <mapping namespace="urn:importBinding2" package="test.wsdl.import.binding2"/> </wsdl2java> + <!-- Import Test 2: all namespace->package mappings from the --> <!-- command line. --> <wsdl2java url="test/wsdl/_import/Import.wsdl" @@ -384,6 +385,17 @@ output="build/work" noimports="no"> <mapping namespace="urn:types.import.test" package="test.import.test3"/> + </wsdl2java> + + <!-- Another import test: relative references via ../.. --> + <wsdl2java url="test/wsdl/import2/service1/service2/testimport.wsdl" + output="build/work" + serverSide="yes" + skeletonDeploy="yes" + noimports="no"> + <mapping namespace="http://test.globus.org/importtest" package="test.wsdl.import2"/> + <mapping namespace="http://test.globus.org/interface" package="test.wsdl.import2.interface"/> + <mapping namespace="http://test.globus.org/types" package="test.wsdl.import2.types"/> </wsdl2java> <!-- InOut Sample --> 1.1 xml-axis/java/test/wsdl/import2/interface1/interface2/importinterface.wsdl Index: importinterface.wsdl =================================================================== <definitions name="ImportTestDefinition" targetNamespace="http://test.globus.org/interface" xmlns:tns="http://test.globus.org/interface" xmlns:types="http://test.globus.org/types" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <import namespace="http://http://test.globus.org/types" location="../../types1/types2/importtypes.wsdl"/> <message name="sendStringRequest"> <part name="myInput" type="types:StringType"/> </message> <message name="sendStringResponse"/> <portType name="ImportTestPortType"> <operation name="sendString"> <input message="tns:sendStringRequest"/> <output message="tns:sendStringResponse"/> </operation> </portType> <binding name="ImportTestSOAPBinding" type="tns:ImportTestPortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="sendString"> <soap:operation soapAction="http://test.globus.org/importtest#sendString"/> <input> <soap:body use="encoded" namespace="http://test.globus.org/importtest" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body use="encoded" namespace="http://test.globus.org/importtest" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> </definitions> 1.1 xml-axis/java/test/wsdl/import2/service1/service2/testimport.wsdl Index: testimport.wsdl =================================================================== <?xml version="1.0" encoding="UTF-8"?> <definitions name="ImportTestDefinition" targetNamespace="http://test.globus.org/importtest" xmlns:tns="http://test.globus.org/importtest" xmlns:interface="http://test.globus.org/interface" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <import namespace="http://test.globus.org/interface" location="../../interface1/interface2/importinterface.wsdl"/> <service name="ImportTestService"> <port binding="interface:ImportTestSOAPBinding" name="ImportTestPort"> <soap:address location="http://localhost:8080/axis/services"/> </port> </service> </definitions> 1.1 xml-axis/java/test/wsdl/import2/types1/types2/importtypes.wsdl Index: importtypes.wsdl =================================================================== <definitions name="ImportTestDefinition" targetNamespace="http://test.globus.org/importtest" xmlns:tns="http://test.globus.org/importtest" xmlns:types="http://test.globus.org/types" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <types> <schema targetNamespace="http://test.globus.org/types" xmlns:tns="http://test.globus.org/types" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="StringType"> <xsd:sequence> <xsd:element name="myString" type="xsd:string" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </schema> </types> </definitions>