Author: ropalka
Date: 2012-04-12 23:51:36 -0400 (Thu, 12 Apr 2012)
New Revision: 16157
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/CIDGenerator.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Message.properties
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/MessageContextAssociation.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/SOAPElementWriter.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/SOAPUtils.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Style.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Use.java
Removed:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/MessageAbstraction.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/SOAPMessageAbstraction.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementWriter.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Style.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Use.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonBinding.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonMessageContext.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/MessageTrace.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/StubExt.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPBindingJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/ServletEndpointContextImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/ObjectContent.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPContentElementTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
Log:
[JBWS-3486] slim down native SAAJ impl. dependencies
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonBinding.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonBinding.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonBinding.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -21,12 +21,9 @@
*/
package org.jboss.ws.core;
-import java.util.Map;
+import javax.xml.soap.SOAPMessage;
-import javax.xml.namespace.QName;
-
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
@@ -38,19 +35,19 @@
public interface CommonBinding
{
/** On the client side, generate the Object from IN parameters. */
- MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+ SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv)
throws BindingException;
/** On the server side, extract the IN parameters from the Object and populate an
Invocation object */
- EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction reqMessage) throws BindingException;
+ EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage
reqMessage) throws BindingException;
/** On the server side, generate the Object from OUT parameters in the Invocation
object. */
- MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException;
+ SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException;
/** On the client side, extract the OUT parameters from the Object and return them to
the client. */
- void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException;
+ void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage,
EndpointInvocation epInv) throws BindingException;
/** bind an exception to a fault message */
- MessageAbstraction bindFaultMessage(Exception ex);
+ SOAPMessage bindFaultMessage(Exception ex);
void setHeaderSource(HeaderSource source);
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonClient.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -35,6 +35,7 @@
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
@@ -47,9 +48,8 @@
import org.jboss.ws.core.client.RemoteConnectionFactory;
import org.jboss.ws.core.client.transport.NettyClient;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.Style;
-import org.jboss.ws.core.soap.UnboundHeader;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.Style;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
@@ -80,8 +80,6 @@
protected QName operationName;
// The binding provider
protected CommonBindingProvider bindingProvider;
- // A Map<QName,UnboundHeader> of header entries
- private Map<QName, UnboundHeader> unboundHeaders = new LinkedHashMap<QName,
UnboundHeader>();
// A List<AttachmentPart> of attachment parts set through the proxy
private List<AttachmentPart> attachmentParts = new
ArrayList<AttachmentPart>();
@@ -283,7 +281,7 @@
setOutboundContextProperties();
// Bind the request message
- MessageAbstraction reqMessage = binding.bindRequestMessage(opMetaData, epInv,
unboundHeaders);
+ SOAPMessage reqMessage = binding.bindRequestMessage(opMetaData, epInv);
// Add possible attachment parts
addAttachmentParts(reqMessage);
@@ -294,7 +292,7 @@
handlerPass = handlerPass && callRequestHandlerChain(portName,
handlerType[2]);
// Handlers might have replaced the message
- reqMessage = msgContext.getMessageAbstraction();
+ reqMessage = msgContext.getSOAPMessage();
if (handlerPass)
{
@@ -311,7 +309,7 @@
addSessionInfo(reqMessage, callProps);
RemoteConnection remoteConnection = new
RemoteConnectionFactory().getRemoteConnection(epInfo);
- MessageAbstraction resMessage = remoteConnection.invoke(reqMessage, epInfo,
oneway);
+ SOAPMessage resMessage = remoteConnection.invoke(reqMessage, epInfo,
oneway);
if (maintainSession)
saveSessionInfo(callProps, requestCtx);
@@ -323,7 +321,7 @@
msgContext.put(CommonMessageContext.REMOTING_METADATA, callProps);
// Associate response message with message context
- msgContext.setMessageAbstraction(resMessage);
+ msgContext.setSOAPMessage(resMessage);
}
setInboundContextProperties();
@@ -344,8 +342,8 @@
if (handlerPass)
{
// unbind the return values
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- binding.unbindResponseMessage(opMetaData, resMessage, epInv,
unboundHeaders);
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv);
}
handlerPass = handlerPass && callResponseHandlerChain(portName,
handlerType[1]);
@@ -357,8 +355,8 @@
if (msgContext.isModified())
{
log.debug("Handler modified body payload, unbind message
again");
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- binding.unbindResponseMessage(opMetaData, resMessage, epInv,
unboundHeaders);
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv);
}
retObj = syncOutputParams(inputParams, epInv);
@@ -431,7 +429,7 @@
}
@SuppressWarnings("unchecked")
- protected void addSessionInfo(MessageAbstraction reqMessage, Map<String, Object>
callProperties)
+ protected void addSessionInfo(SOAPMessage reqMessage, Map<String, Object>
callProperties)
{
Map<String, String> cookies = (Map<String,
String>)callProperties.get(SESSION_COOKIES);
if (cookies != null)
@@ -453,7 +451,7 @@
return msgContext;
}
- protected void addAttachmentParts(MessageAbstraction reqMessage)
+ protected void addAttachmentParts(SOAPMessage reqMessage)
{
boolean debugEnabled = log.isDebugEnabled();
for (AttachmentPart part : attachmentParts)
@@ -514,74 +512,6 @@
}
/**
- * Add a header that is not bound to an input parameter.
- * A propriatory extension, that is not part of JAXRPC.
- *
- * @param xmlName The XML name of the header element
- * @param xmlType The XML type of the header element
- */
- public void addUnboundHeader(QName xmlName, QName xmlType, Class javaType,
ParameterMode mode)
- {
- UnboundHeader unboundHeader = new UnboundHeader(xmlName, xmlType, javaType, mode);
- unboundHeaders.put(xmlName, unboundHeader);
- }
-
- /**
- * Get the header value for the given XML name.
- * A propriatory extension, that is not part of JAXRPC.
- *
- * @param xmlName The XML name of the header element
- * @return The header value, or null
- */
- public Object getUnboundHeaderValue(QName xmlName)
- {
- UnboundHeader unboundHeader = unboundHeaders.get(xmlName);
- return (unboundHeader != null ? unboundHeader.getHeaderValue() : null);
- }
-
- /**
- * Set the header value for the given XML name.
- * A propriatory extension, that is not part of JAXRPC.
- *
- * @param xmlName The XML name of the header element
- */
- public void setUnboundHeaderValue(QName xmlName, Object value)
- {
- UnboundHeader unboundHeader = unboundHeaders.get(xmlName);
- if (unboundHeader == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"CANNOT_FIND_UNBOUND_HEADER", xmlName));
-
- unboundHeader.setHeaderValue(value);
- }
-
- /**
- * Clear all registered headers.
- * A propriatory extension, that is not part of JAXRPC.
- */
- public void clearUnboundHeaders()
- {
- unboundHeaders.clear();
- }
-
- /**
- * Remove the header for the given XML name.
- * A propriatory extension, that is not part of JAXRPC.
- */
- public void removeUnboundHeader(QName xmlName)
- {
- unboundHeaders.remove(xmlName);
- }
-
- /**
- * Get an Iterator over the registered header XML names.
- * A propriatory extension, that is not part of JAXRPC.
- */
- public Iterator getUnboundHeaders()
- {
- return unboundHeaders.keySet().iterator();
- }
-
- /**
* Adds the given AttachmentPart object to the outgoing SOAPMessage.
* An AttachmentPart object must be created before it can be added to a message.
*/
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonMessageContext.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -60,7 +60,7 @@
// The operation for this message ctx
private OperationMetaData opMetaData;
// The Message in this message context
- private MessageAbstraction message;
+ private SOAPMessage message;
// The map of scoped properties
protected Map<String, Object> props = new HashMap<String, Object>();
@@ -112,20 +112,10 @@
public void setSOAPMessage(SOAPMessage soapMessage)
{
- this.message = (MessageAbstraction)soapMessage;
+ this.message = soapMessage;
this.setModified(true);
}
- public MessageAbstraction getMessageAbstraction()
- {
- return message;
- }
-
- public void setMessageAbstraction(MessageAbstraction message)
- {
- this.message = message;
- }
-
public SerializationContext getSerializationContext()
{
if (serContext == null)
@@ -245,7 +235,7 @@
public static void cleanupAttachments(CommonMessageContext messageContext)
{
// cleanup attachments
- MessageAbstraction msg = messageContext.getMessageAbstraction();
+ SOAPMessage msg = messageContext.getSOAPMessage();
if(msg!=null && (msg instanceof SOAPMessage)) // in case of http binding
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAP11Binding.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -24,15 +24,16 @@
import java.util.Set;
import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
import org.jboss.ws.common.Constants;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPFaultImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.soap.Use;
+import org.jboss.ws.core.soap.utils.SOAPUtils;
+import org.jboss.ws.core.soap.utils.Use;
import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
@@ -43,18 +44,17 @@
*/
public abstract class CommonSOAP11Binding extends CommonSOAPBinding
{
- private MessageFactoryImpl msgFactory;
+ private MessageFactory msgFactory;
public CommonSOAP11Binding()
{
- msgFactory = new MessageFactoryImpl();
- msgFactory.setEnvNamespace(Constants.NS_SOAP11_ENV);
+ msgFactory = SOAPUtils.newSOAP11MessageFactory();
}
/** Create the SOAP-1.1 message */
- protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws
SOAPException
+ protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
{
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgFactory.createMessage();
+ SOAPMessage soapMessage = msgFactory.createMessage();
Use encStyle = opMetaData.getEndpointMetaData().getEncodingStyle();
if (Use.ENCODED.equals(encStyle))
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAP12Binding.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -24,13 +24,15 @@
import java.util.Set;
import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
import org.jboss.ws.common.Constants;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPFaultImpl;
+import org.jboss.ws.core.soap.utils.SOAPUtils;
import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
@@ -41,18 +43,17 @@
*/
public abstract class CommonSOAP12Binding extends CommonSOAPBinding
{
- private MessageFactoryImpl msgFactory;
+ private MessageFactory msgFactory;
public CommonSOAP12Binding()
{
- msgFactory = new MessageFactoryImpl();
- msgFactory.setEnvNamespace(Constants.NS_SOAP12_ENV);
+ msgFactory = SOAPUtils.newSOAP12MessageFactory();
}
/** Create the SOAP-1.1 message */
- protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws
SOAPException
+ protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
{
- return (MessageAbstraction)msgFactory.createMessage();
+ return msgFactory.createMessage();
}
protected abstract Set<String> getRoles();
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -21,9 +21,7 @@
*/
package org.jboss.ws.core;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
@@ -54,23 +52,20 @@
import org.jboss.ws.common.JavaUtils;
import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPBodyElementDoc;
import org.jboss.ws.core.soap.SOAPBodyElementRpc;
import org.jboss.ws.core.soap.SOAPBodyImpl;
import org.jboss.ws.core.soap.SOAPContentElement;
import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPFactoryImpl;
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.Style;
-import org.jboss.ws.core.soap.UnboundHeader;
-import org.jboss.ws.core.soap.Use;
import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
-import org.jboss.ws.core.soap.attachment.CIDGenerator;
+import org.jboss.ws.core.soap.utils.CIDGenerator;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.SOAPUtils;
+import org.jboss.ws.core.soap.utils.Style;
+import org.jboss.ws.core.soap.utils.Use;
import org.jboss.ws.core.utils.MimeUtils;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
@@ -105,19 +100,19 @@
public MessageFactory getMessageFactory()
{
- return new MessageFactoryImpl();
+ return SOAPUtils.newSOAP11MessageFactory();
}
public SOAPFactory getSOAPFactory()
{
- return new SOAPFactoryImpl();
+ return SOAPUtils.newSOAP11Factory();
}
/** Create the message */
- protected abstract MessageAbstraction createMessage(OperationMetaData opMetaData)
throws SOAPException;
+ protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException;
/** On the client side, generate the payload from IN parameters. */
- public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv)
throws BindingException
{
boolean debugEnabled = log.isDebugEnabled();
@@ -131,7 +126,7 @@
throw new WSException(BundleUtils.getMessage(bundle,
"MESSAGECONTEXT_NOT_AVAILABLE"));
// Associate current message with message context
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ SOAPMessage reqMessage = createMessage(opMetaData);
msgContext.setSOAPMessage(reqMessage);
SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
@@ -171,8 +166,7 @@
if (paramMetaData.isSwA())
{
// NOTE: swa:ref is handled by the AttachmentMarshaller callback
- CIDGenerator cidGenerator = reqMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(paramMetaData, value,
cidGenerator);
+ AttachmentPart part = createAttachmentPart(paramMetaData, value);
reqMessage.addAttachmentPart(part);
}
else
@@ -182,35 +176,6 @@
}
}
- // Add unbound headers
- if (unboundHeaders != null)
- {
- Iterator it = unboundHeaders.values().iterator();
- while (it.hasNext())
- {
- UnboundHeader unboundHeader = (UnboundHeader)it.next();
- if (unboundHeader.getMode() != ParameterMode.OUT)
- {
- QName xmlName = unboundHeader.getXmlName();
- Object value = unboundHeader.getHeaderValue();
-
- xmlName = namespaceRegistry.registerQName(xmlName);
- Name soapName = new NameImpl(xmlName.getLocalPart(),
xmlName.getPrefix(), xmlName.getNamespaceURI());
-
- if (debugEnabled)
- log.debug("Add unboundHeader element: " + soapName);
- SOAPContentElement contentElement = new
SOAPHeaderElementImpl(soapName);
-
contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
-
- if (soapHeader == null)
- soapHeader = soapEnvelope.addHeader();
-
- soapHeader.addChildElement(contentElement);
- contentElement.setObjectValue(value);
- }
- }
- }
-
// Set the SOAPAction
setSOAPActionHeader(opMetaData, reqMessage);
@@ -227,7 +192,7 @@
public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage
reqMessage);
/** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction payload) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
SOAPMessage payload) throws BindingException
{
if (log.isDebugEnabled())
log.debug("unbindRequestMessage: " + opMetaData.getQName());
@@ -235,7 +200,7 @@
try
{
// Read the SOAPEnvelope from the reqMessage
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)payload;
+ SOAPMessage reqMessage = (SOAPMessage)payload;
SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
SOAPHeader soapHeader = soapEnvelope.getHeader();
SOAPBody soapBody = soapEnvelope.getBody();
@@ -339,7 +304,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
+ public SOAPMessage bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
{
if (log.isDebugEnabled())
log.debug("bindResponseMessage: " + opMetaData.getQName());
@@ -351,7 +316,7 @@
throw new WSException(BundleUtils.getMessage(bundle,
"MESSAGECONTEXT_NOT_AVAILABLE"));
// Associate current message with message context
- SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ SOAPMessage resMessage = (SOAPMessage)createMessage(opMetaData);
msgContext.setSOAPMessage(resMessage);
// R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response
that contains a SOAP envelope.
@@ -400,8 +365,7 @@
if (retMetaData.isSwA())
{
- CIDGenerator cidGenerator = resMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(retMetaData, value,
cidGenerator);
+ AttachmentPart part = createAttachmentPart(retMetaData, value);
resMessage.addAttachmentPart(part);
epInv.setReturnValue(part);
}
@@ -420,8 +384,7 @@
Object value = epInv.getResponseParamValue(xmlName);
if (paramMetaData.isSwA())
{
- CIDGenerator cidGenerator = resMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(paramMetaData, value,
cidGenerator);
+ AttachmentPart part = createAttachmentPart(paramMetaData, value);
resMessage.addAttachmentPart(part);
}
else
@@ -447,7 +410,7 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to
the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
payload, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage payload,
EndpointInvocation epInv)
throws BindingException
{
if (log.isDebugEnabled())
@@ -463,7 +426,7 @@
}
// WS-Addressing might redirect the response, which results in an empty
envelope
- SOAPMessageImpl resMessage = (SOAPMessageImpl)payload;
+ SOAPMessage resMessage = payload;
SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
if (soapEnvelope == null)
{
@@ -486,32 +449,6 @@
if (soapBodyElement instanceof SOAPFaultImpl)
throwFaultException((SOAPFaultImpl)soapBodyElement);
- // Extract unbound OUT headers
- if (unboundHeaders != null && soapHeader != null)
- {
- Map<QName, UnboundHeader> outHeaders = new HashMap<QName,
UnboundHeader>();
- Iterator itHeaderElements = soapHeader.getChildElements();
- while (itHeaderElements.hasNext())
- {
- SOAPContentElement soapHeaderElement =
(SOAPHeaderElementImpl)itHeaderElements.next();
- Name elName = soapHeaderElement.getElementName();
- QName xmlName = new QName(elName.getURI(), elName.getLocalName());
-
- UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName);
- if (unboundHeader != null)
- {
-
soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
-
- // Do the unmarshalling
- Object value = soapHeaderElement.getObjectValue();
- unboundHeader.setHeaderValue(value);
- outHeaders.put(xmlName, unboundHeader);
- }
- }
- unboundHeaders.clear();
- unboundHeaders.putAll(outHeaders);
- }
-
Style style = opMetaData.getStyle();
SOAPElement soapElement = soapBody;
if (style == Style.RPC)
@@ -558,9 +495,9 @@
}
}
- public MessageAbstraction bindFaultMessage(Exception ex)
+ public SOAPMessage bindFaultMessage(Exception ex)
{
- SOAPMessageImpl faultMessage =
(SOAPMessageImpl)createFaultMessageFromException(ex);
+ SOAPMessage faultMessage = createFaultMessageFromException(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
@@ -586,7 +523,7 @@
log.warn(BundleUtils.getMessage(bundle, "EXPECTED_SOAP12", envNS));
}
- private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object
value, CIDGenerator cidGenerator) throws SOAPException, BindingException
+ private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object
value) throws SOAPException, BindingException
{
String partName = paramMetaData.getXmlName().getLocalPart();
Set mimeTypes = paramMetaData.getMimeTypes();
@@ -625,33 +562,37 @@
if (paramMetaData.isSwA())
{
- String swaCID = '<' + partName + "=" +
cidGenerator.generateFromCount() + '>';
+ String swaCID = '<' + partName + "=" +
CIDGenerator.generateFromCount() + '>';
part.setContentId(swaCID);
}
return part;
}
- private AttachmentPart createAttachmentPart(final String contentId, final DataHandler
value)
- {
- AttachmentPart part = new AttachmentPartImpl();
- part.setContentId(contentId);
- part.setDataHandler(value);
-
- return part;
- }
-
private AttachmentPart getAttachmentFromMessage(ParameterMetaData paramMetaData,
SOAPMessage message) throws SOAPException, BindingException
{
QName xmlName = paramMetaData.getXmlName();
- AttachmentPart part =
((SOAPMessageImpl)message).getAttachmentByPartName(xmlName.getLocalPart());
+ AttachmentPart part = getAttachmentByPartName(xmlName.getLocalPart(), message);
if (part == null)
throw new BindingException(BundleUtils.getMessage(bundle,
"COULD_NOT_LOCATE_ATTACHMENT", paramMetaData.getXmlName()));
return part;
}
+ private AttachmentPart getAttachmentByPartName(String partName, SOAPMessage soapMsg)
+ {
+ final Iterator i = soapMsg.getAttachments();
+ while (i.hasNext())
+ {
+ AttachmentPart part = (AttachmentPart)i.next();
+ String contentId = part.getContentId();
+ if (contentId.startsWith("<" + partName + "="))
+ return part;
+ }
+ return null;
+ }
+
/** Marshall the given parameter and add it to the SOAPMessage */
private SOAPContentElement addParameterToMessage(ParameterMetaData paramMetaData,
Object value, SOAPElement soapElement) throws SOAPException, BindingException
{
@@ -761,13 +702,13 @@
OperationMetaData opMetaData = paramMetaData.getOperationMetaData();
TypesMetaData typesMetaData =
opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- SOAPElementImpl childElement = null;
+ SOAPElement childElement = null;
while (childElement == null && childElements.hasNext())
{
Object current = childElements.next();
- if (current instanceof SOAPElementImpl)
+ if (current instanceof SOAPElement)
{
- childElement = (SOAPElementImpl)current;
+ childElement = (SOAPElement)current;
}
}
@@ -809,7 +750,7 @@
if (msgContext == null)
throw new WSException(BundleUtils.getMessage(bundle,
"MESSAGECONTEXT_NOT_AVAILABLE"));
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ SOAPMessage soapMessage = (SOAPMessage)msgContext.getSOAPMessage();
SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
if (soapEnvelope == null || soapEnvelope.getHeader() == null)
return;
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/MessageAbstraction.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/MessageAbstraction.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/MessageAbstraction.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MimeHeaders;
-
-/**
- * A generic message independent of the underlying protocol
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 02-Apr-2007
- */
-public interface MessageAbstraction
-{
- MimeHeaders getMimeHeaders();
-
- void writeTo(OutputStream outputStream) throws IOException;
-
- boolean isFaultMessage();
-
- void addAttachmentPart(AttachmentPart part);
-
-}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/MessageTrace.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/MessageTrace.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/MessageTrace.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -32,9 +32,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.DOMWriter;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPElementWriter;
import org.jboss.ws.core.soap.XMLFragment;
+import org.jboss.ws.core.soap.utils.SOAPElementWriter;
import org.w3c.dom.Element;
/**
@@ -64,7 +63,7 @@
SOAPEnvelope soapEnv = ((SOAPMessage)message).getSOAPPart().getEnvelope();
if (soapEnv != null)
{
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
+ String envStr = SOAPElementWriter.writeElement(soapEnv, true);
msgLog.trace(messagePrefix + "\n" + envStr);
}
}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/SOAPMessageAbstraction.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/SOAPMessageAbstraction.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/SOAPMessageAbstraction.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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;
-
-/**
- * A generic SOAP message
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 02-Apr-2007
- */
-public interface SOAPMessageAbstraction extends MessageAbstraction
-{
-
-}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/StubExt.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/StubExt.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/StubExt.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -21,10 +21,6 @@
*/
package org.jboss.ws.core;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
import javax.xml.soap.AttachmentPart;
/**
@@ -75,54 +71,7 @@
/** Client ReceiveTimeout property: javax.xml.ws.client.receiveTimeout */
static final String PROPERTY_RECEIVE_TIMEOUT =
"javax.xml.ws.client.receiveTimeout";
-
-
-
/**
- * Add a header that is not bound to an input parameter.
- * A propriatory extension, that is not part of JAXRPC.
- *
- * @param xmlName The XML name of the header element
- * @param xmlType The XML type of the header element
- */
- void addUnboundHeader(QName xmlName, QName xmlType, Class javaType, ParameterMode
mode);
-
- /**
- * Get the header value for the given XML name.
- * A propriatory extension, that is not part of JAXRPC.
- *
- * @param xmlName The XML name of the header element
- * @return The header value, or null
- */
- Object getUnboundHeaderValue(QName xmlName);
-
- /**
- * Set the header value for the given XML name.
- * A propriatory extension, that is not part of JAXRPC.
- *
- * @param xmlName The XML name of the header element
- */
- void setUnboundHeaderValue(QName xmlName, Object value);
-
- /**
- * Clear all registered headers.
- * A propriatory extension, that is not part of JAXRPC.
- */
- void clearUnboundHeaders();
-
- /**
- * Remove the header for the given XML name.
- * A propriatory extension, that is not part of JAXRPC.
- */
- void removeUnboundHeader(QName xmlName);
-
- /**
- * Get an Iterator over the registered header XML names.
- * A propriatory extension, that is not part of JAXRPC.
- */
- Iterator getUnboundHeaders();
-
- /**
* Adds the given AttachmentPart object to the outgoing SOAPMessage.
* An AttachmentPart object must be created before it can be added to a message.
*/
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -29,9 +29,9 @@
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.core.StubExt;
import org.jboss.ws.core.client.transport.NettyClient;
@@ -87,7 +87,7 @@
*
* A null reqMessage signifies a HTTP GET request.
*/
- public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint,
boolean oneway) throws IOException
+ public SOAPMessage invoke(SOAPMessage reqMessage, Object endpoint, boolean oneway)
throws IOException
{
if (endpoint == null)
throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"GIVEN_ENDPOINT_CANNOT_BE_NULL"));
@@ -125,7 +125,7 @@
populateHeaders(reqMessage, additionalHeaders);
//Trace the outgoing message
MessageTrace.traceMessage("Outgoing Request Message", reqMessage);
- MessageAbstraction resMessage = (MessageAbstraction)client.invoke(reqMessage,
targetAddress, oneway, additionalHeaders, callProps);
+ SOAPMessage resMessage = (SOAPMessage)client.invoke(reqMessage, targetAddress,
oneway, additionalHeaders, callProps);
//Trace the incoming response message
MessageTrace.traceMessage("Incoming Response Message", resMessage);
return resMessage;
@@ -133,7 +133,7 @@
- protected void populateHeaders(MessageAbstraction reqMessage, Map<String,
Object> metadata)
+ protected void populateHeaders(SOAPMessage reqMessage, Map<String, Object>
metadata)
{
if (reqMessage != null)
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -23,9 +23,8 @@
import java.io.IOException;
-import org.jboss.ws.core.MessageAbstraction;
+import javax.xml.soap.SOAPMessage;
-
/**
* A remote connection
*
@@ -38,5 +37,5 @@
UnMarshaller getUnmarshaller();
- MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean
oneway) throws IOException;
+ SOAPMessage invoke(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws
IOException;
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -28,7 +28,6 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP;
@@ -52,12 +51,12 @@
}
@Override
- public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint,
boolean oneway) throws IOException
+ public SOAPMessage invoke(SOAPMessage reqMessage, Object endpoint, boolean oneway)
throws IOException
{
try
{
// save object model changes
- SOAPMessage soapMessage = (SOAPMessage)reqMessage;
+ SOAPMessage soapMessage = reqMessage;
if (reqMessage != null && soapMessage.saveRequired())
soapMessage.saveChanges();
@@ -71,7 +70,7 @@
}
}
- protected void populateHeaders(MessageAbstraction reqMessage, Map<String,
Object> metadata)
+ protected void populateHeaders(SOAPMessage reqMessage, Map<String, Object>
metadata)
{
super.populateHeaders(reqMessage, metadata);
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -44,7 +44,7 @@
import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
-import org.jboss.ws.core.soap.Style;
+import org.jboss.ws.core.soap.utils.Style;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPBindingJAXRPC.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPBindingJAXRPC.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPBindingJAXRPC.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -27,7 +27,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
-import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -32,12 +32,16 @@
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.soap.Detail;
import javax.xml.soap.DetailEntry;
+import javax.xml.soap.MessageFactory;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
@@ -54,13 +58,10 @@
import org.jboss.ws.core.binding.DeserializerSupport;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.NameImpl;
-import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
-import org.jboss.ws.core.soap.SOAPFactoryImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.XMLFragment;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.SOAPUtils;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -177,7 +178,7 @@
/** Translate the request exception into a SOAPFault message.
*/
- public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx)
+ public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
{
// Get or create the SOAPFaultException
SOAPFaultException faultEx;
@@ -215,7 +216,7 @@
try
{
- SOAPMessageImpl faultMessage = toSOAPMessage(faultEx);
+ SOAPMessage faultMessage = toSOAPMessage(faultEx);
return faultMessage;
}
catch (RuntimeException rte)
@@ -229,7 +230,7 @@
}
}
- private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws
SOAPException
+ private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws
SOAPException
{
assertFaultCode(faultEx.getFaultCode());
@@ -237,9 +238,9 @@
SerializationContext serContext = (msgContext != null ?
msgContext.getSerializationContext() : new SerializationContextJAXRPC());
NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
- SOAPMessageImpl soapMessage = createSOAPMessage();
+ SOAPMessage soapMessage = createSOAPMessage();
- SOAPEnvelopeImpl soapEnvelope =
(SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
+ SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
QName faultCode = faultEx.getFaultCode();
@@ -289,7 +290,7 @@
XMLFragment xmlFragment = new XMLFragment(result);
Element domElement = xmlFragment.toElement();
- SOAPFactoryImpl soapFactory = new SOAPFactoryImpl();
+ SOAPFactory soapFactory = SOAPUtils.newSOAP11Factory();
SOAPElement soapElement = soapFactory.createElement(domElement);
detail = soapFault.addDetail();
@@ -310,16 +311,10 @@
return soapMessage;
}
- private static SOAPMessageImpl createSOAPMessage() throws SOAPException
+ private static SOAPMessage createSOAPMessage() throws SOAPException
{
- MessageFactoryImpl factory = new MessageFactoryImpl();
-
- if (isSOAP12() == true)
- {
- factory.setEnvNamespace(Constants.NS_SOAP12_ENV);
- }
-
- return (SOAPMessageImpl)factory.createMessage();
+ final MessageFactory factory = isSOAP12() ? SOAPUtils.newSOAP12MessageFactory() :
SOAPUtils.newSOAP11MessageFactory();
+ return factory.createMessage();
}
private static boolean isSOAP12()
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -33,7 +33,7 @@
import org.jboss.ws.common.JavaUtils;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/ServletEndpointContextImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/ServletEndpointContextImpl.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/ServletEndpointContextImpl.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -31,7 +31,7 @@
import javax.xml.rpc.server.ServletEndpointContext;
import org.jboss.ws.core.server.ServletRequestContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
/**
* Implementation of <code>ServletEndpointContext</code>
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -29,7 +29,7 @@
import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.binding.DeserializerSupport;
import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.utils.SOAPUtils;
import org.w3c.dom.Element;
/**
@@ -52,7 +52,7 @@
if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName +
",xmlType=" + xmlType + "]");
try
{
- return new SOAPFactoryImpl().createElement(xmlFragment);
+ return SOAPUtils.newSOAP11Factory().createElement(xmlFragment);
}
catch (SOAPException se)
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -28,7 +28,7 @@
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -62,7 +62,7 @@
import org.jboss.ws.core.jaxrpc.handler.HandlerChainBaseImpl;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -44,9 +44,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.Constants;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPElementWriter;
import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
+import org.jboss.ws.core.soap.utils.SOAPElementWriter;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.EndpointAssociation;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
@@ -455,7 +454,7 @@
try
{
SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
+ String envStr = SOAPElementWriter.writeElement(soapEnv, true);
if (envStr.equals(lastMessageTrace))
{
log.trace(logMsg + ": unchanged");
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -35,7 +35,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.RoleSource;
import org.jboss.ws.core.server.ServerHandlerDelegate;
-import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.HandlerMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -33,6 +33,7 @@
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
@@ -46,14 +47,13 @@
import org.jboss.ws.core.DirectionHolder;
import org.jboss.ws.core.DirectionHolder.Direction;
import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.SOAPMessageDispatcher;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
@@ -116,7 +116,7 @@
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData sepMetaData =
(ServerEndpointMetaData)msgContext.getEndpointMetaData();
- MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
+ SOAPMessage reqMessage = msgContext.getSOAPMessage();
// The direction of the message
DirectionHolder direction = new DirectionHolder(Direction.InBound);
@@ -171,7 +171,7 @@
if (msgContext.isModified())
{
log.debug("Handler modified payload, unbind message again");
- reqMessage = msgContext.getMessageAbstraction();
+ reqMessage = msgContext.getSOAPMessage();
sepInv = binding.unbindRequestMessage(opMetaData, reqMessage);
}
@@ -197,15 +197,15 @@
msgContext = processPivotInternal(msgContext, direction);
// Bind the response message
- MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData,
sepInv);
- msgContext.setMessageAbstraction(resMessage);
+ SOAPMessage resMessage = binding.bindResponseMessage(opMetaData, sepInv);
+ msgContext.setSOAPMessage(resMessage);
}
else
{
// Reverse the message direction without calling the endpoint
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
msgContext = processPivotInternal(msgContext, direction);
- msgContext.setMessageAbstraction(resMessage);
+ msgContext.setSOAPMessage(resMessage);
}
if (oneway == false)
@@ -352,12 +352,12 @@
return msgContext;
}
- private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
MessageAbstraction reqMessage) throws SOAPException
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
SOAPMessage reqMessage) throws SOAPException
{
OperationMetaData opMetaData;
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
- opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ SOAPMessage soapMessage = reqMessage;
+ opMetaData = getOperationMetaData(epMetaData, soapMessage);
SOAPHeader soapHeader = soapMessage.getSOAPHeader();
// Report a MustUnderstand fault
@@ -392,4 +392,14 @@
}
return opMetaData;
}
+
+ /** Get the operation meta data for this SOAP message
+ */
+ public OperationMetaData getOperationMetaData(EndpointMetaData epMetaData, SOAPMessage
soapMsg) throws SOAPException
+ {
+ SOAPMessageDispatcher dispatcher = new SOAPMessageDispatcher();
+ return dispatcher.getDispatchDestination(epMetaData, soapMsg);
+ }
+
+
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -28,7 +28,7 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -120,7 +120,7 @@
CommonBinding binding = bindingProvider.getCommonBinding();
log.debug("Handler modified payload, unbind message and update
invocation args");
- EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData,
messageContext.getMessageAbstraction());
+ EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData,
messageContext.getSOAPMessage());
wsInv.getInvocationContext().addAttachment(EndpointInvocation.class,
epInv);
}
catch (BindingException ex)
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilder.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilder.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -30,6 +30,7 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
+import org.jboss.ws.core.soap.utils.Style;
import org.w3c.dom.Element;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -44,6 +44,7 @@
import org.jboss.ws.common.Constants;
import org.jboss.ws.common.DOMUtils;
import org.jboss.ws.core.CommonSOAPFaultException;
+import org.jboss.ws.core.soap.utils.Style;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.util.Stack;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.DOMUtils;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.utils.ThreadLocalAssociation;
-
-/**
- * A thread local association with the current message context
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-Dec-2004
- */
-public class MessageContextAssociation
-{
- // provide logging
- private static Logger log = Logger.getLogger(MessageContextAssociation.class);
-
- public static void pushMessageContext(CommonMessageContext msgContext)
- {
- if (log.isDebugEnabled())
- log.debug("pushMessageContext: " + msgContext + " (Thread "
+ Thread.currentThread().getName() + ")");
- Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
- if (stack == null)
- {
- stack = new Stack<CommonMessageContext>();
- ThreadLocalAssociation.localMsgContextAssoc().set(stack);
- }
- stack.push(msgContext);
- }
-
- public static CommonMessageContext peekMessageContext()
- {
- CommonMessageContext msgContext = null;
- Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
- if (stack != null && stack.isEmpty() == false)
- {
- msgContext = stack.peek();
- }
- return msgContext;
- }
-
- public static CommonMessageContext popMessageContext()
- {
- return popMessageContext(true);
- }
-
- public static CommonMessageContext popMessageContext(boolean clearDOMIfEmpty)
- {
- CommonMessageContext msgContext = null;
- Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
- if (stack != null && stack.isEmpty() == false)
- {
- msgContext = stack.pop();
- if (stack.isEmpty() == true && clearDOMIfEmpty == true)
- {
- DOMUtils.clearThreadLocals();
- }
- }
- if (log.isDebugEnabled())
- log.debug("popMessageContext: " + msgContext + " (Thread " +
Thread.currentThread().getName() + ")");
- return msgContext;
- }
-
-}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -46,6 +46,8 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.core.soap.attachment.MultipartRelatedDecoder;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.Style;
/**
* MessageFactory implementation
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/ObjectContent.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/ObjectContent.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/ObjectContent.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -39,6 +39,7 @@
import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.binding.NullValueSerializer;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -28,7 +28,6 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.client.HTTPRemotingConnection;
import org.jboss.ws.core.client.RemoteConnection;
import org.jboss.ws.core.client.SOAPProtocolConnectionHTTP;
@@ -62,8 +61,7 @@
if (reqMessage == null)
throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"SOAPMESSAGE_CANNOT_BE_NULL"));
- MessageAbstraction resMessage = callInternal(reqMessage, endpoint, false);
- return (SOAPMessage)resMessage;
+ return callInternal(reqMessage, endpoint, false);
}
/**
@@ -72,8 +70,7 @@
@Override
public SOAPMessage get(Object endpoint) throws SOAPException
{
- MessageAbstraction resMessage = callInternal(null, endpoint, false);
- return (SOAPMessage)resMessage;
+ return callInternal(null, endpoint, false);
}
/**
@@ -85,8 +82,7 @@
if (reqMessage == null)
throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"SOAPMESSAGE_CANNOT_BE_NULL"));
- MessageAbstraction resMessage = callInternal(reqMessage, endpoint, true);
- return (SOAPMessage)resMessage;
+ return callInternal(reqMessage, endpoint, true);
}
private RemoteConnection getRemotingConnection(Object endpoint)
@@ -113,12 +109,12 @@
}
}
- private MessageAbstraction callInternal(SOAPMessage reqMessage, Object endpoint,
boolean oneway) throws SOAPException
+ private SOAPMessage callInternal(SOAPMessage reqMessage, Object endpoint, boolean
oneway) throws SOAPException
{
try
{
remotingConnection = getRemotingConnection(endpoint);
- MessageAbstraction resMessage =
remotingConnection.invoke((SOAPMessageImpl)reqMessage, endpoint, oneway);
+ SOAPMessage resMessage = remotingConnection.invoke((SOAPMessageImpl)reqMessage,
endpoint, oneway);
return resMessage;
}
catch (Exception ex)
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -38,6 +38,7 @@
import org.jboss.ws.common.DOMWriter;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.soap.SOAPContent.State;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementWriter.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementWriter.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementWriter.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -1,160 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.ResourceBundle;
-
-import javax.xml.soap.SOAPEnvelope;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.DOMUtils;
-import org.jboss.ws.common.DOMWriter;
-
-/**
- * Writes a SAAJ elements to an output stream.
- *
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @author Thomas.Diesler(a)jboss.com
- * @since 4-Aug-2006
- */
-public class SOAPElementWriter
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(SOAPElementWriter.class);
-
- // Print writer
- private PrintWriter out;
- // True, if the XML declaration should be written
- private boolean writeXMLDeclaration;
- // Explicit character set encoding
- private String charsetName;
-
- public SOAPElementWriter(Writer w)
- {
- this.out = new PrintWriter(w);
- }
-
- public SOAPElementWriter(OutputStream stream)
- {
- try
- {
- this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
- }
- catch (UnsupportedEncodingException e)
- {
- // ignore, UTF-8 should be available
- }
- }
-
- public SOAPElementWriter(OutputStream stream, String charsetName)
- {
- try
- {
- this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
- this.charsetName = charsetName;
- }
- catch (UnsupportedEncodingException e)
- {
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"UNSUPPORTED_ENCODING", charsetName));
- }
- }
-
- /**
- * Set wheter the XML declaration should be written.
- * The default is false.
- */
- public SOAPElementWriter setWriteXMLDeclaration(boolean writeXMLDeclaration)
- {
- this.writeXMLDeclaration = writeXMLDeclaration;
- return this;
- }
-
- /**
- * Print a node with explicit prettyprinting.
- * The defaults for all other DOMWriter properties apply.
- */
- public static String writeElement(SOAPElementImpl element, boolean pretty)
- {
- if (element == null)
- return null;
-
- StringWriter strw = new StringWriter();
- new SOAPElementWriter(strw).writeElement(element);
- String xmlStr = strw.toString();
-
- if (pretty)
- {
- // This is expensive. Make sure it only happens for debugging
- try
- {
- // TODO: this unescapes sepcial chars, which might be quiet confusing
- // but they are actually send escaped.
- xmlStr = DOMWriter.printNode(DOMUtils.parse(xmlStr), true);
- }
- catch (IOException ex)
- {
- throw new WSException ("Cannot parse xml: " + xmlStr, ex);
- }
- }
-
- return xmlStr;
- }
-
- public void writeElement(SOAPElementImpl element)
- {
- writeElementInternal(element);
- }
-
- private void writeElementInternal(SOAPElementImpl element)
- {
- if (element != null)
- {
- try
- {
- if (writeXMLDeclaration == true && element instanceof SOAPEnvelope)
- {
- out.print("<?xml version='1.0'");
- if (charsetName != null)
- out.print(" encoding='" + charsetName +
"'");
-
- out.println("?>");
- writeXMLDeclaration = false;
- }
-
- element.writeElement(out);
-
- out.flush();
- }
- catch (IOException ex)
- {
- throw new WSException(BundleUtils.getMessage(bundle,
"CANNOT_WRITE_SOAP_ELEMENT"), ex);
- }
- }
- }
-}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -33,6 +33,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.core.soap.utils.Style;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -42,7 +42,6 @@
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
@@ -52,13 +51,13 @@
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.Constants;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.SOAPMessageAbstraction;
import org.jboss.ws.core.soap.SOAPContent.State;
import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
-import org.jboss.ws.core.soap.attachment.CIDGenerator;
import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.core.soap.attachment.MultipartRelatedEncoder;
import org.jboss.ws.core.soap.attachment.MultipartRelatedSwAEncoder;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.SOAPElementWriter;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.w3c.dom.Node;
@@ -71,7 +70,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
*/
-public class SOAPMessageImpl extends SOAPMessage implements SOAPMessageAbstraction
+public class SOAPMessageImpl extends SOAPMessage
{
private static final ResourceBundle bundle =
BundleUtils.getBundle(SOAPMessageImpl.class);
private static Logger log = Logger.getLogger(SOAPMessageImpl.class);
@@ -79,8 +78,6 @@
private boolean saveRequired = true;
private MimeHeaders mimeHeaders = new MimeHeaders();
private List<AttachmentPart> attachments = new
LinkedList<AttachmentPart>();
- private CIDGenerator cidGenerator = new CIDGenerator();
- private boolean faultMessage;
private SOAPPartImpl soapPart;
private MultipartRelatedEncoder multipartRelatedEncoder;
private static final boolean writeXMLDeclaration =
Boolean.getBoolean(WRITE_XML_DECLARATION);
@@ -135,23 +132,6 @@
throw new SOAPException(BundleUtils.getMessage(bundle,
"CANNOT_OBTAIN_SOAPHEADER"));
}
- public CIDGenerator getCidGenerator()
- {
- return cidGenerator;
- }
-
- /**
- * Marks this <code>SOAPMessage</code> as a fault. Otherwise, the message
- * will be checked for a SOAPFault. The reason for this is to allow for
- * faults to be encrypted, in which case there is no SOAPFault.
- *
- * @param faultMessage whether this message is a fault
- */
- public void setFaultMessage(boolean faultMessage)
- {
- this.faultMessage = faultMessage;
- }
-
public void setAttachments(Collection<AttachmentPart> parts) throws
SOAPException
{
for (AttachmentPart part : parts)
@@ -415,22 +395,6 @@
return opMetaData;
}
- public boolean isFaultMessage()
- {
- if (faultMessage)
- return true;
-
- SOAPFault soapFault = null;
- try
- {
- soapFault = getSOAPBody().getFault();
- }
- catch (Exception ignore)
- {
- }
- return soapFault != null;
- }
-
private boolean isWriteXMLDeclaration() throws SOAPException
{
Boolean booleanValue = new Boolean(false);
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -25,9 +25,9 @@
import java.io.OutputStream;
import java.util.ResourceBundle;
+import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.core.client.Marshaller;
@@ -39,8 +39,6 @@
public class SOAPMessageMarshaller implements Marshaller
{
private static final ResourceBundle bundle =
BundleUtils.getBundle(SOAPMessageMarshaller.class);
- // Provide logging
- private static Logger log = Logger.getLogger(SOAPMessageMarshaller.class);
/**
* Marshaller will need to take the dataObject and convert
@@ -56,7 +54,11 @@
if ((dataObject instanceof SOAPMessage) == false)
throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"NOT_A_SOAPMESSAGE", dataObject));
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
- soapMessage.writeTo(output);
+ SOAPMessage soapMessage = (SOAPMessage)dataObject;
+ try {
+ soapMessage.writeTo(output);
+ } catch (SOAPException e) {
+ throw new IOException(e);
+ }
}
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -42,6 +42,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.api.util.ServiceLoader;
+import org.jboss.ws.core.soap.utils.Style;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Style.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Style.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Style.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.util.ResourceBundle;
-
-import org.jboss.ws.api.util.BundleUtils;
-
-/** A type-safe enumeration for encoding style.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 14-Oct-2004
- */
-public class Style
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(Style.class);
- private String style;
-
- public static final Style RPC = new Style("rpc");
- public static final Style DOCUMENT = new Style("document");
-
- private Style(String style)
- {
- this.style = style;
- }
-
- public static Style getDefaultStyle()
- {
- return DOCUMENT;
- }
-
- public static Style valueOf(String style)
- {
- if (RPC.style.equals(style))
- return RPC;
- if (DOCUMENT.style.equals(style))
- return DOCUMENT;
-
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"UNSUPPORTED_STYLE", style));
- }
-
- public String toString()
- {
- return style;
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Use.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Use.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/Use.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.util.ResourceBundle;
-
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-
-/** A type-safe enumeration for encoding use.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-Oct-2005
- */
-public class Use
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(Use.class);
- private String use;
-
- public static final Use LITERAL = new Use("literal");
- public static final Use ENCODED = new Use("encoded");
-
- private Use(String use)
- {
- this.use = use;
- }
-
- public static Use getDefaultUse()
- {
- return LITERAL;
- }
-
- public static Use valueOf(String encodingStyle)
- {
- if (Constants.URI_LITERAL_ENC.equals(encodingStyle) ||
LITERAL.use.equals(encodingStyle))
- return LITERAL;
- if (Constants.URI_SOAP11_ENC.equals(encodingStyle) ||
ENCODED.use.equals(encodingStyle))
- return ENCODED;
-
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"UNSUPPORTED_ENCODING_STYLE", encodingStyle));
- }
-
- public String toURI()
- {
- String encURI = null;
- if (this == LITERAL)
- encURI = Constants.URI_LITERAL_ENC;
- else if (this == ENCODED)
- encURI = Constants.URI_SOAP11_ENC;
- return encURI;
- }
-
- public String toString()
- {
- return use;
- }
-}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -41,6 +41,7 @@
import org.jboss.ws.core.binding.DeserializerSupport;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.TypeMappingImpl;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.w3c.dom.Comment;
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/CIDGenerator.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.attachment;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.ResourceBundle;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.utils.UUIDGenerator;
-
-/**
- * A common CID generator
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 17-Jan-2006
- */
-public class CIDGenerator
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(CIDGenerator.class);
- // provide logging
- private static Logger log = Logger.getLogger(CIDGenerator.class);
-
- private int count = 0;
-
- public String generateFromCount()
- {
- StringBuilder cid = new StringBuilder();
- long time = System.currentTimeMillis();
-
- cid.append(count++).append("-").append(time).append("-")
- .append(cid.hashCode()).append("(a)").append(MimeConstants.CID_DOMAIN);
-
- if(log.isDebugEnabled()) log.debug("generateFromCount: " + cid);
- return cid.toString();
- }
-
- public String generateFromName(String name)
- {
-
- // See
http://www.ietf.org/rfc/rfc2392.txt on rules howto create cid's
- // TODO: URL decode when cid's are received
- try
- {
- name = URLEncoder.encode(name, "UTF-8");
- }
- catch (UnsupportedEncodingException ex)
- {
- log.error(BundleUtils.getMessage(bundle, "CANNOT_ENCODE_NAME", ex));
- }
-
- String cid = name + "-" + UUIDGenerator.generateRandomUUIDString() +
"@" + MimeConstants.CID_DOMAIN;
- if(log.isDebugEnabled()) log.debug("generateFromName: " + cid);
- return cid;
- }
-}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -33,9 +33,10 @@
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.utils.CIDGenerator;
/**
* MultipartRelatedEncoder encodes a SOAPMessage
@@ -47,10 +48,10 @@
public abstract class MultipartRelatedEncoder
{
private static final ResourceBundle bundle =
BundleUtils.getBundle(MultipartRelatedEncoder.class);
- protected SOAPMessageImpl soapMessage;
+ protected SOAPMessage soapMessage;
protected MimeMultipart multipart;
- public MultipartRelatedEncoder(SOAPMessageImpl soapMessage) throws SOAPException
+ public MultipartRelatedEncoder(SOAPMessage soapMessage) throws SOAPException
{
this.soapMessage = soapMessage;
}
@@ -83,8 +84,7 @@
if (mimePart.getHeader(MimeConstants.CONTENT_ID) == null)
{
- CIDGenerator cidGenerator = soapMessage.getCidGenerator();
- mimePart.setHeader(MimeConstants.CONTENT_ID,
cidGenerator.generateFromCount());
+ mimePart.setHeader(MimeConstants.CONTENT_ID,
CIDGenerator.generateFromCount());
}
// TODO - Binary encoding is the most efficient, however, some transports (old
mail servers)
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -29,10 +29,9 @@
import javax.mail.internet.ParameterList;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPElementWriter;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.utils.SOAPElementWriter;
/**
* MultipartRelatedEncoder encodes a SOAPMessage
@@ -49,7 +48,7 @@
*
* @param soapMessage the SOAP message to be sent as a root part
*/
- public MultipartRelatedSwAEncoder(SOAPMessageImpl soapMessage) throws SOAPException
+ public MultipartRelatedSwAEncoder(SOAPMessage soapMessage) throws SOAPException
{
super(soapMessage);
}
@@ -70,7 +69,7 @@
* stream.
*/
SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, false);
+ String envStr = SOAPElementWriter.writeElement(soapEnv, false);
rootPart.setText(envStr, "UTF-8");
rootPart.setContentID(MimeConstants.ROOTPART_CID);
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/CIDGenerator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/CIDGenerator.java
(rev 0)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/CIDGenerator.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.utils;
+
+import org.jboss.ws.core.soap.attachment.MimeConstants;
+
+/**
+ * A common CID generator
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 17-Jan-2006
+ */
+public final class CIDGenerator
+{
+ private static int count = 0;
+
+ private CIDGenerator() {
+ // forbidden instantiation
+ }
+
+ public static synchronized String generateFromCount()
+ {
+ if (count == 1000) count = 0;
+ StringBuilder cid = new StringBuilder();
+ long time = System.currentTimeMillis();
+
+ cid.append(count++).append("-").append(time).append("-")
+ .append(cid.hashCode()).append("(a)").append(MimeConstants.CID_DOMAIN);
+
+ return cid.toString();
+ }
+}
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Message.properties
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Message.properties
(rev 0)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Message.properties 2012-04-13
03:51:36 UTC (rev 16157)
@@ -0,0 +1,2 @@
+UNSUPPORTED_ENCODING_STYLE=Unsupported encoding style: {0}
+UNSUPPORTED_STYLE=Unsupported style: {0}
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/MessageContextAssociation.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/MessageContextAssociation.java
(rev 0)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/MessageContextAssociation.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.utils;
+
+import java.util.Stack;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.DOMUtils;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.utils.ThreadLocalAssociation;
+
+/**
+ * A thread local association with the current message context
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Dec-2004
+ */
+public class MessageContextAssociation
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(MessageContextAssociation.class);
+
+ public static void pushMessageContext(CommonMessageContext msgContext)
+ {
+ if (log.isDebugEnabled())
+ log.debug("pushMessageContext: " + msgContext + " (Thread "
+ Thread.currentThread().getName() + ")");
+ Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
+ if (stack == null)
+ {
+ stack = new Stack<CommonMessageContext>();
+ ThreadLocalAssociation.localMsgContextAssoc().set(stack);
+ }
+ stack.push(msgContext);
+ }
+
+ public static CommonMessageContext peekMessageContext()
+ {
+ CommonMessageContext msgContext = null;
+ Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
+ if (stack != null && stack.isEmpty() == false)
+ {
+ msgContext = stack.peek();
+ }
+ return msgContext;
+ }
+
+ public static CommonMessageContext popMessageContext()
+ {
+ return popMessageContext(true);
+ }
+
+ public static CommonMessageContext popMessageContext(boolean clearDOMIfEmpty)
+ {
+ CommonMessageContext msgContext = null;
+ Stack<CommonMessageContext> stack =
ThreadLocalAssociation.localMsgContextAssoc().get();
+ if (stack != null && stack.isEmpty() == false)
+ {
+ msgContext = stack.pop();
+ if (stack.isEmpty() == true && clearDOMIfEmpty == true)
+ {
+ DOMUtils.clearThreadLocals();
+ }
+ }
+ if (log.isDebugEnabled())
+ log.debug("popMessageContext: " + msgContext + " (Thread " +
Thread.currentThread().getName() + ")");
+ return msgContext;
+ }
+
+}
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/SOAPElementWriter.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/SOAPElementWriter.java
(rev 0)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/SOAPElementWriter.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.utils;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.ResourceBundle;
+
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.common.DOMUtils;
+import org.jboss.ws.common.DOMWriter;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+
+/**
+ * Writes a SAAJ elements to an output stream.
+ *
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 4-Aug-2006
+ */
+public class SOAPElementWriter
+{
+ private static final ResourceBundle bundle =
BundleUtils.getBundle(SOAPElementWriter.class);
+
+ // Print writer
+ private PrintWriter out;
+ // True, if the XML declaration should be written
+ private boolean writeXMLDeclaration;
+ // Explicit character set encoding
+ private String charsetName;
+
+ public SOAPElementWriter(Writer w)
+ {
+ this.out = new PrintWriter(w);
+ }
+
+ public SOAPElementWriter(OutputStream stream)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // ignore, UTF-8 should be available
+ }
+ }
+
+ public SOAPElementWriter(OutputStream stream, String charsetName)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
+ this.charsetName = charsetName;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"UNSUPPORTED_ENCODING", charsetName));
+ }
+ }
+
+ /**
+ * Set wheter the XML declaration should be written.
+ * The default is false.
+ */
+ public SOAPElementWriter setWriteXMLDeclaration(boolean writeXMLDeclaration)
+ {
+ this.writeXMLDeclaration = writeXMLDeclaration;
+ return this;
+ }
+
+ /**
+ * Print a node with explicit prettyprinting.
+ * The defaults for all other DOMWriter properties apply.
+ */
+ public static String writeElement(SOAPElement element, boolean pretty)
+ {
+ if (element == null)
+ return null;
+
+ StringWriter strw = new StringWriter();
+ new SOAPElementWriter(strw).writeElement(element);
+ String xmlStr = strw.toString();
+
+ if (pretty)
+ {
+ // This is expensive. Make sure it only happens for debugging
+ try
+ {
+ // TODO: this unescapes sepcial chars, which might be quiet confusing
+ // but they are actually send escaped.
+ xmlStr = DOMWriter.printNode(DOMUtils.parse(xmlStr), true);
+ }
+ catch (IOException ex)
+ {
+ throw new WSException ("Cannot parse xml: " + xmlStr, ex);
+ }
+ }
+
+ return xmlStr;
+ }
+
+ public void writeElement(SOAPElement element)
+ {
+ writeElementInternal((SOAPElementImpl)element);
+ }
+
+ private void writeElementInternal(SOAPElementImpl element)
+ {
+ if (element != null)
+ {
+ try
+ {
+ if (writeXMLDeclaration == true && element instanceof SOAPEnvelope)
+ {
+ out.print("<?xml version='1.0'");
+ if (charsetName != null)
+ out.print(" encoding='" + charsetName +
"'");
+
+ out.println("?>");
+ writeXMLDeclaration = false;
+ }
+
+ element.writeElement(out);
+
+ out.flush();
+ }
+ catch (IOException ex)
+ {
+ throw new WSException(BundleUtils.getMessage(bundle,
"CANNOT_WRITE_SOAP_ELEMENT"), ex);
+ }
+ }
+ }
+}
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/SOAPUtils.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/SOAPUtils.java
(rev 0)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/SOAPUtils.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.utils;
+
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPFactoryImpl;
+
+/**
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ *
+ */
+public final class SOAPUtils {
+
+ private SOAPUtils() {
+ // forbidden instantiation
+ }
+
+ public static MessageFactory newSOAP11MessageFactory() {
+ return newMessageFactory(SOAPConstants.SOAP_1_1_PROTOCOL);
+ }
+
+ public static MessageFactory newSOAP12MessageFactory() {
+ return newMessageFactory(SOAPConstants.SOAP_1_2_PROTOCOL);
+ }
+
+ private static MessageFactory newMessageFactory(final String protocol) {
+ try {
+ return new MessageFactoryImpl(protocol);
+ } catch (final SOAPException ignore) {
+ return null;
+ }
+ // TODO: use standard SOAP API to create objects
+ //return MessageFactory.newInstance()
+ }
+
+ public static SOAPFactory newSOAP11Factory() {
+ return newSOAPFactory(SOAPConstants.SOAP_1_1_PROTOCOL);
+ }
+
+ public static SOAPFactory newSOAP12Factory() {
+ return newSOAPFactory(SOAPConstants.SOAP_1_2_PROTOCOL);
+ }
+
+ private static SOAPFactory newSOAPFactory(final String protocol) {
+ try {
+ return new SOAPFactoryImpl(protocol);
+ } catch (final SOAPException ignore) {
+ return null;
+ }
+ // TODO: use standard SOAP API to create objects
+ //return MessageFactory.newInstance()
+ }
+
+ public static boolean isFaultMessage(final SOAPMessage msg) {
+ try {
+ return msg.getSOAPBody().getFault() != null;
+ } catch (final Exception ignore) {
+ }
+ return false;
+ }
+
+}
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Style.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Style.java
(rev 0)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Style.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.utils;
+
+import java.util.ResourceBundle;
+
+import org.jboss.ws.api.util.BundleUtils;
+
+/** A type-safe enumeration for encoding style.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Oct-2004
+ */
+public class Style
+{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(Style.class);
+ private String style;
+
+ public static final Style RPC = new Style("rpc");
+ public static final Style DOCUMENT = new Style("document");
+
+ private Style(String style)
+ {
+ this.style = style;
+ }
+
+ public static Style getDefaultStyle()
+ {
+ return DOCUMENT;
+ }
+
+ public static Style valueOf(String style)
+ {
+ if (RPC.style.equals(style))
+ return RPC;
+ if (DOCUMENT.style.equals(style))
+ return DOCUMENT;
+
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"UNSUPPORTED_STYLE", style));
+ }
+
+ public String toString()
+ {
+ return style;
+ }
+}
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Use.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Use.java
(rev 0)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/utils/Use.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.utils;
+
+import java.util.ResourceBundle;
+
+import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.common.Constants;
+
+/** A type-safe enumeration for encoding use.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-Oct-2005
+ */
+public class Use
+{
+ private static final ResourceBundle bundle = BundleUtils.getBundle(Use.class);
+ private String use;
+
+ public static final Use LITERAL = new Use("literal");
+ public static final Use ENCODED = new Use("encoded");
+
+ private Use(String use)
+ {
+ this.use = use;
+ }
+
+ public static Use getDefaultUse()
+ {
+ return LITERAL;
+ }
+
+ public static Use valueOf(String encodingStyle)
+ {
+ if (Constants.URI_LITERAL_ENC.equals(encodingStyle) ||
LITERAL.use.equals(encodingStyle))
+ return LITERAL;
+ if (Constants.URI_SOAP11_ENC.equals(encodingStyle) ||
ENCODED.use.equals(encodingStyle))
+ return ENCODED;
+
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"UNSUPPORTED_ENCODING_STYLE", encodingStyle));
+ }
+
+ public String toURI()
+ {
+ String encURI = null;
+ if (this == LITERAL)
+ encURI = Constants.URI_LITERAL_ENC;
+ else if (this == ENCODED)
+ encURI = Constants.URI_SOAP11_ENC;
+ return encURI;
+ }
+
+ public String toString()
+ {
+ return use;
+ }
+}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -48,7 +48,7 @@
import org.jboss.ws.common.Constants;
import org.jboss.ws.common.ObjectNameFactory;
import org.jboss.ws.core.jaxrpc.UnqualifiedFaultException;
-import org.jboss.ws.core.soap.Use;
+import org.jboss.ws.core.soap.utils.Use;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -40,8 +40,8 @@
import org.jboss.ws.core.jaxrpc.EncodedTypeMapping;
import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
-import org.jboss.ws.core.soap.Style;
-import org.jboss.ws.core.soap.Use;
+import org.jboss.ws.core.soap.utils.Style;
+import org.jboss.ws.core.soap.utils.Use;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -44,8 +44,8 @@
import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.SOAPArraySerializerFactory;
-import org.jboss.ws.core.soap.Style;
-import org.jboss.ws.core.soap.Use;
+import org.jboss.ws.core.soap.utils.Style;
+import org.jboss.ws.core.soap.utils.Use;
import org.jboss.ws.metadata.accessor.AccessorFactory;
import org.jboss.ws.metadata.accessor.AccessorFactoryCreator;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -36,8 +36,8 @@
import org.jboss.ws.WSException;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.JavaUtils;
-import org.jboss.ws.core.soap.Style;
-import org.jboss.ws.core.soap.Use;
+import org.jboss.ws.core.soap.utils.Style;
+import org.jboss.ws.core.soap.utils.Use;
import org.w3c.dom.Element;
/**
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -42,7 +42,7 @@
import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.core.jaxrpc.binding.jbossxb.SchemaBindingBuilder;
-import org.jboss.ws.core.soap.Use;
+import org.jboss.ws.core.soap.utils.Use;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -81,7 +81,7 @@
import org.jboss.ws.common.DOMWriter;
import org.jboss.ws.common.utils.JBossWSEntityResolver;
import org.jboss.ws.common.utils.ResourceURL;
-import org.jboss.ws.core.soap.Style;
+import org.jboss.ws.core.soap.utils.Style;
import org.jboss.ws.metadata.wsdl.Extendable;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference;
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -54,7 +54,6 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.CommonSOAPFaultException;
-import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
@@ -64,9 +63,9 @@
import org.jboss.ws.core.server.ServletHeaderSource;
import org.jboss.ws.core.server.ServletRequestContext;
import org.jboss.ws.core.server.WSDLRequestHandler;
-import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
+import org.jboss.ws.core.soap.utils.SOAPUtils;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.wsf.spi.SPIProvider;
@@ -262,30 +261,27 @@
try
{
msgContext.setEndpointMetaData(sepMetaData);
- MessageAbstraction resMessage = processRequest(endpoint, headerSource,
invContext, inStream);
+ SOAPMessage resMessage = processRequest(endpoint, headerSource, invContext,
inStream);
CommonMessageContext reqMsgContext = msgContext;
boolean isFault = false;
- if (resMessage instanceof SOAPMessage)
- {
- SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
- if (part == null)
- throw new SOAPException(BundleUtils.getMessage(bundle,
"CANNOT_OBTAIN_SOAPPART"));
+ SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
+ if (part == null)
+ throw new SOAPException(BundleUtils.getMessage(bundle,
"CANNOT_OBTAIN_SOAPPART"));
- // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP
status code
- // if the response envelope is a Fault.
- //
- // Also, a one-way operation must show up as empty content, and can be
detected
- // by a null envelope.
- SOAPEnvelope soapEnv = part.getEnvelope();
- isFault = soapEnv != null && soapEnv.getBody().hasFault();
- if (isFault)
- {
- if (httpResponse != null)
- {
- httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
+ // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP
status code
+ // if the response envelope is a Fault.
+ //
+ // Also, a one-way operation must show up as empty content, and can be detected
+ // by a null envelope.
+ SOAPEnvelope soapEnv = part.getEnvelope();
+ isFault = soapEnv != null && soapEnv.getBody().hasFault();
+ if (isFault)
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
}
if (outStream != null)
@@ -312,7 +308,7 @@
private void sendResponse(Endpoint endpoint, OutputStream output, boolean isFault)
throws SOAPException, IOException
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
if (resMessage == null)
{
@@ -326,7 +322,7 @@
/**
* Handle a request to this web service endpoint
*/
- private MessageAbstraction processRequest(Endpoint ep, MimeHeaderSource headerSource,
InvocationContext reqContext, InputStream inputStream) throws BindingException
+ private SOAPMessage processRequest(Endpoint ep, MimeHeaderSource headerSource,
InvocationContext reqContext, InputStream inputStream) throws BindingException
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
@@ -352,13 +348,13 @@
MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() :
null);
- MessageAbstraction reqMessage;
+ SOAPMessage reqMessage;
msgFactory.setStyle(sepMetaData.getStyle());
- reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
+ reqMessage = msgFactory.createMessage(headers, inputStream);
// Associate current message with message context
- msgContext.setMessageAbstraction(reqMessage);
+ msgContext.setSOAPMessage(reqMessage);
// debug the incomming message
MessageTrace.traceMessage("Incoming Request Message", reqMessage);
@@ -375,7 +371,7 @@
msgContext = MessageContextAssociation.peekMessageContext();
// Get the response message
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ SOAPMessage resMessage = msgContext.getSOAPMessage();
if (resMessage != null)
postProcessResponse(headerSource, resMessage);
@@ -383,11 +379,11 @@
}
catch (Exception ex)
{
- MessageAbstraction resMessage =
MessageContextAssociation.peekMessageContext().getMessageAbstraction();
+ SOAPMessage resMessage =
MessageContextAssociation.peekMessageContext().getSOAPMessage();
// In case we have an exception before the invoker is called
// we create the fault message here.
- if (resMessage == null || resMessage.isFaultMessage() == false)
+ if (resMessage == null || SOAPUtils.isFaultMessage(resMessage) == false)
{
CommonBindingProvider bindingProvider = new
CommonBindingProvider(sepMetaData);
CommonBinding binding = bindingProvider.getCommonBinding();
@@ -403,10 +399,10 @@
{
try
{
- MessageAbstraction resMessage =
MessageContextAssociation.peekMessageContext().getMessageAbstraction();
+ SOAPMessage resMessage =
MessageContextAssociation.peekMessageContext().getSOAPMessage();
if (resMessage != null)
{
- if (resMessage.isFaultMessage())
+ if (SOAPUtils.isFaultMessage(resMessage))
{
processFaultMetrics(ep, beginProcessing);
}
@@ -453,12 +449,12 @@
/** Set response mime headers
*/
- private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction
resMessage)
+ private void postProcessResponse(MimeHeaderSource headerSource, SOAPMessage
resMessage)
{
try
{
// Set the outbound headers
- if (headerSource != null && resMessage instanceof SOAPMessage)
+ if (headerSource != null)
{
((SOAPMessage)resMessage).saveChanges();
headerSource.setMimeHeaders(resMessage.getMimeHeaders());
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -42,10 +42,10 @@
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.client.CallImpl;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.UnboundHeader;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.ws.common.DOMUtils;
@@ -185,7 +185,7 @@
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
epInv.initInputParams(new Object[]{"Hello World!"});
- SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv,
null);
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData,
epInv);
ByteArrayOutputStream outs = new ByteArrayOutputStream();
reqMessage.writeTo(outs);
@@ -211,7 +211,7 @@
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
epInv.initInputParams(new Object[]{"Hello World!", "IN header
message"});
- SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv,
null);
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData,
epInv);
ByteArrayOutputStream outs = new ByteArrayOutputStream();
reqMessage.writeTo(outs);
@@ -220,33 +220,6 @@
assertEquals(DOMUtils.parse(reqEnvelopeWithBoundHeader),
DOMUtils.parse(retString));
}
- /** Test binding of the request message with header
- */
- public void testBindRequestMessageWithUnboundHeader() throws Exception
- {
- CommonBindingProvider bindingProvider = new
CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING);
- CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
-
- // Add unbound header
- QName xmlName = new QName("http://somens", "String_2");
- UnboundHeader header = new UnboundHeader(xmlName, Constants.TYPE_LITERAL_STRING,
String.class, ParameterMode.IN);
- header.setHeaderValue("IN header message");
-
- Map headers = new HashMap();
- headers.put(xmlName, header);
-
- EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- epInv.initInputParams(new Object[]{"Hello World!"});
-
- SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv,
headers);
-
- ByteArrayOutputStream outs = new ByteArrayOutputStream();
- reqMessage.writeTo(outs);
-
- String retString = new String(outs.toByteArray());
- assertEquals(DOMUtils.parse(reqEnvelopeWithUnboundHeader),
DOMUtils.parse(retString));
- }
-
/** Test unbinding of the request message
*/
public void testUnbindRequestMessage() throws Exception
@@ -357,7 +330,7 @@
msgContext.setSOAPMessage(resMessage);
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- binding.unbindResponseMessage(opMetaData, resMessage, epInv, null);
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv);
assertEquals("Hello World!", epInv.getReturnValue());
}
@@ -385,7 +358,7 @@
opMetaData.addParameter(paramMetaData);
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- binding.unbindResponseMessage(opMetaData, resMessage, epInv, null);
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv);
assertEquals("Hello World!", epInv.getReturnValue());
Object headerValue = epInv.getResponseParamValue(xmlName);
@@ -394,34 +367,6 @@
/** Test unbinding of the response message with unbound header
*/
- public void testUnbindResponseMessageWithUnboundHeader() throws Exception
- {
- CommonBindingProvider bindingProvider = new
CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING);
- CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
-
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(resEnvelopeWithUnboundHeader.getBytes());
-
- MessageFactory factory = new MessageFactoryImpl();
- SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null,
inputStream);
-
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setSOAPMessage(resMessage);
-
- QName xmlName = new QName("http://somens", "OutHeader");
- UnboundHeader header = new UnboundHeader(xmlName, Constants.TYPE_LITERAL_STRING,
String.class, ParameterMode.OUT);
-
- Map headers = new HashMap();
- headers.put(xmlName, header);
-
- EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- binding.unbindResponseMessage(opMetaData, resMessage, epInv, headers);
- assertEquals("Hello World!", epInv.getReturnValue());
-
- assertEquals("OUT header message", header.getHeaderValue());
- }
-
- /** Test unbinding of the response message with unbound header
- */
public void testUnbindFaultResponse() throws Exception
{
CommonBindingProvider bindingProvider = new
CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING);
@@ -438,7 +383,7 @@
try
{
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- binding.unbindResponseMessage(opMetaData, resMessage, epInv, null);
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv);
fail("SOAPFaultException expected");
}
catch (SOAPFaultException faultEx)
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/MessageFactoryTestCase.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -39,7 +39,7 @@
import org.jboss.ws.common.Constants;
import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.Style;
+import org.jboss.ws.core.soap.utils.Style;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.ws.common.DOMUtils;
import org.jboss.ws.common.DOMWriter;
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPContentElementTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPContentElementTestCase.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPContentElementTestCase.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -37,8 +37,8 @@
import org.jboss.ws.core.soap.SOAPBodyImpl;
import org.jboss.ws.core.soap.SOAPContentElement;
import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.Style;
import org.jboss.ws.core.soap.XMLFragment;
+import org.jboss.ws.core.soap.utils.Style;
import org.jboss.wsf.test.JBossWSTest;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2012-04-11
16:10:32 UTC (rev 16156)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2012-04-13
03:51:36 UTC (rev 16157)
@@ -46,10 +46,10 @@
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.client.CallImpl;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.attachment.MimeConstants;
+import org.jboss.ws.core.soap.utils.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.wsf.test.JBossWSTest;
@@ -152,7 +152,7 @@
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
epInv.initInputParams(new Object[]{"Hello World!", "hi"});
- SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData,
epInv, null);
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData,
epInv);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
@@ -187,7 +187,7 @@
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
SOAPMessageImpl msg3 = (SOAPMessageImpl)new
MessageFactoryImpl().createMessage(headers, in);
- binding.unbindResponseMessage(opMetaData, msg3, epInv, null);
+ binding.unbindResponseMessage(opMetaData, msg3, epInv);
assertEquals("test", epInv.getReturnValue());
}