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 gd...@apache.org on 2003/04/10 14:44:23 UTC
cvs commit: xml-axis/java/src/org/apache/axis/i18n resource.properties
gdaniels 2003/04/10 05:44:23
Modified: java/src/org/apache/axis/wsdl/fromJava Types.java
java/src/org/apache/axis/i18n resource.properties
Log:
First step to fix bug 18848.
When attempting to write (illegal) schema for a blank namespace, throw
a fault rather than doing it. This should make it clearer what's going on
at a low level.
The next step is to make sure all wrapped services (heck, all services
for that matter) have a namespace. More on that later.
Revision Changes Path
1.73 +13 -4 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.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- Types.java 27 Mar 2003 14:07:42 -0000 1.72
+++ Types.java 10 Apr 2003 12:44:22 -0000 1.73
@@ -397,7 +397,7 @@
*/
public Element writeWrapperElement(QName qname,
boolean request,
- boolean hasParams) {
+ boolean hasParams) throws AxisFault {
// Make sure a types section is present
if (wsdlTypesElem == null) {
writeWsdlTypesElement();
@@ -634,7 +634,8 @@
* @param qName qName to get the namespace of the schema node
* @param element the Element to append to the Schema node
*/
- public void writeSchemaElement(QName qName, Element element) {
+ public void writeSchemaElement(QName qName, Element element)
+ throws AxisFault {
if (wsdlTypesElem == null) {
try {
writeWsdlTypesElement();
@@ -643,6 +644,14 @@
return;
}
}
+ String namespaceURI = qName.getNamespaceURI();
+ if (namespaceURI == null || namespaceURI.equals("")) {
+ throw new AxisFault(Constants.FAULT_SERVER_GENERAL,
+ Messages.getMessage("noNamespace00",
+ qName.toString()),
+ null, null);
+ }
+
Element schemaElem = null;
NodeList nl = wsdlTypesElem.getChildNodes();
for (int i = 0; i < nl.getLength(); i++ ) {
@@ -651,7 +660,7 @@
for (int n = 0; n < attrs.getLength(); n++) {
Attr a = (Attr)attrs.item(n);
if (a.getName().equals("targetNamespace") &&
- a.getValue().equals(qName.getNamespaceURI()))
+ a.getValue().equals(namespaceURI))
schemaElem = (Element)nl.item(i);
}
}
@@ -660,7 +669,7 @@
schemaElem = docHolder.createElement("schema");
wsdlTypesElem.appendChild(schemaElem);
schemaElem.setAttribute("xmlns", Constants.URI_DEFAULT_SCHEMA_XSD);
- schemaElem.setAttribute("targetNamespace", qName.getNamespaceURI());
+ schemaElem.setAttribute("targetNamespace", namespaceURI);
// Add SOAP-ENC namespace import
Element importElem = docHolder.createElement("import");
1.53 +2 -1 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.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- resource.properties 17 Mar 2003 16:28:42 -0000 1.52
+++ resource.properties 10 Apr 2003 12:44:22 -0000 1.53
@@ -1138,4 +1138,5 @@
badEncodingStyle=Unknown encoding style
badSOAPHeader00=a SOAPHeader may only have SOAPHeaderElement as its immediate children
-badSOAPBodyElement00=a SOAPBody may only have SOAPBodyElement as its immediate children
\ No newline at end of file
+badSOAPBodyElement00=a SOAPBody may only have SOAPBodyElement as its immediate children
+noNamespace00=Attempted to write schema for bad QName (no namespace) : {0}
\ No newline at end of file