dims 2002/11/01 12:14:57
Modified: java/docs/ant axis-java2wsdl.html
java/src/org/apache/axis/wsdl/fromJava Emitter.java
Types.java
java/src/org/apache/axis/wsdl Java2WSDL.java
java/tools/org/apache/axis/tools/ant/wsdl
Java2WsdlAntTask.java
java/src/org/apache/axis/providers/java JavaProvider.java
java/src/org/apache/axis/i18n resource.properties
java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java
Added: java/test/wsdl/schemaImport build.xml foo.java foo.xsd
foobar.java SchemaImportTestCase.java
Log:
Fix and Testcase for 13981 - [PATCH] Allow schemas to be physically included into
generated WSDL
from [EMAIL PROTECTED] (Doug Bitting)
Revision Changes Path
1.3 +16 -0 xml-axis/java/docs/ant/axis-java2wsdl.html
Index: axis-java2wsdl.html
===================================================================
RCS file: /home/cvs/xml-axis/java/docs/ant/axis-java2wsdl.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- axis-java2wsdl.html 25 Oct 2002 06:29:06 -0000 1.2
+++ axis-java2wsdl.html 1 Nov 2002 20:14:56 -0000 1.3
@@ -152,6 +152,22 @@
<!-- Attribute -->
<tr>
<td bgcolor="#eeeeee" valign="top" align="left">
+ <font color="#000000" size="-1"
face="arial,helvetica,sanserif">importSchema</font>
+ </td>
+ <td bgcolor="#eeeeee" valign="top" align="left">
+ <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+ Optional attribute that indicates the name of an XML Schema
+ file that should be physically imported into the generated wsdl's
+ types section.
+ </font>
+ </td>
+ <td bgcolor="#eeeeee" valign="top" align="left">
+ <font color="#000000" size="-1"
face="arial,helvetica,sanserif">java.io.File</font>
+ </td>
+ </tr>
+ <!-- Attribute -->
+ <tr>
+ <td bgcolor="#eeeeee" valign="top" align="left">
<font color="#000000" size="-1"
face="arial,helvetica,sanserif">input</font>
</td>
<td bgcolor="#eeeeee" valign="top" align="left">
1.1 xml-axis/java/test/wsdl/schemaImport/build.xml
Index: build.xml
===================================================================
<?xml version="1.0"?>
<!-- edited with XMLSPY v5 U (http://www.xmlspy.com) by Doug Bitting (Agile
Software) -->
<!DOCTYPE project [
<!ENTITY properties SYSTEM "file:../../../xmls/properties.xml">
<!ENTITY paths SYSTEM "file:../../../xmls/path_refs.xml">
<!ENTITY taskdefs SYSTEM "file:../../../xmls/taskdefs.xml">
<!ENTITY taskdefs_post_compile SYSTEM
"file:../../../xmls/taskdefs_post_compile.xml">
<!ENTITY targets SYSTEM "file:../../../xmls/targets.xml">
]>
<!-- ===================================================================
<description>
Test/Sample Component file for Axis
Notes:
This is a build file for use with the Jakarta Ant build tool.
Prerequisites:
jakarta-ant from http://jakarta.apache.org
Build Instructions:
To compile
ant compile
To execute
ant run
Author:
Matt Seibert [EMAIL PROTECTED]
Copyright:
Copyright (c) 2002-2003 Apache Software Foundation.
</description>
==================================================================== -->
<project default="compile">
<property name="axis.home" location="../../.."/>
<property name="componentName" value="test/wsdl/schemaImport"/>
&properties;
&paths;
&taskdefs;
&taskdefs_post_compile;
&targets;
<target name="clean">
<echo message="Removing ${build.dir}/classes/${componentName} and
${build.dir}/work/${componentName}"/>
<delete dir="${build.dir}/classes/${componentName}"/>
<delete dir="${build.dir}/work/${componentName}"/>
</target>
<target name="copy" depends="setenv"/>
<target name="compile" depends="copy">
<!-- Generate the WSDL file that the test will validate.-->
<echo message="Compiling test.wsdl.schemaImport"/>
<javac srcdir="${axis.home}" destdir="${build.dest}" debug="${debug}"
fork="${javac.fork}">
<classpath refid="classpath"/>
<include name="test/wsdl/schemaImport/**.java"/>
</javac>
<mkdir dir="${axis.home}/build/work/test/wsdl/schemaImport"/>
<java2wsdl output="${axis.home}/build/work/test/wsdl/schemaImport/foo.wsdl"
className="test.wsdl.schemaImport.foo" namespace="urn:ImportSchemaTest"
importSchema="${axis.home}/test/wsdl/schemaImport/foo.xsd"
location="http://www.foo.com/foo" style="DOCUMENT">
<mapping namespace="urn:ImportSchemaTest" package="test.wsdl.schemaImport"/>
</java2wsdl>
</target>
<target name="run">
<antcall target="execute-Component-noServer"/>
</target>
</project>
1.1 xml-axis/java/test/wsdl/schemaImport/foo.java
Index: foo.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package test.wsdl.schemaImport;
public class foo
{
public foo()
{
}
}
// End of foobar.java
1.1 xml-axis/java/test/wsdl/schemaImport/foo.xsd
Index: foo.xsd
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 U (http://www.xmlspy.com) by Doug Bitting (Agile
Software) -->
<xs:schema targetNamespace="urn:ImportSchemaTest" xmlns="urn:ImportSchemaTest"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:complexType name="foo">
<xs:sequence>
<xs:element name="bar" type="xs:string">
<xs:annotation>
<xs:documentation>bar annotation</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="baz" type="xs:string">
<xs:annotation>
<xs:documentation>baz annotation</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ball" type="xs:string">
<xs:annotation>
<xs:documentation>ball annotation</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
1.1 xml-axis/java/test/wsdl/schemaImport/foobar.java
Index: foobar.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package test.wsdl.schemaImport;
public class foobar
{
public void run(foo x)
{
}
}
// End of foobar.java
1.1 xml-axis/java/test/wsdl/schemaImport/SchemaImportTestCase.java
Index: SchemaImportTestCase.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package test.wsdl.schemaImport;
import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.wsdl.Definition;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import java.io.File;
/**
* This class contains the methods necessary for testing that the XML Schema
* import support is functional within WSDL2Java. This test will generate a
* WSDL file and then validate that the schema has been appropriate imported
* into said WSDL.
*
* @version 1.00 01 Nov 2002
* @author Doug Bitting ([EMAIL PROTECTED])
*/
public class SchemaImportTestCase extends junit.framework.TestCase {
public SchemaImportTestCase(String name) {
super(name);
}
public void testSchemaImport() {
String path = "build" + File.separator + "work" + File.separator +
"test" + File.separator + "wsdl" + File.separator +
"schemaImport" + File.separator + "foo.wsdl";
Document doc = null;
Definition def = null;
// Make sure that the WSDL appears to be valid
try {
doc = XMLUtils.newDocument(path);
assertNotNull("Unable to locate WSDL file: " + path, doc);
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
def = reader.readWSDL(path, doc);
assertNotNull("unable to generate WSDL definition from document: "
+ path, def);
} catch (Exception e) {
throw new junit.framework.AssertionFailedError("Exception caught: "
+ e);
}
// Now check that the schema was properly imported. It is assumed
// that WSDL generation is validated in other unit tests. Here, we
// are only interested in the schema importing functionality.
NodeList typeList = doc.getElementsByTagName("wsdl:types");
Node typeNode = typeList.item(0);
assertNotNull("types section of the WSDL document", typeNode);
Element typeElem = (Element) typeNode;
NodeList nodeList = typeElem.getElementsByTagName("xs:complexType");
assertTrue("Could not located imported schema",
nodeList.getLength() > 0);
Element elt = (Element) nodeList.item(0);
assertEquals("Unexpected complexType", "foo", elt.getAttribute("name"));
nodeList = elt.getElementsByTagName("xs:documentation");
assertTrue("Could not find schema documentation",
nodeList.getLength() > 0);
}
}
// End of SchemaImportTestCase.java
1.75 +20 -1 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- Emitter.java 17 Oct 2002 20:41:09 -0000 1.74
+++ Emitter.java 1 Nov 2002 20:14:56 -0000 1.75
@@ -144,6 +144,7 @@
private boolean useInheritedMethods = false;
private String intfNS;
private String implNS;
+ private String inputSchema;
private String inputWSDL;
private String locationUrl;
private String importUrl;
@@ -612,6 +613,9 @@
if (inputWSDL != null) {
types.loadInputTypes(inputWSDL);
}
+ if (inputSchema != null) {
+ types.loadInputSchema(inputSchema);
+ }
return types;
}
@@ -1062,7 +1066,7 @@
Message msg = def.createMessage();
QName qName = createMessageName(def, oper.getName(), "Request");
-
+
msg.setQName(qName);
msg.setUndefined(false);
@@ -1598,6 +1602,21 @@
*/
public void setInputWSDL(String inputWSDL) {
this.inputWSDL = inputWSDL;
+ }
+
+ /**
+ * @return the name of the input schema, or null
+ */
+ public String getInputSchema() {
+ return inputSchema;
+ }
+
+ /**
+ * Set the name of the input schema
+ * @param inputSchema the name of the input schema
+ */
+ public void setInputSchema(String inputSchema) {
+ this.inputSchema = inputSchema;
}
/**
1.65 +62 -3 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java
Index: Types.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- Types.java 10 Oct 2002 19:56:45 -0000 1.64
+++ Types.java 1 Nov 2002 20:14:56 -0000 1.65
@@ -88,9 +88,13 @@
import javax.wsdl.WSDLException;
import javax.xml.namespace.QName;
import javax.xml.rpc.holders.Holder;
+import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -155,6 +159,64 @@
public Namespaces getNamespaces() {
return namespaces;
}
+
+ /**
+ * Loads the types from the input schema file.
+ * @param inputSchema file or URL
+ */
+ public void loadInputSchema(String inputSchema)
+ throws IOException, WSDLException, SAXException,
+ ParserConfigurationException
+ {
+ // Read the input wsdl file into a Document
+ Document doc = XMLUtils.newDocument(inputSchema);
+
+ // Ensure that the root element is xsd:schema
+ Element root = doc.getDocumentElement();
+ if (root.getLocalName().equals("schema") &&
+ Constants.isSchemaXSD(root.getNamespaceURI())) {
+ Node schema = docHolder.importNode(root, true);
+ if (null == wsdlTypesElem) {
+ writeWsdlTypesElement();
+ }
+ wsdlTypesElem.appendChild(schema);
+
+ // Create a symbol table and populate it with the input types
+ BaseTypeMapping btm =
+ new BaseTypeMapping() {
+ public String getBaseName(QName qNameIn) {
+ QName qName = new QName(
+ qNameIn.getNamespaceURI(),
+ qNameIn.getLocalPart());
+ Class cls = defaultTM.getClassForQName(qName);
+ if (cls == null)
+ return null;
+ else
+ return JavaUtils.getTextClassName(cls.getName());
+ }
+ };
+ SymbolTable symbolTable = new SymbolTable(btm,
+ true, false, false);
+ symbolTable.populateTypes(new URL(inputSchema), doc);
+
+ // Walk the type/element entries in the symbol table and
+ // add each one to the list of processed types. This prevents
+ // the types from being duplicated.
+ Vector v = symbolTable.getTypes();
+ for (int i=0; i < v.size(); i++) {
+ TypeEntry te = (TypeEntry) v.elementAt(i);
+ if (te instanceof org.apache.axis.wsdl.symbolTable.Element) {
+ addToElementsList(te.getQName());
+ } else if (te instanceof Type) {
+ addToTypesList(te.getQName());
+ }
+ }
+ } else {
+ // If not, we'll just bail out... perhaps we should log a warning
+ // or throw an exception?
+ ;
+ }
+ }
/**
* Load the types from the input wsdl file.
@@ -224,10 +286,7 @@
addToTypesList(te.getQName());
}
}
-
-
}
-
/**
* Write out a type referenced by a part type attribute.
1.36 +26 -18 xml-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java
Index: Java2WSDL.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- Java2WSDL.java 25 Oct 2002 19:10:22 -0000 1.35
+++ Java2WSDL.java 1 Nov 2002 20:14:57 -0000 1.36
@@ -77,30 +77,31 @@
public class Java2WSDL {
// Define our short one-letter option identifiers.
+ protected static final int INHERITED_CLASS_OPT = 'a';
+ protected static final int SOAPACTION_OPT = 'A';
+ protected static final int BINDING_NAME_OPT = 'b';
+ protected static final int STOP_CLASSES_OPT = 'c';
+ protected static final int IMPORT_SCHEMA_OPT = 'C';
+ protected static final int EXTRA_CLASSES_OPT = 'e';
protected static final int HELP_OPT = 'h';
- protected static final int OUTPUT_WSDL_MODE_OPT = 'w';
+ protected static final int IMPL_CLASS_OPT = 'i';
protected static final int INPUT_OPT = 'I';
+ protected static final int LOCATION_OPT = 'l';
+ protected static final int LOCATION_IMPORT_OPT = 'L';
+ protected static final int METHODS_ALLOWED_OPT = 'm';
+ protected static final int NAMESPACE_OPT = 'n';
+ protected static final int NAMESPACE_IMPL_OPT = 'N';
protected static final int OUTPUT_OPT = 'o';
protected static final int OUTPUT_IMPL_OPT = 'O';
protected static final int PACKAGE_OPT = 'p';
- protected static final int NAMESPACE_OPT = 'n';
- protected static final int NAMESPACE_IMPL_OPT = 'N';
protected static final int PORTTYPE_NAME_OPT = 'P';
- protected static final int SERVICE_ELEMENT_NAME_OPT = 'S';
protected static final int SERVICE_PORT_NAME_OPT = 's';
- protected static final int BINDING_NAME_OPT = 'b';
- protected static final int LOCATION_OPT = 'l';
- protected static final int LOCATION_IMPORT_OPT = 'L';
- protected static final int METHODS_ALLOWED_OPT = 'm';
- protected static final int INHERITED_CLASS_OPT = 'a';
- protected static final int IMPL_CLASS_OPT = 'i';
- protected static final int METHODS_NOTALLOWED_OPT = 'x';
- protected static final int STOP_CLASSES_OPT = 'c';
+ protected static final int SERVICE_ELEMENT_NAME_OPT = 'S';
protected static final int TYPEMAPPING_OPT = 'T';
- protected static final int SOAPACTION_OPT = 'A';
- protected static final int STYLE_OPT = 'y';
protected static final int USE_OPT = 'u';
- protected static final int EXTRA_CLASSES_OPT = 'e';
+ protected static final int OUTPUT_WSDL_MODE_OPT = 'w';
+ protected static final int METHODS_NOTALLOWED_OPT = 'x';
+ protected static final int STYLE_OPT = 'y';
/**
* Define the understood options. Each CLOptionDescriptor contains:
@@ -207,8 +208,11 @@
new CLOptionDescriptor("extraClasses",
CLOptionDescriptor.DUPLICATES_ALLOWED +
CLOptionDescriptor.ARGUMENT_REQUIRED,
EXTRA_CLASSES_OPT,
- Messages.getMessage("j2woptExtraClasses00"))
-
+ Messages.getMessage("j2woptExtraClasses00")),
+ new CLOptionDescriptor("importSchema",
+ CLOptionDescriptor.ARGUMENT_OPTIONAL,
+ IMPORT_SCHEMA_OPT,
+ Messages.getMessage("j2woptImportSchema00"))
};
protected Emitter emitter;
@@ -417,7 +421,11 @@
status = false;
}
break;
-
+
+ case IMPORT_SCHEMA_OPT:
+ emitter.setInputSchema(option.getArgument());
+ break;
+
default:
break;
}
1.11 +14 -0
xml-axis/java/tools/org/apache/axis/tools/ant/wsdl/Java2WsdlAntTask.java
Index: Java2WsdlAntTask.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/tools/org/apache/axis/tools/ant/wsdl/Java2WsdlAntTask.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Java2WsdlAntTask.java 25 Oct 2002 19:13:10 -0000 1.10
+++ Java2WsdlAntTask.java 1 Nov 2002 20:14:57 -0000 1.11
@@ -93,6 +93,7 @@
private String location = "";
private String locationImport = null;
private String output = "." ;
+ private String importSchema = null ;
private String input = null ;
private String outputImpl = null;
private String className = "." ;
@@ -122,6 +123,7 @@
log("\tPkgtoNS:" + namespaceMap, logLevel);
log("\tlocation:" + location, logLevel);
log("\toutput:" + output, logLevel);
+ log("\timportSchema:" + importSchema, logLevel);
log("\tinput:" + input, logLevel);
log("\tclassName:" + className, logLevel);
log("\tservicePortName:" + servicePortName, logLevel);
@@ -208,6 +210,9 @@
emitter.setUse(use);
}
+ if (importSchema != null) {
+ emitter.setInputSchema(importSchema);
+ }
if (input != null) {
emitter.setInputWSDL(input);
}
@@ -251,6 +256,15 @@
*/
public void setOutput(File parameter) {
this.output = parameter.getPath();
+ }
+
+ /**
+ * Option attribute that indicates the name of an XML Schema file that
+ * should be physically imported into the generated WSDL.
+ * @param parameter
+ */
+ public void setImportSchema(File parameter) throws java.io.IOException {
+ this.importSchema = parameter.toURL().toString();
}
/**
1.90 +9 -2
xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
Index: JavaProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- JavaProvider.java 16 Oct 2002 21:15:39 -0000 1.89
+++ JavaProvider.java 1 Nov 2002 20:14:57 -0000 1.90
@@ -115,6 +115,7 @@
public static final String OPTION_WSDL_SERVICEELEMENT="wsdlServiceElement";
public static final String OPTION_WSDL_SERVICEPORT="wsdlServicePort";
public static final String OPTION_WSDL_TARGETNAMESPACE="wsdlTargetNamespace";
+ public static final String OPTION_WSDL_INPUTSCHEMA="wsdlInputSchema";
public static final String OPTION_SCOPE = "scope";
@@ -446,8 +447,8 @@
emitter.setLocationUrl(locationUrl);
emitter.setServiceDesc(serviceDesc);
- emitter.setTypeMapping((TypeMapping)msgContext.getTypeMappingRegistry().
- getTypeMapping(Constants.URI_DEFAULT_SOAP_ENC));
+ emitter.setTypeMapping((TypeMapping)msgContext.getTypeMappingRegistry()
+
.getTypeMapping(serviceDesc.getUse().getEncoding()));
emitter.setDefaultTypeMapping((TypeMapping)msgContext.getTypeMappingRegistry().
getDefaultTypeMapping());
@@ -463,6 +464,12 @@
}
if (wsdlServicePort != null && wsdlServicePort.length() > 0) {
emitter.setServicePortName(wsdlServicePort);
+ }
+
+ String wsdlInputSchema = (String)
+ service.getOption(OPTION_WSDL_INPUTSCHEMA);
+ if (null != wsdlInputSchema && wsdlInputSchema.length() > 0) {
+ emitter.setInputSchema(wsdlInputSchema);
}
Document doc = emitter.emit(Emitter.MODE_ALL);
1.25 +1 -0 xml-axis/java/src/org/apache/axis/i18n/resource.properties
Index: resource.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/i18n/resource.properties,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- resource.properties 30 Oct 2002 14:21:41 -0000 1.24
+++ resource.properties 1 Nov 2002 20:14:57 -0000 1.25
@@ -704,6 +704,7 @@
j2wmodeerror=Error Unrecognized Mode: {0} Use All, Interface or Implementation.
Continuing with All.
j2woptexclude00=space or comma separated list of methods not to export
j2woptstopClass00=space or comma separated list of class names which will stop
inheritance search if --all switch is given
+j2woptImportSchema00=A file or URL to an XML Schema that should be physically
imported into the generated WSDL
# NOTE: in optionSkeletonDeploy00, do not translate "--server-side".
optionSkeletonDeploy00=deploy skeleton (true) or implementation (false) in
deploy.wsdd. Default is false. Assumes --server-side.
1.51 +1 -1
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.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- SymbolTable.java 29 Oct 2002 22:07:27 -0000 1.50
+++ SymbolTable.java 1 Nov 2002 20:14:57 -0000 1.51
@@ -639,7 +639,7 @@
/**
* Populate the symbol table with all of the Types from the Document.
*/
- private void populateTypes(URL context, Document doc)
+ public void populateTypes(URL context, Document doc)
throws IOException, SAXException, WSDLException,
ParserConfigurationException {
addTypes(context, doc, ABOVE_SCHEMA_LEVEL);