Author: darran.lofthouse(a)jboss.com
Date: 2007-06-26 07:36:04 -0400 (Tue, 26 Jun 2007)
New Revision: 3726
Added:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647TestBase.java
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/TextImpl.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/AbstractHandler.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/DocumentHandler.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647DocumentTestCase.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647RPCTestCase.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/RpcHandler.java
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.java
Log:
JBWS-1610 - Merge final comment and text node preservation code and rollback handler
changes as too many regressions introduced.
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -256,13 +256,6 @@
// Bind the request message
SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData,
epInv, unboundHeaders);
-
- List ll = this.epMetaData.getHandlerMetaData(HandlerType.POST);
- log.debug("NumberOfHandlers ofType POST fromConfigFiles=
"+ll.size());
-
- // FIX: Update the HandlerRegistry
- log.debug("Updating the HandlerRegistry...");
- this.setConfigName(this.getConfigName());
// Add possible attachment parts
addAttachmentParts(reqMessage);
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -34,7 +34,6 @@
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.Name;
-import javax.xml.soap.Node;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPElement;
@@ -63,7 +62,6 @@
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.core.soap.SOAPHeaderElementImpl;
import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.soap.TextImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
import org.jboss.ws.core.soap.attachment.CIDGenerator;
@@ -131,7 +129,8 @@
/** On the client side, generate the payload from IN parameters. */
public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
{
- if(log.isDebugEnabled()) log.debug("bindRequestMessage: " +
opMetaData.getQName());
+ if (log.isDebugEnabled())
+ log.debug("bindRequestMessage: " + opMetaData.getQName());
try
{
@@ -142,8 +141,7 @@
// Disable MTOM for rpc/encoded
if (opMetaData.isRPCEncoded())
XOPContext.setMTOMEnabled(false);
- else
- XOPContext.setMTOMEnabled( isMTOMEnabled() );
+ else XOPContext.setMTOMEnabled(isMTOMEnabled());
// Associate current message with message context
SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
@@ -163,7 +161,8 @@
QName opQName = opMetaData.getQName();
Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
- if(log.isDebugEnabled()) log.debug("Create RPC body element: " +
opName);
+ if (log.isDebugEnabled())
+ log.debug("Create RPC body element: " + opName);
soapBodyElement = new SOAPBodyElementRpc(opName);
soapBodyElement =
(SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
}
@@ -233,7 +232,8 @@
/** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
payload) throws BindingException
{
- if(log.isDebugEnabled()) log.debug("unbindRequestMessage: " +
opMetaData.getQName());
+ if (log.isDebugEnabled())
+ log.debug("unbindRequestMessage: " + opMetaData.getQName());
try
{
@@ -263,25 +263,25 @@
if (opMetaData.isMessageEndpoint() == false)
{
Style style = opMetaData.getStyle();
- SOAPElement soapBodyElement = soapBody;
+ SOAPElement payloadParent = soapBody;
if (style == Style.RPC)
{
- soapBodyElement = null;
-
+ payloadParent = null;
Iterator it = soapBody.getChildElements();
- while (soapBodyElement == null && it.hasNext())
+ while (payloadParent == null && it.hasNext())
{
- Object current = it.next();
- if (current instanceof SOAPElement)
+ Object childNode = it.next();
+ if (childNode instanceof SOAPElement)
{
- soapBodyElement = (SOAPElement)current;
+ payloadParent = (SOAPElement)childNode;
}
}
- Name elName = soapBodyElement.getElementName();
+ if (payloadParent == null)
+ throw new SOAPException("Cannot find RPC element in");
- QName elQName = new QName(elName.getURI(), elName.getLocalName(),
elName.getPrefix());
- elQName = namespaceRegistry.registerQName(elQName);
+ QName elName = payloadParent.getElementQName();
+ elName = namespaceRegistry.registerQName(elName);
}
for (ParameterMetaData paramMetaData : opMetaData.getParameters())
@@ -300,7 +300,7 @@
}
else
{
- SOAPElement element = paramMetaData.isInHeader() ? soapHeader :
soapBodyElement;
+ SOAPElement element = paramMetaData.isInHeader() ? soapHeader :
payloadParent;
Object value = getParameterFromMessage(paramMetaData, element,
false);
epInv.setRequestParamValue(xmlName, value);
}
@@ -332,7 +332,8 @@
/** On the server side, generate the payload from OUT parameters. */
public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
{
- if(log.isDebugEnabled()) log.debug("bindResponseMessage: " +
opMetaData.getQName());
+ if (log.isDebugEnabled())
+ log.debug("bindResponseMessage: " + opMetaData.getQName());
try
{
@@ -343,8 +344,7 @@
// Disable MTOM for rpc/encoded
if (opMetaData.isRPCEncoded())
XOPContext.setMTOMEnabled(false);
- else
- XOPContext.setMTOMEnabled( isMTOMEnabled() );
+ else XOPContext.setMTOMEnabled(isMTOMEnabled());
// Associate current message with message context
SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
@@ -433,9 +433,10 @@
/** On the client side, extract the OUT parameters from the payload and return them to
the client. */
public void unbindResponseMessage(OperationMetaData opMetaData, Object payload,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
- throws BindingException
+ throws BindingException
{
- if(log.isDebugEnabled()) log.debug("unbindResponseMessage: " +
opMetaData.getQName());
+ if (log.isDebugEnabled())
+ log.debug("unbindResponseMessage: " + opMetaData.getQName());
try
{
@@ -555,7 +556,7 @@
handleException(e);
}
}
-
+
public Object bindFaultMessage(Exception ex)
{
SOAPMessage faultMessage = createFaultMessageFromException(ex);
@@ -721,50 +722,49 @@
Iterator childElements = soapElement.getChildElements();
while (childElements.hasNext())
{
- Object child = childElements.next();
- if (child instanceof TextImpl)
+ Object childNode = childElements.next();
+ if (childNode instanceof SOAPElement)
{
- continue;
- }
- SOAPElementImpl childElement = (SOAPElementImpl)child;
+ SOAPElementImpl childElement = (SOAPElementImpl)childNode;
- // If this message was manipulated by a handler the child may not be a content
element
- if (!(childElement instanceof SOAPContentElement))
- childElement = (SOAPContentElement)soapElement.replaceChild(new
SOAPContentElement(childElement), childElement);
+ // If this message was manipulated by a handler the child may not be a
content element
+ if (!(childElement instanceof SOAPContentElement))
+ childElement = (SOAPContentElement)soapElement.replaceChild(new
SOAPContentElement(childElement), childElement);
- // The parameters are expected to be lazy
- SOAPContentElement aux = (SOAPContentElement)childElement;
- Name elName = aux.getElementName();
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
- if (xmlName.equals(elName))
- {
- soapContentElement = aux;
- soapContentElement.setParamMetaData(paramMetaData);
- break;
- }
+ if (xmlName.equals(elName))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
- if (SOAP_ARRAY_NAME.equals(elName))
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
- try
+ if (SOAP_ARRAY_NAME.equals(elName))
{
- QName compXMLName = paramMetaData.getXmlName();
- Element compElement = DOMUtils.getFirstChildElement(aux);
- // NPE when the soap encoded array size is 0 on the return path
- //
http://jira.jboss.org/jira/browse/JBWS-1285
- if (compElement == null ||
compElement.getNodeName().equals(compXMLName.getLocalPart()))
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
+ try
{
- soapContentElement = aux;
- soapContentElement.setParamMetaData(paramMetaData);
- break;
+ QName compXMLName = paramMetaData.getXmlName();
+ Element compElement = DOMUtils.getFirstChildElement(aux);
+ // NPE when the soap encoded array size is 0 on the return path
+ //
http://jira.jboss.org/jira/browse/JBWS-1285
+ if (compElement == null ||
compElement.getNodeName().equals(compXMLName.getLocalPart()))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
}
+ finally
+ {
+ msgContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ }
}
- finally
- {
- msgContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- }
}
}
@@ -808,7 +808,7 @@
if (paramMetaData.isXOP() && XOPContext.isXOPEncodedRequest())
{
SOAPMessageImpl soapMessage =
(SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getSOAPMessage();
- soapMessage.setXOPMessage(true);
+ soapMessage.setXOPMessage(true);
}
return soapContentElement;
}
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -28,11 +28,14 @@
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerException;
+import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.core.utils.XMLPredefinedEntityReferenceResolver;
import org.jboss.ws.WSException;
+import org.w3c.dom.Node;
import java.io.ByteArrayOutputStream;
@@ -56,19 +59,40 @@
protected static String sourceToString(Source source)
{
String xmlFragment = null;
-
- try {
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- StreamResult streamResult = new StreamResult(baos);
- tf.newTransformer().transform(source, streamResult);
- xmlFragment = new String(baos.toByteArray());
- if (xmlFragment.startsWith("<?xml"))
+ try
+ {
+ if (source instanceof DOMSource)
{
- int index = xmlFragment.indexOf(">");
- xmlFragment = xmlFragment.substring(index + 1);
+ Node node = ((DOMSource)source).getNode();
+ xmlFragment = DOMWriter.printNode(node, false);
}
- } catch (TransformerException e) {
+ else
+ {
+ // Note, this code will not handler namespaces correctly that
+ // are defined on a parent of the DOMSource
+ //
+ // <env:Envelope
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ // <env:Body>
+ // <myMethod>
+ // <param xsi:type='xsd:string'>Hello
World!</param>
+ // </myMethod>
+ // </env:Body>
+ // </env:Envelope>
+ //
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ StreamResult streamResult = new StreamResult(baos);
+ tf.newTransformer().transform(source, streamResult);
+ xmlFragment = new String(baos.toByteArray());
+ if (xmlFragment.startsWith("<?xml"))
+ {
+ int index = xmlFragment.indexOf(">");
+ xmlFragment = xmlFragment.substring(index + 1);
+ }
+ }
+ }
+ catch (TransformerException e)
+ {
WSException.rethrow(e);
}
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -207,7 +207,6 @@
/**
* Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in
which this HandlerChain is to act
* for the SOAP message processing at this SOAP node. These roles assumed by a
HandlerChain must be invariant during
-
* the processing of an individual SOAP message through the HandlerChain.
* <p/>
* A HandlerChain always acts in the role of the special SOAP actor next. Refer to the
SOAP specification for the
@@ -245,9 +244,6 @@
{
boolean doNext = true;
- if(type==HandlerType.POST)
- log.debug("Requested Handlertype POST, for execution");
-
if (handlers.size() > 0)
{
if(log.isDebugEnabled()) log.debug("Enter: handleRequest");
@@ -266,10 +262,6 @@
for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
{
HandlerEntry handlerEntry = (HandlerEntry)handlers.get(handlerIndex);
-
- if(type==HandlerType.POST &&
handlerEntry.getType()==HandlerType.POST)
- log.debug("FoundTheHandler with HandlerType=POST.");
-
if (type == HandlerType.ALL || type == handlerEntry.getType())
{
currHandler = handlerEntry.getHandler();
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -150,14 +150,20 @@
msgContext.setOperationMetaData(opMetaData);
oneway = opMetaData.isOneWay();
- // We no longer call unbindRequestMessage here, per case 15726
+ // Unbind the request message
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
}
handlersPass = handlersPass && callRequestHandlerChain(seInfo,
HandlerType.ENDPOINT);
handlersPass = handlersPass && callRequestHandlerChain(seInfo,
HandlerType.POST);
- // Unbind the request message
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ // Check if protocol handlers modified the payload
+ if (msgContext.isModified() == true)
+ {
+ if (log.isDebugEnabled())
+ log.debug("Handler modified body payload, unbind message
again");
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
if (handlersPass)
{
@@ -178,8 +184,8 @@
if (epMetaData.getType() == EndpointMetaData.Type.JAXWS)
msgContext.setProperty(MessageContext.MESSAGE_OUTBOUND_PROPERTY,
Boolean.TRUE);
- if(binding instanceof CommonSOAPBinding)
- XOPContext.setMTOMEnabled( ((CommonSOAPBinding)binding).isMTOMEnabled());
+ if (binding instanceof CommonSOAPBinding)
+ XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
// Bind the response message
SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData,
epInv);
@@ -223,7 +229,8 @@
protected CommonMessageContext processPivot(CommonMessageContext requestContext)
{
- if(log.isDebugEnabled()) log.debug("Begin response processing");
+ if (log.isDebugEnabled())
+ log.debug("Begin response processing");
// TODO: implement
return requestContext;
}
@@ -238,11 +245,14 @@
{
String faultString;
SOAPBody soapBody = reqMessage.getSOAPBody();
+
Iterator bodyChildren = soapBody.getChildElements();
SOAPBodyElement soapBodyElement = null;
while (bodyChildren.hasNext() && soapBodyElement == null)
+
{
+
Object next = bodyChildren.next();
if (next instanceof SOAPBodyElement)
{
@@ -252,6 +262,7 @@
if (soapBodyElement != null)
{
+
Name soapName = soapBodyElement.getElementName();
faultString = "Endpoint " + epMetaData.getPortName() + " does
not contain operation meta data for: " + soapName;
}
@@ -264,8 +275,10 @@
// with a faultcode of "Client", unless a "MustUnderstand"
or "VersionMismatch" fault is generated.
if (soapHeader != null &&
soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
{
+
QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
throw new SOAPFaultException(faultCode, faultString, null, null);
+
}
else
{
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -149,14 +149,6 @@
log.warn("Ignore envelope chile element: " + elName);
}
}
- else if (childType == Node.COMMENT_NODE)
- {
- appendCommentNode(soapEnv, child);
- }
- else if (childType == Node.TEXT_NODE)
- {
- appendTextNode(soapEnv, child);
- }
else
{
log.warn("Ignore child type: " + childType);
@@ -191,14 +183,6 @@
DOMUtils.copyAttributes(destElement, srcElement);
destElement.setXMLFragment(xmlFragment);
}
- else if (childType == Node.COMMENT_NODE)
- {
- appendCommentNode(soapHeader, child);
- }
- else if (childType == Node.TEXT_NODE)
- {
- appendTextNode(soapHeader, child);
- }
else
{
log.warn("Ignore child type: " + childType);
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -824,14 +824,7 @@
}
else if (node instanceof TextImpl)
{
- boolean comment = node.getNodeType() == Node.COMMENT_NODE;
- if (comment)
- out.write("<!--");
-
- out.write(node.getValue());
-
- if (comment)
- out.write("-->");
+ ((TextImpl)node).writeNode(out);
}
else
{
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -68,8 +68,7 @@
if (wsaAction.equals(opAux.getSOAPAction()))
{
opMetaData = opAux;
- if (log.isDebugEnabled())
- log.debug("Use wsa:Action dispatch: " + wsaAction);
+ log.debug("Use wsa:Action dispatch: " + wsaAction);
break;
}
}
@@ -109,8 +108,7 @@
{
if (opAux.getParameters().size() == 0)
{
- if (log.isDebugEnabled())
- log.debug("Dispatching empty SOAP body");
+ log.debug("Dispatching empty SOAP body");
opMetaData = opAux;
break;
}
@@ -140,16 +138,14 @@
{
if (opAux.isMessageEndpoint())
{
- if (log.isDebugEnabled())
- log.debug("Use generic message style dispatch");
+ log.debug("Use generic message style dispatch");
opMetaData = opAux;
break;
}
}
}
- if (log.isDebugEnabled())
- log.debug("getDispatchDestination: " + (opMetaData != null ?
opMetaData.getQName() : null));
+ log.debug("getDispatchDestination: " + (opMetaData != null ?
opMetaData.getQName() : null));
return opMetaData;
}
}
\ No newline at end of file
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/TextImpl.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/TextImpl.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-core/src/main/java/org/jboss/ws/core/soap/TextImpl.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -1,26 +1,29 @@
/*
-* 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.
-*/
+ * 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;
+import java.io.IOException;
+import java.io.Writer;
+
import org.w3c.dom.DOMException;
import org.w3c.dom.Text;
@@ -55,6 +58,14 @@
setNodeValue(value);
}
+ public void writeNode(Writer out) throws IOException
+ {
+ String nodeValue = getNodeValue();
+ if (isComment() && !nodeValue.startsWith("<!--"))
+ out.write("<!--" + nodeValue + "-->");
+ else out.write(nodeValue);
+ }
+
/**
* Breaks this node into two nodes at the specified <code>offset</code>,
keeping both in the tree as siblings.
* <p/>
@@ -87,8 +98,7 @@
org.w3c.dom.Node sibling = getNextSibling();
if (sibling == null)
parent.appendChild(txtNode);
- else
- parent.insertBefore(txtNode, sibling);
+ else parent.insertBefore(txtNode, sibling);
}
return txtNode;
@@ -240,7 +250,7 @@
{
setNodeValue(data);
}
-
+
// Stubbed out org.w3c.dom.Text methods **************************
/**
@@ -317,8 +327,7 @@
* nodes being replaced is readonly.
* @since DOM Level 3
*/
- public Text replaceWholeText(String content)
- throws DOMException
+ public Text replaceWholeText(String content) throws DOMException
{
return null;
}
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -189,21 +189,20 @@
public void testPreserveComments() throws Exception
{
String expMsg =
- "<soapenv:Envelope xmlns:ns1='http://somens.org'
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <!-- header -->" +
- " <soapenv:Header>" +
- " <!-- header element -->" +
- " <header>kermit</header>" +
- " </soapenv:Header>" +
- " <!-- body -->" +
- " <soapenv:Body>" +
- " <!-- body element -->" +
+ "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:ns1='http://somens.org'>" +
+ " <env:Header>" +
+ " <ns1:header>kermit</ns1:header>" +
+ " </env:Header>" +
+ " <env:Body>" +
+ " <!-- pre body element -->" +
" <Hello>" +
- " <!-- element -->" +
+ " <!-- pre element -->" +
" <argument>kermit</argument>" +
+ " <!-- post element -->" +
" </Hello>" +
- " </soapenv:Body>" +
- "</soapenv:Envelope>";
+ " <!-- post body element -->" +
+ " </env:Body>" +
+ "</env:Envelope>";
// Verify that DOM parse/write do not modify the message
Element expEnv = DOMUtils.parse(expMsg);
@@ -224,24 +223,30 @@
SOAPEnvelope wasEnv = soapMsg.getSOAPPart().getEnvelope();
String wasXML = DOMWriter.printNode(wasEnv, false);
- assertEquals(expXML, wasXML);
+ String wasBody = wasXML.substring(wasXML.indexOf("<env:Body>"));
+ wasBody = wasBody.substring(0, wasBody.indexOf("</env:Body>") +
11);
+
+ String expBody = expXML.substring(expXML.indexOf("<env:Body>"));
+ expBody = expBody.substring(0, expBody.indexOf("</env:Body>") +
11);
+
+ assertEquals(expBody, wasBody);
}
public void testWriteToPreserveFormatting() throws Exception
{
String expMessage =
"<soapenv:Envelope
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:typ='http://www.jboss.org/support/phonebook/types'>" +
- " <soapenv:Header></soapenv:Header>" +
- " <soapenv:Body>" +
- " <!-- Comment One -->" +
- " <typ:lookup
xmlns:typ='http://www.jboss.org/support/phonebook/types'>" +
- " <!-- Comment Two -->" +
- " <firstName>Joe</firstName>" +
- " <surname>Bloggs</surname>" +
- " <!-- Comment Three -->" +
- " </typ:lookup>" +
- " <!-- Comment Four -->" +
- " </soapenv:Body>" +
+ "<soapenv:Header></soapenv:Header>" +
+ "<soapenv:Body>" +
+ " <!-- Comment One -->" +
+ " <typ:lookup
xmlns:typ='http://www.jboss.org/support/phonebook/types'>" +
+ " <!-- Comment Two -->" +
+ " <firstName>Joe</firstName>" +
+ " <surname>Bloggs</surname>" +
+ " <!-- Comment Three -->" +
+ " </typ:lookup>" +
+ "<!-- Comment Four -->" +
+ "</soapenv:Body>" +
"</soapenv:Envelope>";
MessageFactoryImpl factory = new MessageFactoryImpl();
@@ -251,12 +256,8 @@
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
soapMsg.writeTo(outputStream);
- String actualMessage = new String(outputStream.toByteArray(), "UTF-8");
+ String actualMessage = new String(outputStream.toByteArray(), "UTF-8");
- //System.out.println("A - " + expMessage);
- //System.out.println("B - " +
DOMWriter.printNode(soapMsg.getSOAPPart().getEnvelope(), false));
- //System.out.println("C - " + actualMessage);
-
assertEquals(expMessage, actualMessage);
}
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/AbstractHandler.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/AbstractHandler.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/AbstractHandler.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -21,15 +21,15 @@
*/
package org.jboss.test.ws.jaxrpc.jbws1647;
-import java.io.ByteArrayOutputStream;
-
import javax.xml.namespace.QName;
import javax.xml.rpc.handler.GenericHandler;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.utils.DOMWriter;
/**
*
@@ -38,49 +38,39 @@
*/
public abstract class AbstractHandler extends GenericHandler
{
-
private static final Logger log = Logger.getLogger(AbstractHandler.class);
- public abstract String getExpectedMessage();
+ public abstract String getMessageBody();
public boolean handleRequest(MessageContext msgContext)
{
log.info("handleRequest");
-
- boolean valid = false;
SOAPMessageContext messageContext = (SOAPMessageContext)msgContext;
-
SOAPMessage soapMessage = messageContext.getMessage();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- String receivedMessage = "";
try
{
- soapMessage.writeTo(baos);
- receivedMessage = baos.toString();
+ SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
+ String wasEnv = DOMWriter.printNode(soapEnv, false);
+ String wasBody =
wasEnv.substring(wasEnv.indexOf("<env:Body>"));
+ wasBody = wasBody.substring(0,
wasBody.indexOf("</env:Envelope>"));
+ if (wasBody.equals(getMessageBody()) == false)
+ {
+ log.error("Exp Body: " + getMessageBody());
+ log.error("Was Body: " + wasBody);
+ throw new RuntimeException("Received message does not contain expected
soap body.");
+ }
}
catch (Exception e)
{
throw new RuntimeException("Unable to process SOAPMessage", e);
}
-
- valid = getExpectedMessage().equals(receivedMessage);
- if (valid == false)
- {
- log.error("Received message does not equal expected message.");
- log.info("EXP - " + getExpectedMessage());
- log.info("ACT - " + receivedMessage);
-
- throw new RuntimeException("Received message does not equal expected
message.");
- }
-
- return valid;
+ return true;
}
public QName[] getHeaders()
{
return null;
}
-
}
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/DocumentHandler.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/DocumentHandler.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/DocumentHandler.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -29,26 +29,20 @@
public class DocumentHandler extends AbstractHandler
{
- public static final String MESSAGE =
- "<soapenv:Envelope
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:typ='http://org.jboss.test.ws/jbws1647/types'>" +
- " <!-- Comment Before Header -->" +
- " <soapenv:Header></soapenv:Header>" +
- " <!-- Comment After Header, Before Body -->" +
- " <soapenv:Body>" +
- " <!-- Comment After Body -->" +
- " <typ:echoMessage
xmlns:typ='http://org.jboss.test.ws/jbws1647/types'>" +
- " <!-- Comment After Wrapper -->" +
- " <String_1>My Message</String_1>" +
- " <!-- Comment After Parameter -->" +
- " </typ:echoMessage>" +
- " <!-- Comment Before Close Body -->" +
- " </soapenv:Body>" +
- " <!-- Comment Before Close Envelope -->" +
- "</soapenv:Envelope>";
+ public static final String MESSAGE_BODY =
+ "<env:Body>" +
+ " <!-- Comment After Body -->" +
+ " <typ:echoMessage
xmlns:typ='http://org.jboss.test.ws/jbws1647/types'>" +
+ " <!-- Comment After Wrapper -->" +
+ " <String_1>My Message</String_1>" +
+ " <!-- Comment After Parameter -->" +
+ " </typ:echoMessage>" +
+ " <!-- Comment Before Close Body -->" +
+ "</env:Body>";
- public String getExpectedMessage()
+ public String getMessageBody()
{
- return MESSAGE;
+ return MESSAGE_BODY;
}
}
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647DocumentTestCase.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647DocumentTestCase.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647DocumentTestCase.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -21,16 +21,19 @@
*/
package org.jboss.test.ws.jaxrpc.jbws1647;
+import org.jboss.test.ws.JBossWSTestSetup;
+
import junit.framework.Test;
-import org.jboss.test.ws.JBossWSTestSetup;
-
/**
+ * Text Node Preservation For Messages Sent Across The Wire
*
+ *
http://jira.jboss.org/jira/browse/JBWS-1647
+ *
* @author darran.lofthouse(a)jboss.com
* @since 15 May 2007
*/
-public class JBWS1647DocumentTestCase extends TestCaseBase
+public class JBWS1647DocumentTestCase extends JBWS1647TestBase
{
public static Test suite() throws Exception
@@ -40,10 +43,10 @@
public String getMessage()
{
- return DocumentHandler.MESSAGE;
+ return "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
DocumentHandler.MESSAGE_BODY + "</env:Envelope>";
}
- public String getToUrl()
+ public String getEndpointAddress()
{
return "http://" + getServerHost() +
":8080/jaxrpc-jbws1647-doclit/TestEndpoint";
}
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647RPCTestCase.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647RPCTestCase.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647RPCTestCase.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -21,16 +21,19 @@
*/
package org.jboss.test.ws.jaxrpc.jbws1647;
+import org.jboss.test.ws.JBossWSTestSetup;
+
import junit.framework.Test;
-import org.jboss.test.ws.JBossWSTestSetup;
-
/**
+ * Text Node Preservation For Messages Sent Across The Wire
*
+ *
http://jira.jboss.org/jira/browse/JBWS-1647
+ *
* @author darran.lofthouse(a)jboss.com
* @since 14 May 2007
*/
-public class JBWS1647RPCTestCase extends TestCaseBase
+public class JBWS1647RPCTestCase extends JBWS1647TestBase
{
public static Test suite() throws Exception
@@ -40,10 +43,10 @@
public String getMessage()
{
- return RpcHandler.MESSAGE;
+ return "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
RpcHandler.MESSAGE_BODY + "</env:Envelope>";
}
- public String getToUrl()
+ public String getEndpointAddress()
{
return "http://" + getServerHost() +
":8080/jaxrpc-jbws1647-rpclit/TestEndpoint";
}
Added:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647TestBase.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647TestBase.java
(rev 0)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647TestBase.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.test.ws.jaxrpc.jbws1647;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.test.ws.JBossWSTest;
+
+/**
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 15 May 2007
+ */
+public abstract class JBWS1647TestBase extends JBossWSTest
+{
+ public abstract String getMessage();
+
+ public abstract String getEndpointAddress();
+
+ public void testCall() throws Exception
+ {
+ MessageFactory msgFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = msgFactory.createMessage(null, new
ByteArrayInputStream(getMessage().getBytes()));
+
+ SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
+ SOAPConnection con = conFactory.createConnection();
+ SOAPMessage resMessage = con.call(soapMessage, getEndpointAddress());
+
+ SOAPElement soapElement =
(SOAPElement)resMessage.getSOAPBody().getChildElements().next();
+ assertEquals("echoMessageResponse",
soapElement.getElementName().getLocalName());
+ }
+
+}
Property changes on:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/JBWS1647TestBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/RpcHandler.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/RpcHandler.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/jbws1647/RpcHandler.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -29,26 +29,20 @@
public class RpcHandler extends AbstractHandler
{
- public static final String MESSAGE =
- "<soapenv:Envelope xmlns:jbw='http://org.jboss.test.ws/jbws1647'
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <!-- Comment Before Header -->" +
- " <soapenv:Header></soapenv:Header>" +
- " <!-- Comment After Header, Before Body -->" +
- " <soapenv:Body>" +
- " <!-- Comment After Body -->" +
- " <jbw:echoMessage
xmlns:jbw='http://org.jboss.test.ws/jbws1647'>" +
- " <!-- Comment After Operation -->" +
- " <String_1>My Message</String_1>" +
- " <!-- Comment After Parameter -->" +
- " </jbw:echoMessage>" +
- " <!-- Comment Before Close Body -->" +
- " </soapenv:Body>" +
- " <!-- Comment Before Close Envelope -->" +
- "</soapenv:Envelope>";
+ public static final String MESSAGE_BODY =
+ "<env:Body>" +
+ " <!-- Comment After Body -->" +
+ " <jbw:echoMessage
xmlns:jbw='http://org.jboss.test.ws/jbws1647'>" +
+ " <!-- Comment After Operation -->" +
+ " <String_1>My Message</String_1>" +
+ " <!-- Comment After Parameter -->" +
+ " </jbw:echoMessage>" +
+ " <!-- Comment Before Close Body -->" +
+ "</env:Body>";
- public String getExpectedMessage()
+ public String getMessageBody()
{
- return MESSAGE;
+ return MESSAGE_BODY;
}
}
Modified:
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.java
===================================================================
---
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.java 2007-06-26
10:47:02 UTC (rev 3725)
+++
branches/jbossws-1.2.0.GA_JBWS-1610/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.java 2007-06-26
11:36:04 UTC (rev 3726)
@@ -1,24 +1,24 @@
/*
- * 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.
- */
+ * 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.test.ws.jaxrpc.samples.handler;
import javax.xml.namespace.QName;
@@ -59,11 +59,14 @@
log.info("handleRequest");
QName[] headers = getHeaders();
- if (headers == null || headers.length != 3)
- throw new IllegalStateException("Invalid number of headers");
-
+ if (headers == null)
+ throw new IllegalStateException("Unable to retrieve headers");
+
+ if (headers.length != 3)
+ throw new IllegalStateException("Invalid number of headers expected=3,
actual=" + headers.length);
+
try
- {
+ {
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
SOAPHeader soapHeader = soapMessage.getSOAPHeader();
@@ -102,7 +105,7 @@
}
catch (SOAPException e)
{
- throw new JAXRPCException(e);
+ throw new JAXRPCException(e);
}
return true;