Author: thomas.diesler(a)jboss.com
Date: 2007-03-31 14:13:42 -0400 (Sat, 31 Mar 2007)
New Revision: 2740
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
Log:
Fix SOAPBody.getSource() when in DOM valid
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-03-31
17:33:18 UTC (rev 2739)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-03-31
18:13:42 UTC (rev 2740)
@@ -91,6 +91,10 @@
SOAPMessage reqMessage = (SOAPMessage)payload;
SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
Source source = soapBody.getSource();
+
+ if (source == null)
+ throw new IllegalStateException ("Payload cannot be null");
+
epInv.setRequestParamValue(xmlName, source);
return epInv;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-03-31
17:33:18 UTC (rev 2739)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-03-31
18:13:42 UTC (rev 2740)
@@ -37,6 +37,7 @@
import javax.xml.soap.SOAPFault;
import javax.xml.soap.Text;
import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
@@ -91,7 +92,21 @@
public Source getSource()
{
- return (xmlFragment != null ? xmlFragment.getSource() : null);
+ Source source;
+ if (xmlFragment != null)
+ {
+ source = xmlFragment.getSource();
+ }
+ else if (isDOMValid == true)
+ {
+ Element child = (Element)getFirstChild();
+ source = (child != null ? new DOMSource(child) : null);
+ }
+ else
+ {
+ throw new IllegalStateException("SOAPBody must be DOM valid or have a
Source attached");
+ }
+ return source;
}
public void setSource(Source source)