Author: thomas.diesler(a)jboss.com
Date: 2007-03-31 15:12:13 -0400 (Sat, 31 Mar 2007)
New Revision: 2741
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
Log:
Allow SOAPBody.expandToDOM after logical handler uses LogicalMessage.setPayload(Source)
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-03-31
18:13:42 UTC (rev 2740)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-03-31
19:12:13 UTC (rev 2741)
@@ -192,18 +192,18 @@
if (handlersPass)
{
- // Check if protocol handlers modified the payload
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
- if (soapBody.isModifiedFromSource())
- {
- log.debug("Handler modified body payload, unbind message
again");
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
- }
-
- // Invoke the service endpoint
msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
try
{
+ // Check if protocol handlers modified the payload
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
+ if (soapBody.isModifiedFromSource())
+ {
+ log.debug("Handler modified body payload, unbind message
again");
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ // Invoke the service endpoint
invokeServiceEndpointInstance(seInstance, epInv);
}
finally
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
18:13:42 UTC (rev 2740)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-03-31
19:12:13 UTC (rev 2741)
@@ -121,7 +121,7 @@
public SOAPElement addChildElement(SOAPElement child) throws SOAPException
{
log.trace("addChildElement: " + child.getElementName());
- expandToDOM(false);
+ expandToDOM();
if ((child instanceof SOAPBodyElement) == false)
child = convertToBodyElement(child);
@@ -132,7 +132,7 @@
public SOAPBodyElement addBodyElement(Name name) throws SOAPException
{
log.trace("addBodyElement: " + name);
- expandToDOM(false);
+ expandToDOM();
SOAPBodyElement child = new SOAPBodyElementDoc(name);
return (SOAPBodyElement)addChildElement(child);
}
@@ -140,7 +140,7 @@
public SOAPBodyElement addBodyElement(QName qname) throws SOAPException
{
log.trace("addBodyElement: " + qname);
- expandToDOM(false);
+ expandToDOM();
SOAPBodyElement child = new SOAPBodyElementDoc(qname);
return (SOAPBodyElement)addChildElement(child);
}
@@ -148,7 +148,7 @@
public SOAPBodyElement addDocument(Document doc) throws SOAPException
{
log.trace("addDocument");
- expandToDOM(false);
+ expandToDOM();
Element rootElement = doc.getDocumentElement();
SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
SOAPElement soapElement = soapFactory.createElement(rootElement);
@@ -158,7 +158,7 @@
public SOAPFault addFault() throws SOAPException
{
log.trace("addFault");
- expandToDOM(true);
+ expandToDOM();
if (hasFault())
throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
@@ -171,7 +171,7 @@
public SOAPFault addFault(Name faultCode, String faultString) throws SOAPException
{
log.trace("addFault");
- expandToDOM(true);
+ expandToDOM();
if (hasFault())
throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
@@ -185,7 +185,7 @@
public SOAPFault addFault(QName faultCode, String faultString) throws SOAPException
{
log.trace("addFault");
- expandToDOM(true);
+ expandToDOM();
if (hasFault())
throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
@@ -199,7 +199,7 @@
public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws
SOAPException
{
log.trace("addFault");
- expandToDOM(true);
+ expandToDOM();
if (hasFault())
throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
@@ -213,7 +213,7 @@
public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws
SOAPException
{
log.trace("addFault");
- expandToDOM(true);
+ expandToDOM();
if (hasFault())
throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
@@ -240,14 +240,14 @@
private Iterator faultIterator()
{
- expandToDOM(true);
+ expandToDOM();
return getChildElements(new QName(getNamespaceURI(), "Fault"));
}
public Node appendChild(Node newChild) throws DOMException
{
log.trace("appendChild: " + newChild.getNodeName());
- expandToDOM(false);
+ expandToDOM();
if (needsConversionToBodyElement(newChild))
newChild = convertToBodyElement(newChild);
@@ -257,7 +257,7 @@
public Node insertBefore(Node newChild, Node refChild) throws DOMException
{
log.trace("insertBefore: " + newChild.getNodeName());
- expandToDOM(false);
+ expandToDOM();
if (needsConversionToBodyElement(newChild))
newChild = convertToBodyElement(newChild);
@@ -267,7 +267,7 @@
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
{
log.trace("replaceChild: " + newChild.getNodeName());
- expandToDOM(false);
+ expandToDOM();
if (needsConversionToBodyElement(newChild))
newChild = convertToBodyElement(newChild);
@@ -277,42 +277,42 @@
public Iterator getChildElements()
{
log.trace("getChildElements");
- expandToDOM(false);
+ expandToDOM();
return super.getChildElements();
}
public Iterator getChildElements(Name name)
{
log.trace("getChildElements: " + name);
- expandToDOM(false);
+ expandToDOM();
return super.getChildElements(name);
}
public NodeList getChildNodes()
{
log.trace("getChildNodes");
- expandToDOM(false);
+ expandToDOM();
return super.getChildNodes();
}
public Node getFirstChild()
{
log.trace("getFirstChild");
- expandToDOM(false);
+ expandToDOM();
return super.getFirstChild();
}
public Node getLastChild()
{
log.trace("getLastChild");
- expandToDOM(false);
+ expandToDOM();
return super.getLastChild();
}
public boolean hasChildNodes()
{
log.trace("hasChildNodes");
- expandToDOM(false);
+ expandToDOM();
return super.hasChildNodes();
}
@@ -332,7 +332,7 @@
return new SOAPBodyElementDoc(element);
}
- private void expandToDOM(boolean handleFault)
+ private void expandToDOM()
{
if (isDOMValid == false)
{
@@ -342,8 +342,12 @@
if (msgContext != null && UnifiedMetaData.isFinalRelease() == false)
{
Boolean allowExpand =
(Boolean)msgContext.get(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if (handleFault == false && allowExpand != Boolean.TRUE)
- throw new WSException("Expanding content element to DOM");
+ if (allowExpand != Boolean.TRUE)
+ {
+ log.warn("*****************************");
+ log.warn("* Expanding SOAPBody to DOM *");
+ log.warn("*****************************");
+ }
}
log.trace("BEGIN expandToDOM");
@@ -391,7 +395,7 @@
public Document extractContentAsDocument() throws SOAPException
{
log.trace("extractContentAsDocument");
- expandToDOM(false);
+ expandToDOM();
Iterator childElements = DOMUtils.getChildElements(this);
// zero child elements?