Author: jason.greene(a)jboss.com
Date: 2006-10-23 18:29:23 -0400 (Mon, 23 Oct 2006)
New Revision: 1291
Modified:
branches/jbossws-1.0.3.GA-JBWS-1311/src/main/java/org/jboss/ws/utils/DOMWriter.java
branches/jbossws-1.0.3.GA-JBWS-1311/src/test/java/org/jboss/test/ws/jbws1303/ServerHandler.java
Log:
Correct test case
Fix condition when xsi is defined on the envelope
Modified:
branches/jbossws-1.0.3.GA-JBWS-1311/src/main/java/org/jboss/ws/utils/DOMWriter.java
===================================================================
---
branches/jbossws-1.0.3.GA-JBWS-1311/src/main/java/org/jboss/ws/utils/DOMWriter.java 2006-10-23
19:15:52 UTC (rev 1290)
+++
branches/jbossws-1.0.3.GA-JBWS-1311/src/main/java/org/jboss/ws/utils/DOMWriter.java 2006-10-23
22:29:23 UTC (rev 1291)
@@ -72,6 +72,7 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.jboss.logging.Logger;
/**
* Traverse a DOM tree in order to print a document that is parsed.
@@ -82,6 +83,7 @@
*/
public class DOMWriter
{
+ private static Logger log = Logger.getLogger(DOMWriter.class);
// Print writer
private PrintWriter out;
// True, if canonical output
@@ -291,13 +293,19 @@
{
String nsURI = getNamespaceURI(atPrefix, element, rootNode);
nsMap.put(atPrefix, nsURI);
-
// xsi:type='ns1:SubType', xsi:type='xsd:string'
- if (atName.equals(atPrefix + ":type") &&
nsURI.equals("http://www.w3.org/2001/XMLSchema-instance") &&
atValue.indexOf(":") > 0)
+ if (atName.equals(atPrefix + ":type") &&
atValue.indexOf(":") > 0)
{
- String typePrefix = atValue.substring(0,
atValue.indexOf(":"));
- String typeURI = getNamespaceURI(typePrefix, element, rootNode);
- nsMap.put(typePrefix, typeURI);
+ // xsi defined on the envelope
+ if (nsURI == null)
+ nsURI = getNamespaceURI(atPrefix, element, null);
+
+ if
("http://www.w3.org/2001/XMLSchema-instance".equals(nsURI))
+ {
+ String typePrefix = atValue.substring(0,
atValue.indexOf(":"));
+ String typeURI = getNamespaceURI(typePrefix, element, rootNode);
+ nsMap.put(typePrefix, typeURI);
+ }
}
}
@@ -576,4 +584,4 @@
}
return (str.toString());
}
-}
\ No newline at end of file
+}
Modified:
branches/jbossws-1.0.3.GA-JBWS-1311/src/test/java/org/jboss/test/ws/jbws1303/ServerHandler.java
===================================================================
---
branches/jbossws-1.0.3.GA-JBWS-1311/src/test/java/org/jboss/test/ws/jbws1303/ServerHandler.java 2006-10-23
19:15:52 UTC (rev 1290)
+++
branches/jbossws-1.0.3.GA-JBWS-1311/src/test/java/org/jboss/test/ws/jbws1303/ServerHandler.java 2006-10-23
22:29:23 UTC (rev 1291)
@@ -40,11 +40,13 @@
}
/**
- * <env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ * <env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
+ *
xmlns:xsi='http://www.w3c.org/2001/XMLSchema-instance'
+ &
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
* <env:Header/>
* <env:Body>
* <lastmodResponse xmlns='http://netid.msu.edu:8080/lastmod.pl'>
- * <TimeChanged
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:type='xsd:string'>yesterday</TimeChanged>
+ * <TimeChanged xsi:type='xsd:string'>yesterday</TimeChanged>
* </lastmodResponse>
* </env:Body>
* </env:Envelope>
@@ -56,10 +58,10 @@
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
soapEnvelope.addNamespaceDeclaration(Constants.PREFIX_XSD,
Constants.NS_SCHEMA_XSD);
+ soapEnvelope.addNamespaceDeclaration(Constants.PREFIX_XSI,
Constants.NS_SCHEMA_XSI);
SOAPElement bodyElement =
soapMessage.getSOAPBody().addChildElement("lastmodResponse");
bodyElement.setAttribute("xmlns",
"http://netid.msu.edu:8080/lastmod.pl");
SOAPElement soapElement = bodyElement.addChildElement("TimeChanged");
- soapElement.addNamespaceDeclaration(Constants.PREFIX_XSI,
Constants.NS_SCHEMA_XSI);
soapElement.setAttribute("xsi:type", "xsd:string");
soapElement.setValue("yesterday");
((SOAPMessageContext)msgContext).setMessage(soapMessage);