Author: thomas.diesler(a)jboss.com
Date: 2007-03-20 18:23:25 -0400 (Tue, 20 Mar 2007)
New Revision: 2649
Modified:
trunk/build/etc/component-info/jbossws-core.xml
trunk/build/version.properties
trunk/integration-jboss50/build.xml
trunk/jbossws-core/src/java/javax/xml/soap/FactoryLoader.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/DOMContent.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContent.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContentAccess.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContentElement.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLContent.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/logicalhandler/ProtocolHandler.java
Log:
Fix SOAPContentElement.setPayload(Source)
Modified: trunk/build/etc/component-info/jbossws-core.xml
===================================================================
--- trunk/build/etc/component-info/jbossws-core.xml 2007-03-20 14:12:42 UTC (rev 2648)
+++ trunk/build/etc/component-info/jbossws-core.xml 2007-03-20 22:23:25 UTC (rev 2649)
@@ -27,6 +27,9 @@
<import componentref="jbpm/bpel">
<compatible version="@jbpm-bpel@"/>
</import>
+ <import componentref="stax-api">
+ <compatible version="@stax-api@"/>
+ </import>
<import componentref="sun-jaxb">
<compatible version="@sun-jaxb@"/>
</import>
Modified: trunk/build/version.properties
===================================================================
--- trunk/build/version.properties 2007-03-20 14:12:42 UTC (rev 2648)
+++ trunk/build/version.properties 2007-03-20 22:23:25 UTC (rev 2649)
@@ -18,9 +18,10 @@
ibm-wsdl4j=1.5.2jboss
javassist=3.5.0.CR1
jboss-jbossxb=2.0.0.CR1
-jboss-microcontainer=2.0.0.Beta3.1
+jboss-microcontainer=2.0.0.Beta3
jboss-remoting=2.2.0.Alpha7
sun-jaxb=2.0.3
+stax-api=1.0
# thirdparty library versions
apache-ant=1.6.5
@@ -50,7 +51,6 @@
junit=3.8.1
oswego-concurrent=1.3.4
qdox=1.4
-stax-api=1.0
sun-hudson=1.74
sun-jaf=1.1
sun-javamail=1.4
Modified: trunk/integration-jboss50/build.xml
===================================================================
--- trunk/integration-jboss50/build.xml 2007-03-20 14:12:42 UTC (rev 2648)
+++ trunk/integration-jboss50/build.xml 2007-03-20 22:23:25 UTC (rev 2649)
@@ -100,10 +100,7 @@
<include name="jbossws-context.war"/>
</fileset>
<fileset dir="${thirdparty.dir}">
- <include name="jaxb-api.jar"/>
- <include name="jaxb-impl.jar"/>
<include name="policy.jar"/>
- <include name="stax-api.jar"/>
<include name="wsdl4j.jar"/>
<include name="xmlsec.jar"/>
</fileset>
Modified: trunk/jbossws-core/src/java/javax/xml/soap/FactoryLoader.java
===================================================================
--- trunk/jbossws-core/src/java/javax/xml/soap/FactoryLoader.java 2007-03-20 14:12:42 UTC
(rev 2648)
+++ trunk/jbossws-core/src/java/javax/xml/soap/FactoryLoader.java 2007-03-20 22:23:25 UTC
(rev 2649)
@@ -124,7 +124,7 @@
br.close();
if (factoryName != null)
{
- if(log.isDebugEnabled()) log.debug("Load from Service API " +
filename + ": " + factoryName);
+ if(log.isTraceEnabled()) log.trace("Load from Service API " +
filename + ": " + factoryName);
Class factoryClass = loader.loadClass(factoryName);
factory = factoryClass.newInstance();
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/DOMContent.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/DOMContent.java 2007-03-20 14:12:42
UTC (rev 2648)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/DOMContent.java 2007-03-20 22:23:25
UTC (rev 2649)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.core.soap;
+// $Id: $
+
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
@@ -33,25 +35,27 @@
* @version $Id$
* @since 05.02.2007
*/
-public class DOMContent extends SOAPContent {
+public class DOMContent extends SOAPContent
+{
+ private static Logger log = Logger.getLogger(DOMContent.class);
- private static Logger log = Logger.getLogger(ObjectContent.class);
-
private Source payload;
- protected DOMContent(SOAPContentElement container) {
+ protected DOMContent(SOAPContentElement container)
+ {
super(container);
}
- State getState() {
- return State.DOM_VALID;
+ State getState()
+ {
+ return State.DOM_VALID;
}
- SOAPContent transitionTo(State nextState) {
-
+ SOAPContent transitionTo(State nextState)
+ {
SOAPContent next = null;
- if(State.XML_VALID == nextState)
+ if (State.XML_VALID == nextState)
{
log.debug("getXMLFragment from DOM");
DOMSource domSource = new DOMSource(container);
@@ -62,7 +66,7 @@
xmlValid.setXMLFragment(fragment);
next = xmlValid;
}
- else if(State.OBJECT_VALID == nextState)
+ else if (State.OBJECT_VALID == nextState)
{
// transition to xml valid first
XMLFragment fragment = new XMLFragment(new DOMSource(container));
@@ -73,7 +77,7 @@
next = tmpState.transitionTo(State.OBJECT_VALID);
}
- else if(State.DOM_VALID == nextState)
+ else if (State.DOM_VALID == nextState)
{
next = this;
}
@@ -85,27 +89,36 @@
return next;
}
- public Source getPayload() {
+ public Source getPayload()
+ {
return new DOMSource(container);
}
- public void setPayload(Source source) {
+ public void setPayload(Source source)
+ {
+ if (!(source instanceof DOMSource))
+ throw new IllegalArgumentException("DOMSource expected, but got: " +
source);
+
this.payload = source;
}
- public XMLFragment getXMLFragment() {
+ public XMLFragment getXMLFragment()
+ {
throw new IllegalStateException("XMLFragment not available");
}
- public void setXMLFragment(XMLFragment xmlFragment) {
+ public void setXMLFragment(XMLFragment xmlFragment)
+ {
throw new IllegalStateException("XMLFragment not available");
}
- public Object getObjectValue() {
- throw new IllegalStateException("Object value not available");
+ public Object getObjectValue()
+ {
+ throw new IllegalStateException("Object value not available");
}
- public void setObjectValue(Object objValue) {
- throw new IllegalStateException("Object value not available");
+ public void setObjectValue(Object objValue)
+ {
+ throw new IllegalStateException("Object value not available");
}
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContent.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContent.java 2007-03-20
14:12:42 UTC (rev 2648)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContent.java 2007-03-20
22:23:25 UTC (rev 2649)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.core.soap;
+// $Id: $
+
/**
* Represent SOAP message payload that can transition from
* one representation to the next.
@@ -28,20 +30,23 @@
* @see SOAPContentElement
*
* @author Heiko.Braun(a)jboss.org
- * @version $Id$
* @since 05.02.2007
*/
-public abstract class SOAPContent implements SOAPContentAccess {
+public abstract class SOAPContent implements SOAPContentAccess
+{
+ public enum State
+ {
+ OBJECT_VALID, XML_VALID, DOM_VALID
+ }
- public enum State {OBJECT_VALID, XML_VALID, DOM_VALID}
-
abstract SOAPContent transitionTo(State nextState);
abstract State getState();
protected SOAPContentElement container;
- protected SOAPContent(SOAPContentElement container) {
+ protected SOAPContent(SOAPContentElement container)
+ {
this.container = container;
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContentAccess.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContentAccess.java 2007-03-20
14:12:42 UTC (rev 2648)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContentAccess.java 2007-03-20
22:23:25 UTC (rev 2649)
@@ -1,10 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.jboss.ws.core.soap;
+//$Id: $
+
import javax.xml.transform.Source;
/**
* @author Heiko.Braun(a)jboss.org
- * @version $Id$
* @since 05.02.2007
*/
public interface SOAPContentAccess
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContentElement.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContentElement.java 2007-03-20
14:12:42 UTC (rev 2648)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPContentElement.java 2007-03-20
22:23:25 UTC (rev 2649)
@@ -154,8 +154,8 @@
*/
public void setPayload(Source source)
{
- soapContent = new DOMContent(this);
- soapContent.setPayload(source);
+ soapContent = new XMLContent(this);
+ soapContent.setXMLFragment(new XMLFragment(source));
}
public XMLFragment getXMLFragment()
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLContent.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLContent.java 2007-03-20 14:12:42
UTC (rev 2648)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLContent.java 2007-03-20 22:23:25
UTC (rev 2649)
@@ -254,12 +254,11 @@
*/
private void expandContainerChildren()
{
+ Element domElement = xmlFragment.toElement();
- Element contentRoot = xmlFragment.toElement();
-
- String rootLocalName = contentRoot.getLocalName();
- String rootPrefix = contentRoot.getPrefix();
- String rootNS = contentRoot.getNamespaceURI();
+ String rootLocalName = domElement.getLocalName();
+ String rootPrefix = domElement.getPrefix();
+ String rootNS = domElement.getNamespaceURI();
Name contentRootName = new NameImpl(rootLocalName, rootPrefix, rootNS);
// Make sure the content root element name matches this element name
@@ -267,14 +266,17 @@
if (!contentRootName.equals(name))
throw new WSException("Content root name does not match element name:
" + contentRootName + " != " + name);
+ // Remove all child nodes
+ container.removeContents();
+
// Copy attributes
- DOMUtils.copyAttributes(container, contentRoot);
+ DOMUtils.copyAttributes(container, domElement);
SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
try
{
- NodeList nlist = contentRoot.getChildNodes();
+ NodeList nlist = domElement.getChildNodes();
for (int i = 0; i < nlist.getLength(); i++)
{
Node child = nlist.item(i);
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java 2007-03-20
14:12:42 UTC (rev 2648)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java 2007-03-20
22:23:25 UTC (rev 2649)
@@ -56,7 +56,6 @@
*/
public class XMLFragment
{
-
private Source source;
private Result result;
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java 2007-03-20
14:12:42 UTC (rev 2648)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java 2007-03-20
22:23:25 UTC (rev 2649)
@@ -34,12 +34,22 @@
import javax.xml.ws.handler.LogicalMessageContext;
import javax.xml.ws.handler.MessageContext;
+import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxws.handler.GenericLogicalHandler;
import org.jboss.ws.core.utils.DOMUtils;
import org.w3c.dom.Element;
+/**
+ * A jaxws logical handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 24-Nov-2005
+ */
public class LogicalSourceHandler extends GenericLogicalHandler
{
+ // provide logging
+ private static final Logger log = Logger.getLogger(LogicalSourceHandler.class);
+
@Override
public boolean handleOutbound(MessageContext msgContext)
{
@@ -51,8 +61,8 @@
{
return appendHandlerName(msgContext);
}
-
- public boolean appendHandlerName(MessageContext msgContext)
+
+ public boolean appendHandlerName(MessageContext msgContext)
{
try
{
@@ -62,20 +72,22 @@
TransformerFactory tf = TransformerFactory.newInstance();
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
tf.newTransformer().transform(source, new StreamResult(baos));
-
+
// Parse the payload and extract the value
Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
Element element = DOMUtils.getFirstChildElement(root);
- String value = DOMUtils.getTextContent(element);
-
- String handlerName = getHandlerName();
- value = value + ":" + handlerName;
- element.setTextContent(value);
-
+
+ String oldValue = DOMUtils.getTextContent(element);
+ String newValue = oldValue + ":" + getHandlerName();
+ element.setTextContent(newValue);
+
+ log.info("oldValue: " + oldValue);
+ log.info("newValue: " + newValue);
+
// Set the updated payload
source = new DOMSource(root);
logicalContext.getMessage().setPayload(source);
-
+
return true;
}
catch (RuntimeException rte)
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/logicalhandler/ProtocolHandler.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/logicalhandler/ProtocolHandler.java 2007-03-20
14:12:42 UTC (rev 2648)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/logicalhandler/ProtocolHandler.java 2007-03-20
22:23:25 UTC (rev 2649)
@@ -28,16 +28,20 @@
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPMessageContext;
+import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
/**
- * A client side handler for the ws-addressing
+ * A jaxws protocol handler
*
* @author Thomas.Diesler(a)jboss.org
* @since 24-Nov-2005
*/
public class ProtocolHandler extends GenericSOAPHandler
{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ProtocolHandler.class);
+
@Override
public boolean handleOutbound(MessageContext msgContext)
{
@@ -57,11 +61,14 @@
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
SOAPElement soapElement =
(SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
soapElement = (SOAPElement)soapElement.getChildElements().next();
- String value = soapElement.getValue();
- String handlerName = getHandlerName();
- soapElement.setValue(value + ":" + handlerName);
+ String oldValue = soapElement.getValue();
+ String newValue = oldValue + ":" + getHandlerName();
+ soapElement.setValue(newValue);
+ log.info("oldValue: " + oldValue);
+ log.info("newValue: " + newValue);
+
return true;
}
catch (SOAPException ex)