You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2001/12/31 19:31:42 UTC
cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java JavaWriter.java SchemaUtils.java SymbolTable.java Utils.java
scheu 01/12/31 10:31:41
Modified: java/src/org/apache/axis Constants.java
java/src/org/apache/axis/wsdl/fromJava Emitter.java
Types.java
java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
JavaWriter.java SchemaUtils.java SymbolTable.java
Utils.java
Log:
The following "cleanup" changes:
1) The Java2WSDL and WSDL2Java emitters contained many references to literal strings representing
namespaces and namespace prefixes. These references are changed to use the constant
strings and methods in the org.apache.axis.Constants class. This will allow the
emitters and runtime to use a consistent set of namespaces/prefixes. Plus any changes to the
namespace uris will automatically be reflected in the emitters.
2) Added additional namespace and namespace prefix constants to org.apache.axis.Constants.
(i.e. WSDL & WSDD constants)
3) Added static methods (like isSchemaXSD(string)) to Constants to query whether a string matches
a specific namespace.
Revision Changes Path
1.44 +172 -25 xml-axis/java/src/org/apache/axis/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- Constants.java 27 Nov 2001 16:57:25 -0000 1.43
+++ Constants.java 31 Dec 2001 18:31:41 -0000 1.44
@@ -66,71 +66,218 @@
// here should allow people to ask if they exist)
//////////////////////////////////////////////////////////////////////////
- // Envelope Stuff
+ // Namespace Prefix Constants
//////////////////////////////////////////////////////////////////////////
public static final String NSPREFIX_SOAP_ENV = "SOAP-ENV" ;
public static final String NSPREFIX_SOAP_ENC = "SOAP-ENC" ;
public static final String NSPREFIX_SCHEMA_XSI = "xsi" ;
public static final String NSPREFIX_SCHEMA_XSD = "xsd" ;
+ public static final String NSPREFIX_WSDL = "wsdl" ;
+ public static final String NSPREFIX_WSDL_SOAP = "wsdlsoap";
+ public static final String NSPREFIX_WSDD = "wsdd";
+ public static final String NSPREFIX_WSDD_JAVA = "wsdd-java";
+ // Axis Namespaces
public static final String AXIS_NS = "http://xml.apache.org/axis/";
-
+ public static final String URI_WSDD = "http://xml.apache.org/axis/wsdd/";
+ public static final String URI_WSDD_JAVA = "http://xml.apache.org/axis/wsdd/providers/java";
+
//
- // SOAP 1.1 constants
+ // SOAP-ENV Namespaces
//
public static final String URI_SOAP_ENV =
"http://schemas.xmlsoap.org/soap/envelope/" ;
- public static final String URI_SOAP_ENC =
- "http://schemas.xmlsoap.org/soap/encoding/" ;
- public static final String URI_NEXT_ACTOR =
- "http://schemas.xmlsoap.org/soap/actor/next" ;
-
- //
- // SOAP 1.2 constants
- //
public static final String URI_SOAP12_ENV =
"http://www.w3.org/2001/06/soap-envelope";
+ public static final String URI_CURRENT_SOAP_ENV = URI_SOAP12_ENV;
+
+ public static final String[] URIS_SOAP_ENV = {
+ URI_SOAP_ENV,
+ URI_SOAP12_ENV,
+ };
+
+ /**
+ * Returns true if SOAP_ENV Namespace
+ */
+ public static boolean isSOAP_ENV(String s) {
+ for (int i=0; i<URIS_SOAP_ENV.length; i++) {
+ if (URIS_SOAP_ENV[i].equals(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ //
+ // SOAP-ENC Namespaces
+ //
+ public static final String URI_SOAP_ENC =
+ "http://schemas.xmlsoap.org/soap/encoding/" ;
+ public static final String URI_SOAP_ENC_ALT =
+ "http://schemas.xmlsoap.org/soap/encoding" ;
public static final String URI_SOAP12_ENC =
"http://www.w3.org/2001/06/soap-encoding";
+ public static final String URI_CURRENT_SOAP_ENC = URI_SOAP12_ENC;
+
+ public static final String[] URIS_SOAP_ENC = {
+ URI_SOAP_ENC,
+ URI_SOAP_ENC_ALT,
+ URI_SOAP12_ENC,
+ };
+
+ /**
+ * Returns true if SOAP_ENC Namespace
+ */
+ public static boolean isSOAP_ENC(String s) {
+ for (int i=0; i<URIS_SOAP_ENC.length; i++) {
+ if (URIS_SOAP_ENC[i].equals(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ // Misc SOAP Namespaces
+ public static final String URI_NEXT_ACTOR =
+ "http://schemas.xmlsoap.org/soap/actor/next" ;
public static final String URI_SOAP12_NEXT_ACTOR =
"http://www.w3.org/2001/06/soap-envelope/actor/next";
+ public static final String URI_CURRENT_SOAP_NEXT_ACTOR = URI_SOAP12_NEXT_ACTOR;
+
public static final String URI_SOAP12_FAULT_NS =
"http://www.w3.org/2001/06/soap-faults";
+ public static final String URI_CURRENT_SOAP_FAULT = URI_SOAP12_FAULT_NS;
+
public static final String URI_SOAP12_UPGRADE_NS =
- "http://www.w3.org/2001/06/soap-upgrade";
-
+ "http://www.w3.org/2001/06/soap-upgrade";
+ public static final String URI_CURRENT_SOAP_UPGRADE = URI_SOAP12_UPGRADE_NS;
+ public static final String URI_SOAP_HTTP =
+ "http://schemas.xmlsoap.org/soap/http";
+ public static final String URI_SOAP12_HTTP =
+ "http://www.w3.org/2001/06/http";
+ public static final String URI_CURRENT_SOAP_HTTP = URI_SOAP12_HTTP;
+
public static String NS_URI_XMLNS =
"http://www.w3.org/2000/xmlns/";
- // Schema namespaces
- public static final String URI_1999_SCHEMA_XSI =
- "http://www.w3.org/1999/XMLSchema-instance";
+
+ //
+ // Schema XSD Namespaces
+ //
public static final String URI_1999_SCHEMA_XSD =
"http://www.w3.org/1999/XMLSchema";
- public static final String URI_2000_SCHEMA_XSI =
- "http://www.w3.org/2000/10/XMLSchema-instance";
+ public static final String URI_1999_SCHEMA_XSD_ALT =
+ "http://www.w3.org/1999/XMLSchema/";
public static final String URI_2000_SCHEMA_XSD =
"http://www.w3.org/2000/10/XMLSchema";
- public static final String URI_2001_SCHEMA_XSI =
- "http://www.w3.org/2001/XMLSchema-instance";
+ public static final String URI_2000_SCHEMA_XSD_ALT =
+ "http://www.w3.org/2000/10/XMLSchema/";
public static final String URI_2001_SCHEMA_XSD =
"http://www.w3.org/2001/XMLSchema";
- public static final String URI_CURRENT_SCHEMA_XSI = URI_2001_SCHEMA_XSI;
+ public static final String URI_2001_SCHEMA_XSD_ALT =
+ "http://www.w3.org/2001/XMLSchema/";
+
public static final String URI_CURRENT_SCHEMA_XSD = URI_2001_SCHEMA_XSD;
+
+ public static final String[] URIS_SCHEMA_XSD = {
+ URI_1999_SCHEMA_XSD,
+ URI_2000_SCHEMA_XSD,
+ URI_2001_SCHEMA_XSD,
+ URI_1999_SCHEMA_XSD_ALT,
+ URI_2000_SCHEMA_XSD_ALT,
+ URI_2001_SCHEMA_XSD_ALT,
+ };
+
+ /**
+ * Returns true if SchemaXSD Namespace
+ */
+ public static boolean isSchemaXSD(String s) {
+ for (int i=0; i<URIS_SCHEMA_XSD.length; i++) {
+ if (URIS_SCHEMA_XSD[i].equals(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ //
+ // Schema XSI Namespaces
+ //
+ public static final String URI_1999_SCHEMA_XSI =
+ "http://www.w3.org/1999/XMLSchema-instance";
+ public static final String URI_2000_SCHEMA_XSI =
+ "http://www.w3.org/2000/10/XMLSchema-instance";
+ public static final String URI_2001_SCHEMA_XSI =
+ "http://www.w3.org/2001/XMLSchema-instance";
+ public static final String URI_CURRENT_SCHEMA_XSI = URI_2001_SCHEMA_XSI;
public static final String[] URIS_SCHEMA_XSI = {
URI_1999_SCHEMA_XSI,
URI_2000_SCHEMA_XSI,
URI_2001_SCHEMA_XSI,
};
+
+ /**
+ * Returns true if SchemaXSI Namespace
+ */
+ public static boolean isSchemaXSI(String s) {
+ for (int i=0; i<URIS_SCHEMA_XSI.length; i++) {
+ if (URIS_SCHEMA_XSI[i].equals(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
- public static final String[] URIS_SCHEMA_XSD = {
- URI_1999_SCHEMA_XSD,
- URI_2000_SCHEMA_XSD,
- URI_2001_SCHEMA_XSD,
+ //
+ // WSDL Namespace
+ //
+ public static final String URI_WSDL =
+ "http://schemas.xmlsoap.org/wsdl/";
+ public static final String URI_CURRENT_WSDL = URI_WSDL;
+
+ public static final String[] URIS_WSDL = {
+ URI_WSDL,
};
+
+ /**
+ * Returns true if WSDL Namespace
+ */
+ public static boolean isWSDL(String s) {
+ for (int i=0; i<URIS_WSDL.length; i++) {
+ if (URIS_WSDL[i].equals(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ //
+ // WSDL SOAP Namespace
+ //
+ public static final String URI_WSDL_SOAP =
+ "http://schemas.xmlsoap.org/wsdl/soap/";
+ public static final String URI_CURRENT_WSDL_SOAP = URI_WSDL_SOAP;
+
+ public static final String[] URIS_WSDL_SOAP = {
+ URI_WSDL_SOAP,
+ };
+
+ /**
+ * Returns true if WSDL SOAP Namespace
+ */
+ public static boolean isWSDLSOAP(String s) {
+ for (int i=0; i<URIS_WSDL_SOAP.length; i++) {
+ if (URIS_WSDL_SOAP[i].equals(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static final String ELEM_ENVELOPE = "Envelope" ;
public static final String ELEM_HEADER = "Header" ;
1.5 +20 -12 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Emitter.java 21 Dec 2001 21:14:57 -0000 1.4
+++ Emitter.java 31 Dec 2001 18:31:41 -0000 1.5
@@ -374,17 +374,25 @@
def.addNamespace("intf", intfNS);
def.addNamespace("impl", implNS);
- def.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
- namespaces.putPrefix("http://schemas.xmlsoap.org/wsdl/soap/", "soap");
-
- def.addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
- namespaces.putPrefix("wsdl", "http://schemas.xmlsoap.org/wsdl/");
-
- def.addNamespace("soapenc", Constants.URI_SOAP_ENC);
- namespaces.putPrefix(Constants.URI_SOAP_ENC, "soapenc");
-
- def.addNamespace("xsd", Constants.URI_CURRENT_SCHEMA_XSD);
- namespaces.putPrefix(Constants.URI_CURRENT_SCHEMA_XSD, "xsd");
+ def.addNamespace(Constants.NSPREFIX_WSDL_SOAP,
+ Constants.URI_CURRENT_WSDL_SOAP);
+ namespaces.putPrefix(Constants.URI_CURRENT_WSDL_SOAP,
+ Constants.NSPREFIX_WSDL_SOAP);
+
+ def.addNamespace(Constants.NSPREFIX_WSDL,
+ Constants.URI_CURRENT_WSDL);
+ namespaces.putPrefix(Constants.URI_CURRENT_WSDL,
+ Constants.NSPREFIX_WSDL);
+
+ def.addNamespace(Constants.NSPREFIX_SOAP_ENC,
+ Constants.URI_SOAP_ENC);
+ namespaces.putPrefix(Constants.URI_SOAP_ENC,
+ Constants.NSPREFIX_SOAP_ENC);
+
+ def.addNamespace(Constants.NSPREFIX_SCHEMA_XSD,
+ Constants.URI_CURRENT_SCHEMA_XSD);
+ namespaces.putPrefix(Constants.URI_CURRENT_SCHEMA_XSD,
+ Constants.NSPREFIX_SCHEMA_XSD);
}
/**
@@ -418,7 +426,7 @@
SOAPBinding soapBinding = new SOAPBindingImpl();
soapBinding.setStyle("rpc");
- soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
+ soapBinding.setTransportURI(Constants.URI_SOAP_HTTP);
binding.addExtensibilityElement(soapBinding);
1.9 +11 -9 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Types.java 22 Dec 2001 04:38:14 -0000 1.8
+++ Types.java 31 Dec 2001 18:31:41 -0000 1.9
@@ -312,9 +312,9 @@
// Quick return if schema type
if (isSimpleSchemaType(type))
- return "xsd:" + reg.getTypeQName(type).getLocalPart();
+ return Constants.NSPREFIX_SCHEMA_XSD + ":" + reg.getTypeQName(type).getLocalPart();
if (isSimpleSoapEncodingType(type))
- return "soapenc:" + reg.getTypeQName(type).getLocalPart();
+ return Constants.NSPREFIX_SOAP_ENC + ":" + reg.getTypeQName(type).getLocalPart();
// Write the namespace
QName qName = writeTypeNamespace(type);
@@ -346,12 +346,13 @@
Element restriction = docHolder.createElement("restriction");
complexContent.appendChild(restriction);
- restriction.setAttribute("base", "soap:Array");
+ restriction.setAttribute("base", Constants.NSPREFIX_SOAP_ENC + ":Array");
Element attribute = docHolder.createElement("attribute");
restriction.appendChild(attribute);
- attribute.setAttribute("ref", "soapenc:arrayType");
- attribute.setAttribute("wsdl:arrayType", componentTypeName + "[]" );
+ attribute.setAttribute("ref", Constants.NSPREFIX_SOAP_ENC +":arrayType");
+ attribute.setAttribute(Constants.NSPREFIX_WSDL +":arrayType",
+ componentTypeName + "[]" );
} else {
if (isEnumClass(type)) {
writeEnumType(qName, type);
@@ -640,10 +641,11 @@
// generated.
if (added) {
String prefix = namespaces.getCreatePrefix(qName.getNamespaceURI());
- if (prefix.equals("soap") ||
- prefix.equals("soapenc") ||
- prefix.equals("wsdl") ||
- prefix.equals("xsd"))
+ if (prefix.equals(Constants.NSPREFIX_SOAP_ENV) ||
+ prefix.equals(Constants.NSPREFIX_SOAP_ENC) ||
+ prefix.equals(Constants.NSPREFIX_SCHEMA_XSD) ||
+ prefix.equals(Constants.NSPREFIX_WSDL) ||
+ prefix.equals(Constants.NSPREFIX_WSDL_SOAP))
return false;
else
return true;
1.5 +4 -2 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
Index: JavaDeployWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JavaDeployWriter.java 14 Dec 2001 17:31:19 -0000 1.4
+++ JavaDeployWriter.java 31 Dec 2001 18:31:41 -0000 1.5
@@ -68,6 +68,7 @@
import javax.wsdl.QName;
import javax.wsdl.Service;
+import org.apache.axis.Constants;
import org.apache.axis.utils.JavaUtils;
/**
@@ -143,7 +144,7 @@
pw.println(" <beanMapping");
pw.println(" xmlns:ns=\"" + type.getQName().getNamespaceURI() + "\"");
pw.println(" qname=\"ns:" + type.getQName().getLocalPart() + '"');
- pw.println(" languageSpecificType=\"java:" + type.getName() + '"');
+ pw.println(" languageSpecificType=\"" + Constants.NSPREFIX_WSDD_JAVA + ":" + type.getName() + '"');
pw.println(" />");
}
}
@@ -159,8 +160,9 @@
boolean isRPC = (bEntry.getBindingStyle() == BindingEntry.STYLE_RPC);
+ String prefix = Constants.NSPREFIX_WSDD_JAVA;
pw.println(" <service name=\"" + serviceName
- + "\" provider=\"" + (isRPC ? "java:RPC" : "java:MSG") + "\">");
+ + "\" provider=\"" + (isRPC ? prefix +":RPC" : prefix +":MSG") + "\">");
writeDeployBinding(binding);
1.3 +5 -3 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriter.java
Index: JavaWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JavaWriter.java 13 Dec 2001 17:33:17 -0000 1.2
+++ JavaWriter.java 31 Dec 2001 18:31:41 -0000 1.3
@@ -64,6 +64,7 @@
import javax.wsdl.QName;
import org.apache.axis.utils.JavaUtils;
+import org.apache.axis.Constants;
import org.w3c.dom.Element;
@@ -300,12 +301,13 @@
pw.println();
if ("deploy".equals(deploymentOpName)) {
pw.println("<deployment");
- pw.println(" xmlns=\"http://xml.apache.org/axis/wsdd/\"");
- pw.println(" xmlns:java=\"http://xml.apache.org/axis/wsdd/providers/java\">");
+ pw.println(" xmlns=\"" + Constants.URI_WSDD +"\"");
+ pw.println(" xmlns:" + Constants.NSPREFIX_WSDD_JAVA + "=\"" +
+ Constants.URI_WSDD_JAVA +"\">");
}
else {
pw.println("<undeployment");
- pw.println(" xmlns=\"http://xml.apache.org/axis/wsdd/\">");
+ pw.println(" xmlns=\"" + Constants.URI_WSDD +"\">");
}
} // initializeDeploymentDoc
1.6 +35 -34 xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java
Index: SchemaUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SchemaUtils.java 19 Dec 2001 21:08:22 -0000 1.5
+++ SchemaUtils.java 31 Dec 2001 18:31:41 -0000 1.6
@@ -71,6 +71,7 @@
import java.util.StringTokenizer;
import java.util.Vector;
+import org.apache.axis.Constants;
/**
* This class contains static utility methods specifically for schema type queries.
@@ -96,14 +97,14 @@
QName nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
NodeList children = node.getChildNodes();
Node complexNode = null;
for (int j = 0; j < children.getLength() && complexNode == null; j++) {
QName complexKind = Utils.getNodeQName(children.item(j));
if (complexKind != null &&
complexKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(complexKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
complexNode = children.item(j);
node = complexNode;
}
@@ -114,7 +115,7 @@
nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// Under the complexType there could be complexContent &
// extension elements if this is a derived type. Skip over these.
@@ -125,7 +126,7 @@
QName complexContentKind = Utils.getNodeQName(children.item(j));
if (complexContentKind != null &&
complexContentKind.getLocalPart().equals("complexContent") &&
- Utils.isSchemaNS(complexContentKind.getNamespaceURI()))
+ Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
complexContent = children.item(j);
}
if (complexContent != null) {
@@ -134,7 +135,7 @@
QName extensionKind = Utils.getNodeQName(children.item(j));
if (extensionKind != null &&
extensionKind.getLocalPart().equals("extension") &&
- Utils.isSchemaNS(extensionKind.getNamespaceURI()))
+ Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
extension = children.item(j);
}
}
@@ -152,7 +153,7 @@
if (groupKind != null &&
(groupKind.getLocalPart().equals("sequence") ||
groupKind.getLocalPart().equals("all")) &&
- Utils.isSchemaNS(groupKind.getNamespaceURI()))
+ Constants.isSchemaXSD(groupKind.getNamespaceURI()))
groupNode = children.item(j);
}
@@ -168,7 +169,7 @@
QName elementKind = Utils.getNodeQName(elements.item(i));
if (elementKind != null &&
elementKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(elementKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
// Get the name and type qnames.
// The name of the element is the local part of the name's qname.
@@ -210,14 +211,14 @@
QName nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
NodeList children = node.getChildNodes();
Node complexNode = null;
for (int j = 0; j < children.getLength() && complexNode == null; j++) {
QName complexKind = Utils.getNodeQName(children.item(j));
if (complexKind != null &&
complexKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(complexKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
complexNode = children.item(j);
node = complexNode;
}
@@ -228,7 +229,7 @@
nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// Under the complexType there could be should be a complexContent &
// extension elements if this is a derived type.
@@ -239,7 +240,7 @@
QName complexContentKind = Utils.getNodeQName(children.item(j));
if (complexContentKind != null &&
complexContentKind.getLocalPart().equals("complexContent") &&
- Utils.isSchemaNS(complexContentKind.getNamespaceURI()))
+ Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
complexContent = children.item(j);
}
if (complexContent != null) {
@@ -248,7 +249,7 @@
QName extensionKind = Utils.getNodeQName(children.item(j));
if (extensionKind != null &&
extensionKind.getLocalPart().equals("extension") &&
- Utils.isSchemaNS(extensionKind.getNamespaceURI()))
+ Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
extension = children.item(j);
}
}
@@ -283,14 +284,14 @@
QName nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
NodeList children = node.getChildNodes();
Node simpleNode = null;
for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
QName simpleKind = Utils.getNodeQName(children.item(j));
if (simpleKind != null &&
simpleKind.getLocalPart().equals("simpleType") &&
- Utils.isSchemaNS(simpleKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
simpleNode = children.item(j);
node = simpleNode;
}
@@ -300,7 +301,7 @@
nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("simpleType") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// Under the simpleType there should be a restriction.
// (There may be other #text nodes, which we will ignore).
@@ -310,7 +311,7 @@
QName restrictionKind = Utils.getNodeQName(children.item(j));
if (restrictionKind != null &&
restrictionKind.getLocalPart().equals("restriction") &&
- Utils.isSchemaNS(restrictionKind.getNamespaceURI()))
+ Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
restrictionNode = children.item(j);
}
@@ -346,7 +347,7 @@
QName enumKind = Utils.getNodeQName(enums.item(i));
if (enumKind != null &&
enumKind.getLocalPart().equals("enumeration") &&
- Utils.isSchemaNS(enumKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(enumKind.getNamespaceURI())) {
// Put the enum value in the vector.
Node enumNode = enums.item(i);
@@ -391,7 +392,7 @@
QName nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// Get the qName of just the type.
// The compare it against the full type of the node, which
@@ -441,14 +442,14 @@
QName nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
NodeList children = node.getChildNodes();
Node complexNode = null;
for (int j = 0; j < children.getLength() && complexNode == null; j++) {
QName complexKind = Utils.getNodeQName(children.item(j));
if (complexKind != null &&
complexKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(complexKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
complexNode = children.item(j);
node = complexNode;
}
@@ -458,7 +459,7 @@
nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// Under the complexType there should be a complexContent.
// (There may be other #text nodes, which we will ignore).
@@ -468,7 +469,7 @@
QName complexContentKind = Utils.getNodeQName(children.item(j));
if (complexContentKind != null &&
complexContentKind.getLocalPart().equals("complexContent") &&
- Utils.isSchemaNS(complexContentKind.getNamespaceURI()))
+ Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
complexContentNode = children.item(j);
}
@@ -481,7 +482,7 @@
QName restrictionKind = Utils.getNodeQName(children.item(j));
if (restrictionKind != null &&
restrictionKind.getLocalPart().equals("restriction") &&
- Utils.isSchemaNS(restrictionKind.getNamespaceURI()))
+ Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
restrictionNode = children.item(j);
}
}
@@ -492,7 +493,7 @@
baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
if (baseType != null &&
baseType.getLocalPart().equals("Array") &&
- Utils.isSoapEncodingNS(baseType.getNamespaceURI()))
+ Constants.isSOAP_ENC(baseType.getNamespaceURI()))
; // Okay
else
baseType = null; // Did not find base=soapenc:Array
@@ -512,12 +513,12 @@
if (kind != null &&
(kind.getLocalPart().equals("sequence") ||
kind.getLocalPart().equals("all")) &&
- Utils.isSchemaNS(kind.getNamespaceURI())) {
+ Constants.isSchemaXSD(kind.getNamespaceURI())) {
groupNode = children.item(j);
}
if (kind != null &&
kind.getLocalPart().equals("attribute") &&
- Utils.isSchemaNS(kind.getNamespaceURI())) {
+ Constants.isSchemaXSD(kind.getNamespaceURI())) {
attributeNode = children.item(j);
}
}
@@ -529,7 +530,7 @@
QName refQName = Utils.getNodeTypeRefQName(attributeNode, "ref");
if (refQName != null &&
refQName.getLocalPart().equals("arrayType") &&
- Utils.isSoapEncodingNS(refQName.getNamespaceURI()))
+ Constants.isSOAP_ENC(refQName.getNamespaceURI()))
; // Okay
else
refQName = null; // Did not find ref="soapenc:arrayType"
@@ -541,7 +542,7 @@
Node attrNode = (Node) attrs.elementAt(i);
String attrName = attrNode.getNodeName();
QName attrQName = Utils.getQNameFromPrefixedName(attributeNode, attrName);
- if (Utils.isWsdlNS(attrQName.getNamespaceURI())) {
+ if (Constants.isWSDL(attrQName.getNamespaceURI())) {
wsdlArrayTypeValue = attrNode.getNodeValue();
}
}
@@ -565,7 +566,7 @@
QName elementKind = Utils.getNodeQName(elements.item(i));
if (elementKind != null &&
elementKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(elementKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
elementNode = elements.item(i);
}
}
@@ -612,14 +613,14 @@
QName nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
NodeList children = node.getChildNodes();
Node complexNode = null;
for (int j = 0; j < children.getLength() && complexNode == null; j++) {
QName complexKind = Utils.getNodeQName(children.item(j));
if (complexKind != null &&
complexKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(complexKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
complexNode = children.item(j);
node = complexNode;
}
@@ -629,7 +630,7 @@
nodeKind = Utils.getNodeQName(node);
if (nodeKind != null &&
nodeKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// Inder the complexType there could be a group node.
// (There may be other #text nodes, which we will ignore).
@@ -642,7 +643,7 @@
if (kind != null &&
(kind.getLocalPart().equals("sequence") ||
kind.getLocalPart().equals("all")) &&
- Utils.isSchemaNS(kind.getNamespaceURI())) {
+ Constants.isSchemaXSD(kind.getNamespaceURI())) {
groupNode = children.item(j);
}
}
@@ -659,7 +660,7 @@
QName elementKind = Utils.getNodeQName(children.item(i));
if (elementKind != null &&
elementKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(elementKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
elementNode = children.item(i);
elementNodeCount++;
}
1.10 +7 -5 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SymbolTable.java 19 Dec 2001 21:08:22 -0000 1.9
+++ SymbolTable.java 31 Dec 2001 18:31:41 -0000 1.10
@@ -92,6 +92,8 @@
import javax.xml.rpc.holders.BooleanHolder;
+import org.apache.axis.Constants;
+
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.XMLUtils;
@@ -489,14 +491,14 @@
if (nodeKind != null) {
if (nodeKind.getLocalPart().equals("complexType") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// This is a definition of a complex type.
// Create a Type.
createTypeFromDef(node, false, false);
}
if (nodeKind.getLocalPart().equals("simpleType") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// This is a definition of a simple type, which could be an enum
// Create a Type.
@@ -504,7 +506,7 @@
}
if (nodeKind.getLocalPart().equals("restriction") ||
nodeKind.getLocalPart().equals("extension") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// The restriction or extension could be used for a number of different
// constructs (enumeration, inheritance, arrays, etc.)
@@ -513,7 +515,7 @@
}
}
else if (nodeKind.getLocalPart().equals("element") &&
- Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
// If the element has a type/ref attribute, create
// a Type representing the referenced type.
if (Utils.getAttribute(node, "type") != null ||
@@ -527,7 +529,7 @@
createTypeFromDef(node, true, level > SCHEMA_LEVEL);
}
else if (nodeKind.getLocalPart().equals("part") &&
- Utils.isWsdlNS(nodeKind.getNamespaceURI())) {
+ Constants.isWSDL(nodeKind.getNamespaceURI())) {
// This is a wsdl part. Create an TypeEntry representing the reference
createTypeFromRef(node);
1.9 +6 -51 xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Utils.java 20 Dec 2001 17:50:14 -0000 1.8
+++ Utils.java 31 Dec 2001 18:31:41 -0000 1.9
@@ -69,6 +69,7 @@
import java.util.Vector;
import org.apache.axis.utils.JavaUtils;
+import org.apache.axis.Constants;
/**
@@ -107,7 +108,7 @@
*/
public static String getBaseJavaName(QName qName) {
String localName = qName.getLocalPart();
- if (Utils.isSchemaNS(qName.getNamespaceURI())) {
+ if (Constants.isSchemaXSD(qName.getNamespaceURI())) {
if (localName.equals("string")) {
return "java.lang.String";
} else if (localName.equals("integer")) {
@@ -142,7 +143,7 @@
return "void";
}
}
- else if (Utils.isSoapEncodingNS(qName.getNamespaceURI())) {
+ else if (Constants.isSOAP_ENC(qName.getNamespaceURI())) {
if (localName.equals("string")) {
return "java.lang.String";
} else if (localName.equals("int")) {
@@ -188,7 +189,7 @@
*/
public static QName getNillableQName(QName qName) {
QName rc = new QName(qName.getNamespaceURI(), qName.getLocalPart());
- if (Utils.isSchemaNS(rc.getNamespaceURI())) {
+ if (Constants.isSchemaXSD(rc.getNamespaceURI())) {
String localName = rc.getLocalPart();
if (localName.equals("int") ||
localName.equals("long") ||
@@ -197,11 +198,11 @@
localName.equals("double") ||
localName.equals("boolean") ||
localName.equals("byte")) {
- rc.setNamespaceURI(getSoapEncodingNS());
+ rc.setNamespaceURI(Constants.URI_CURRENT_SOAP_ENC);
}
else if (localName.equals("base64Binary") ||
localName.equals("hexBinary")) {
- rc.setNamespaceURI(getSoapEncodingNS());
+ rc.setNamespaceURI(Constants.URI_CURRENT_SOAP_ENC);
rc.setLocalPart("base64");
}
}
@@ -447,52 +448,6 @@
namespace = getScopedAttribute(node, "xmlns:" + prefixedName.substring(0, prefixedName.lastIndexOf(":")));
}
return (new QName(namespace, localName));
- }
-
-
- /**
- * Return true if the indicated string is the schema namespace
- */
- public static boolean isSchemaNS(String s) {
- return (s.equals("http://www.w3.org/2001/XMLSchema")
- || s.equals("http://www.w3.org/1999/XMLSchema")
- || s.equals("http://www.w3.org/2001/XMLSchema/")
- || s.equals("http://www.w3.org/1999/XMLSchema/"));
- }
-
- /**
- * Return true if the indicated string is the schema namespace
- */
- public static boolean isWsdlNS(String s) {
- return (s.equals("http://schemas.xmlsoap.org/wsdl/"));
- }
-
- /**
- * Return true if the indicated string is the soap wsdl namespace
- */
- public static boolean isSoapWsdlNS(String s) {
- return (s.equals("http://schemas.xmlsoap.org/wsdl/soap/"));
- }
-
- /**
- * Return true if the indicated string is the soap namespace
- */
- public static boolean isSoapNS(String s) {
- return (s.equals("http://schemas.xmlsoap.org/soap") ||
- s.equals("http://schemas.xmlsoap.org/soap/") ||
- s.equals("http://www.w3.org/2001/06/soap"));
- }
-
- /**
- * Return true if the indicated string is the soap encoding namespace
- */
- public static boolean isSoapEncodingNS(String s) {
- return (s.equals("http://schemas.xmlsoap.org/soap/encoding") ||
- s.equals("http://schemas.xmlsoap.org/soap/encoding/") ||
- s.equals("http://www.w3.org/2001/06/soap-encoding"));
- }
- public static String getSoapEncodingNS() {
- return "http://www.w3.org/2001/06/soap-encoding";
}
/**