JBossWS SVN: r13249 - in common/trunk/src/main/java/org/jboss/wsf/common/injection: finders and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-10 08:36:59 -0500 (Wed, 10 Nov 2010)
New Revision: 13249
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/injection/InjectionException.java
common/trunk/src/main/java/org/jboss/wsf/common/injection/InjectionHelper.java
common/trunk/src/main/java/org/jboss/wsf/common/injection/PreDestroyHolder.java
common/trunk/src/main/java/org/jboss/wsf/common/injection/finders/AbstractPostConstructPreDestroyAnnotatedMethodFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/injection/resolvers/AbstractReferenceResolver.java
Log:
fixing whitespaces - this is never ending story :(
Modified: common/trunk/src/main/java/org/jboss/wsf/common/injection/InjectionException.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/injection/InjectionException.java 2010-11-10 13:32:53 UTC (rev 13248)
+++ common/trunk/src/main/java/org/jboss/wsf/common/injection/InjectionException.java 2010-11-10 13:36:59 UTC (rev 13249)
@@ -88,10 +88,10 @@
{
rethrow(null, reason);
}
-
+
/**
* Rethrows Injection exception that will wrap passed reason.
- *
+ *
* @param message custom message
* @param reason to wrap.
*/
Modified: common/trunk/src/main/java/org/jboss/wsf/common/injection/InjectionHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/injection/InjectionHelper.java 2010-11-10 13:32:53 UTC (rev 13248)
+++ common/trunk/src/main/java/org/jboss/wsf/common/injection/InjectionHelper.java 2010-11-10 13:36:59 UTC (rev 13249)
@@ -99,10 +99,10 @@
if (injections == null)
return;
-
+
if (ctx == null)
return;
-
+
// inject descriptor driven annotations
injectDescriptorAnnotatedAccessibleObjects(instance, injections, ctx);
@@ -264,7 +264,6 @@
throw new InjectionException(message);
}
}
-
}
}
@@ -415,7 +414,7 @@
return value;
}
-
+
/**
* Invokes method on object with specified arguments.
*
@@ -500,13 +499,13 @@
/**
* Returns default JNDI context.
- *
+ *
* @return default JNDI context
*/
private static Context getDefaultContext()
{
Context ctx = null;
-
+
try
{
ctx = new InitialContext();
@@ -516,7 +515,7 @@
final String message = "Cannot create default JNDI context";
InjectionException.rethrow(message, ne);
}
-
+
return ctx;
}
Modified: common/trunk/src/main/java/org/jboss/wsf/common/injection/PreDestroyHolder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/injection/PreDestroyHolder.java 2010-11-10 13:32:53 UTC (rev 13248)
+++ common/trunk/src/main/java/org/jboss/wsf/common/injection/PreDestroyHolder.java 2010-11-10 13:36:59 UTC (rev 13249)
@@ -28,6 +28,7 @@
*/
public final class PreDestroyHolder
{
+
private final Object object;
private final int hashCode;
Modified: common/trunk/src/main/java/org/jboss/wsf/common/injection/finders/AbstractPostConstructPreDestroyAnnotatedMethodFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/injection/finders/AbstractPostConstructPreDestroyAnnotatedMethodFinder.java 2010-11-10 13:32:53 UTC (rev 13248)
+++ common/trunk/src/main/java/org/jboss/wsf/common/injection/finders/AbstractPostConstructPreDestroyAnnotatedMethodFinder.java 2010-11-10 13:36:59 UTC (rev 13249)
@@ -28,7 +28,7 @@
import org.jboss.wsf.common.reflection.AnnotatedMethodFinder;
/**
- * Abstract @PostConstruct and @PreDestroy annotations method finder.
+ * Abstract @PostConstruct and @PreDestroy annotations method finder.
*
* @author <a href="mailto:richard.opalka@jboss.org">Richard Opalka</a>
*/
Modified: common/trunk/src/main/java/org/jboss/wsf/common/injection/resolvers/AbstractReferenceResolver.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/injection/resolvers/AbstractReferenceResolver.java 2010-11-10 13:32:53 UTC (rev 13248)
+++ common/trunk/src/main/java/org/jboss/wsf/common/injection/resolvers/AbstractReferenceResolver.java 2010-11-10 13:36:59 UTC (rev 13249)
@@ -31,7 +31,7 @@
/**
* This class adds support for notion of annotated fields and methods.
* It also ensures passed methods and fields are non null references
- * plus it implements some common logic that would otherwise be
+ * plus it implements some common logic that would otherwise be
* implemented in all subclasses. It is highly recommended that all
* reference resolvers extend this base class for high code reuse.
*
@@ -40,7 +40,7 @@
public abstract class AbstractReferenceResolver<A extends Annotation>
implements ReferenceResolver
{
-
+
/**
* Resolved annotation.
*/
13 years, 6 months
JBossWS SVN: r13248 - common/trunk/src/main/java/org/jboss/wsf/common/invocation.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-10 08:32:53 -0500 (Wed, 10 Nov 2010)
New Revision: 13248
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandler.java
common/trunk/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java
common/trunk/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXRPC.java
common/trunk/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java
common/trunk/src/main/java/org/jboss/wsf/common/invocation/WebServiceContextEJB.java
common/trunk/src/main/java/org/jboss/wsf/common/invocation/WebServiceContextJSE.java
Log:
fixing whitespaces - this is never ending story :(
Modified: common/trunk/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandler.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandler.java 2010-11-09 10:00:48 UTC (rev 13247)
+++ common/trunk/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandler.java 2010-11-10 13:32:53 UTC (rev 13248)
@@ -53,7 +53,7 @@
/**
* Creates invocation.
- *
+ *
* @return invocation instance
*/
public final Invocation createInvocation()
@@ -63,22 +63,22 @@
/**
* Initialization method.
- *
+ *
* @param endpoint endpoint
*/
public void init(final Endpoint endpoint)
{
// does nothing
}
-
+
public Context getJNDIContext(final Endpoint ep) throws NamingException
{
return null;
}
-
+
/**
* Returns implementation method that will be used for invocation.
- *
+ *
* @param implClass implementation endpoint class
* @param seiMethod SEI interface method used for method finding algorithm
* @return implementation method
Modified: common/trunk/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java 2010-11-09 10:00:48 UTC (rev 13247)
+++ common/trunk/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java 2010-11-10 13:32:53 UTC (rev 13248)
@@ -46,9 +46,9 @@
/**
* Retrieves endpoint implementation bean that will be used in invocation process.
- *
+ *
* This method does the following steps:
- *
+ *
* <ul>
* <li>tries to retrieve endpoint instance from invocation context,</li>
* <li>if endpoint instance is not found it's created and instantiated (lazy initialization)</li>
@@ -57,7 +57,7 @@
* (using {@link #onEndpointInstantiated(Endpoint, Invocation)} template method).
* </li>
* </ul>
- *
+ *
* @param endpoint to lookup implementation instance for
* @param invocation current invocation
* @return endpoint implementation
@@ -91,9 +91,9 @@
/**
* Invokes method on endpoint implementation.
- *
+ *
* This method does the following steps:
- *
+ *
* <ul>
* <li>lookups endpoint implementation method to be invoked,</li>
* <li>
@@ -106,7 +106,7 @@
* (using {@link #onAfterInvocation(Invocation)} template method).
* </li>
* </ul>
- *
+ *
* @param endpoint which method is going to be invoked
* @param invocation current invocation
* @throws Exception if any error occurs
@@ -146,7 +146,7 @@
/**
* Template method for notifying subclasses that endpoint instance have been instantiated.
- *
+ *
* @param endpoint instantiated endpoint
* @param invocation current invocation
* @throws Exception subclasses have to throw exception on any failure
@@ -158,7 +158,7 @@
/**
* Template method for notifying subclasses that endpoint method is going to be invoked.
- *
+ *
* @param invocation current invocation
* @throws Exception subclasses have to throw exception on any failure
*/
@@ -169,7 +169,7 @@
/**
* Template method for notifying subclasses that endpoint method invocation was completed.
- *
+ *
* @param invocation current invocation
* @throws Exception subclasses have to throw exception on any failure
*/
Modified: common/trunk/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXRPC.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXRPC.java 2010-11-09 10:00:48 UTC (rev 13247)
+++ common/trunk/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXRPC.java 2010-11-10 13:32:53 UTC (rev 13248)
@@ -48,7 +48,7 @@
* Calls {@link javax.xml.rpc.server.ServiceLifecycle#init(Object)}
* method on target bean if this bean implements
* {@link javax.xml.rpc.server.ServiceLifecycle} interface.
- *
+ *
* @param invocation current invocation
* @throws Exception if any error occurs
*/
@@ -70,7 +70,7 @@
* Calls {@link javax.xml.rpc.server.ServiceLifecycle#destroy()}
* method on target bean if this bean implements
* {@link javax.xml.rpc.server.ServiceLifecycle} interface.
- *
+ *
* @param invocation current invocation
* @throws Exception if any error occurs
*/
Modified: common/trunk/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java 2010-11-09 10:00:48 UTC (rev 13247)
+++ common/trunk/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java 2010-11-10 13:32:53 UTC (rev 13248)
@@ -64,7 +64,7 @@
/**
* Injects resources on target bean and calls post construct method.
* Finally it registers target bean for predestroy phase.
- *
+ *
* @param endpoint used for predestroy phase registration process
* @param invocation current invocation
*/
@@ -91,7 +91,7 @@
/**
* Injects webservice context on target bean.
- *
+ *
* @param invocation current invocation
*/
@Override
@@ -103,7 +103,7 @@
/**
* Cleanups injected webservice context on target bean.
- *
+ *
* @param invocation current invocation
*/
@Override
@@ -116,10 +116,10 @@
{
return (Context)new InitialContext().lookup(POJO_JNDI_PREFIX);
}
-
+
/**
* Returns WebServiceContext associated with this invocation.
- *
+ *
* @param invocation current invocation
* @return web service context or null if not available
*/
@@ -132,7 +132,7 @@
/**
* Returns endpoint instance associated with current invocation.
- *
+ *
* @param invocation current invocation
* @return target bean in invocation
*/
@@ -142,22 +142,22 @@
return invocationContext.getTargetBean();
}
-
+
private static final class ThreadLocalAwareWebServiceContext implements WebServiceContext
{
private static final ThreadLocalAwareWebServiceContext SINGLETON = new ThreadLocalAwareWebServiceContext();
private final ThreadLocal<WebServiceContext> contexts = new InheritableThreadLocal<WebServiceContext>();
-
+
private static ThreadLocalAwareWebServiceContext getInstance()
{
return SINGLETON;
}
-
+
private void setMessageContext(final WebServiceContext ctx)
{
this.contexts.set(ctx);
}
-
+
public EndpointReference getEndpointReference(Element... referenceParameters)
{
final WebServiceContext delegee = this.contexts.get();
@@ -188,4 +188,5 @@
return delegee == null ? false : delegee.isUserInRole(role);
}
}
+
}
Modified: common/trunk/src/main/java/org/jboss/wsf/common/invocation/WebServiceContextEJB.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/invocation/WebServiceContextEJB.java 2010-11-09 10:00:48 UTC (rev 13247)
+++ common/trunk/src/main/java/org/jboss/wsf/common/invocation/WebServiceContextEJB.java 2010-11-10 13:32:53 UTC (rev 13248)
@@ -30,12 +30,13 @@
/**
* EJB web service context which security related methods delegate to EJB container.
- *
+ *
* @author alessio.soldano(a)jboss.com
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class WebServiceContextEJB extends WebServiceContextDelegate
{
+
public WebServiceContextEJB(final WebServiceContext ctx)
{
super(ctx);
@@ -52,4 +53,5 @@
final EJBContext ejbContext = getAttachment(EJBContext.class);
return ejbContext.isCallerInRole(role);
}
+
}
Modified: common/trunk/src/main/java/org/jboss/wsf/common/invocation/WebServiceContextJSE.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/invocation/WebServiceContextJSE.java 2010-11-09 10:00:48 UTC (rev 13247)
+++ common/trunk/src/main/java/org/jboss/wsf/common/invocation/WebServiceContextJSE.java 2010-11-10 13:32:53 UTC (rev 13248)
@@ -31,18 +31,19 @@
/**
* JSE web service context which security related methods delegate to servlet container.
- *
+ *
* @author alessio.soldano(a)jboss.com
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public final class WebServiceContextJSE extends WebServiceContextDelegate
{
+
private final HttpServletRequest httpRequest;
-
+
public WebServiceContextJSE(final WebServiceContext ctx)
{
super(ctx);
-
+
if (ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST) == null)
throw new IllegalStateException("Cannot obtain HttpServletRequest from message context");
@@ -60,4 +61,5 @@
{
return this.httpRequest.isUserInRole(role);
}
+
}
13 years, 6 months
JBossWS SVN: r13247 - in stack/native/trunk/modules/core/src/main/java/org/jboss: ws/core/server and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-09 05:00:48 -0500 (Tue, 09 Nov 2010)
New Revision: 13247
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/server/ServiceEndpointInvoker.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
Log:
[JBWS-3155] implemented support for 'anonymous attachments'
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 2010-11-09 09:59:55 UTC (rev 13246)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2010-11-09 10:00:48 UTC (rev 13247)
@@ -23,6 +23,8 @@
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -344,14 +346,6 @@
{
AttachmentPart part = getAttachmentFromMessage(paramMetaData, reqMessage);
epInv.setRequestParamValue(xmlName, part);
-
- // Add the attachment to the standard property
- if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS)
- {
- DataHandler dataHandler = part.getDataHandler();
- Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
- attachments.put(part.getContentId(), dataHandler);
- }
}
else
{
@@ -393,6 +387,9 @@
}
}
+ // Add all attachments to the standard property
+ this.propagateAttachmentsToJAXWSMessageContext(reqMessage, msgContext);
+
return epInv;
}
catch (Exception e)
@@ -462,6 +459,8 @@
}
}
+ this.propagateAttachmentsFromJAXWSMessageContext(resMessage, msgContext);
+
// Add the return to the message
ParameterMetaData retMetaData = opMetaData.getReturnParameter();
if (retMetaData != null)
@@ -526,7 +525,7 @@
}
}
}
-
+
return resMessage;
}
catch (Exception e)
@@ -535,7 +534,32 @@
return null;
}
}
+
+ /**
+ * Propagates attachments from JAXWS message context to soap message.
+ *
+ * @param message soap message to bind attachments to
+ * @param msgContext message context to read attachments from
+ */
+ private void propagateAttachmentsFromJAXWSMessageContext(final SOAPMessage message, final CommonMessageContext msgContext)
+ {
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ @SuppressWarnings("unchecked")
+ final Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+ final Iterator<?> attachmentsIterator = attachments.keySet().iterator();
+ AttachmentPart part = null;
+ while (attachmentsIterator.hasNext())
+ {
+ final String contentId = (String)attachmentsIterator.next();
+ final DataHandler handler = attachments.get(contentId);
+ part = this.createAttachmentPart(contentId, handler);
+ ((SOAPMessageImpl)message).addAttachmentPart(part);
+ }
+ }
+ }
+
/** 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)
throws BindingException
@@ -622,14 +646,6 @@
{
AttachmentPart part = getAttachmentFromMessage(retMetaData, resMessage);
epInv.setReturnValue(part);
-
- // Add the attachment to the standard property
- if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS)
- {
- DataHandler dataHandler = part.getDataHandler();
- Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
- attachments.put(part.getContentId(), dataHandler);
- }
}
else
{
@@ -645,14 +661,6 @@
{
AttachmentPart part = getAttachmentFromMessage(paramMetaData, resMessage);
epInv.setResponseParamValue(xmlName, part);
-
- // Add the attachment to the standard property
- if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS)
- {
- DataHandler dataHandler = part.getDataHandler();
- Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
- attachments.put(part.getContentId(), dataHandler);
- }
}
else
{
@@ -661,13 +669,40 @@
epInv.setResponseParamValue(xmlName, value);
}
}
+
+ // Add all attachments to the standard property
+ this.propagateAttachmentsToJAXWSMessageContext(resMessage, msgContext);
}
catch (Exception e)
{
handleException(e);
}
}
+
+ /**
+ * Propagates all the attachments from SOAPMessage to JAXWS Message context standard property.
+ *
+ * @param message soap message to read attachments from
+ * @param msgContext to propagate attachments to
+ * @throws SOAPException if something went wrong
+ */
+ private void propagateAttachmentsToJAXWSMessageContext(final SOAPMessage message, final CommonMessageContext msgContext) throws SOAPException
+ {
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ final SOAPMessageImpl implMessage = (SOAPMessageImpl)message;
+ final Iterator<?> attachmentsIterator = implMessage.getAttachments();
+ final Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
+ AttachmentPart part = null;
+ while (attachmentsIterator.hasNext())
+ {
+ part = (AttachmentPart)attachmentsIterator.next();
+ attachments.put(part.getContentId(), part.getDataHandler()); // TODO: test on getDataHandler() == null?
+ }
+ }
+ }
+
public MessageAbstraction bindFaultMessage(Exception ex)
{
SOAPMessageImpl faultMessage = (SOAPMessageImpl)createFaultMessageFromException(ex);
@@ -747,6 +782,15 @@
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();
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 2010-11-09 09:59:55 UTC (rev 13246)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2010-11-09 10:00:48 UTC (rev 13247)
@@ -25,6 +25,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.HashMap;
+import java.util.Map;
import javax.activation.DataHandler;
import javax.xml.namespace.QName;
@@ -422,8 +423,19 @@
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext instanceof MessageContextJAXWS)
{
+ Map<String, DataHandler> outboundAttachments = (Map<String, DataHandler>)msgContext.get(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS);
+ Map<String, DataHandler> newAttachments = new HashMap<String, DataHandler>(); // to protect against attacks from endpoint
+
// Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
- msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
+ msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, newAttachments);
+
+ if (outboundAttachments != null)
+ {
+ for (final String key : outboundAttachments.keySet())
+ {
+ newAttachments.put(key, outboundAttachments.get(key));
+ }
+ }
}
}
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 2010-11-09 09:59:55 UTC (rev 13246)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2010-11-09 10:00:48 UTC (rev 13247)
@@ -272,6 +272,7 @@
msgContext = new SOAPMessageContextJAXWS();
msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, Boolean.valueOf(false));
msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
+ msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
}
13 years, 6 months
JBossWS SVN: r13246 - in stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client: transport and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-09 04:59:55 -0500 (Tue, 09 Nov 2010)
New Revision: 13246
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/transport/NettyClient.java
Log:
[JBWS-3084] implemented chunking customization feature on top of SAAJ
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 2010-11-09 09:48:24 UTC (rev 13245)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2010-11-09 09:59:55 UTC (rev 13246)
@@ -33,6 +33,7 @@
import org.jboss.logging.Logger;
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;
import org.jboss.ws.extensions.wsrm.transport.RMChannel;
import org.jboss.ws.extensions.wsrm.transport.RMMetadata;
@@ -118,6 +119,12 @@
{
targetAddress = endpoint.toString();
}
+ final String[] transferEncodingValue = reqMessage != null ? reqMessage.getMimeHeaders().getHeader("Transfer-Encoding") : null;
+ if (transferEncodingValue != null && "disabled".equals(transferEncodingValue[0]))
+ {
+ reqMessage.getMimeHeaders().removeHeader("Transfer-Encoding");
+ callProps.put(StubExt.PROPERTY_CHUNKED_ENCODING_SIZE, 0);
+ }
if (RMTransportHelper.isRMMessage(callProps))
{
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyClient.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyClient.java 2010-11-09 09:48:24 UTC (rev 13245)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyClient.java 2010-11-09 09:59:55 UTC (rev 13246)
@@ -354,22 +354,21 @@
if (sizeValue != null)
chunkSize = Integer.valueOf(sizeValue);
- //override using call props
- try
- {
- Object obj = callProps.get(StubExt.PROPERTY_CHUNKED_ENCODING_SIZE);
- if (obj != null) //explicit 0 value is required to disable chunked mode
- chunkSize = (Integer)obj;
- }
- catch (Exception e)
- {
- log.warn("Can't set chunk size from call properties, illegal value provided!");
- }
-
//fastinfoset always disable chunking
if (epMetaData.isFeatureEnabled(FastInfosetFeature.class))
chunkSize = 0;
}
+ //override using call props
+ try
+ {
+ Object obj = callProps.get(StubExt.PROPERTY_CHUNKED_ENCODING_SIZE);
+ if (obj != null) //explicit 0 value is required to disable chunked mode
+ chunkSize = (Integer)obj;
+ }
+ catch (Exception e)
+ {
+ log.warn("Can't set chunk size from call properties, illegal value provided!");
+ }
}
}
13 years, 6 months
JBossWS SVN: r13245 - in stack/cxf/trunk/modules/testsuite/cxf-tests/src/test: resources/saaj/jbws3084/WEB-INF/wsdl and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-09 04:48:24 -0500 (Tue, 09 Nov 2010)
New Revision: 13245
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
Log:
[JBWS-3084] refactoring - moving common part of the test to framework, CXF specific part remains in CXF code base
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java 2010-11-09 09:33:00 UTC (rev 13244)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java 2010-11-09 09:48:24 UTC (rev 13245)
@@ -51,16 +51,6 @@
return new JBossWSCXFTestSetup(JBWS3084TestCase.class, "saaj-soap-connection.war");
}
- public void testSoapConnectionPostWithoutChunkedEncoding() throws Exception
- {
- doTestSoapConnection(true);
- }
-
- public void testSoapConnectionPostWithChunkedEncoding() throws Exception
- {
- doTestSoapConnection(false);
- }
-
public void testSoapConnectionGet() throws Exception
{
final String serviceURL = "http://" + getServerHost() + ":8080/saaj-soap-connection/greetMe";
@@ -77,62 +67,4 @@
assertEquals(1, response.countAttachments());
}
-
- private void doTestSoapConnection(boolean disableChunking) throws Exception
- {
- SOAPFactory soapFac = SOAPFactory.newInstance();
- MessageFactory msgFac = MessageFactory.newInstance();
- SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
- SOAPMessage msg = msgFac.createMessage();
-
- if (disableChunking)
- {
- // this is the custom header checked by ServiceImpl
- msg.getMimeHeaders().addHeader("Transfer-Encoding-Disabled", "true");
- // this is a hint to SOAPConnection that the chunked encoding is not needed
- msg.getMimeHeaders().addHeader("Transfer-Encoding", "disabled");
- }
-
- QName sayHi = new QName("http://www.jboss.org/jbossws/saaj", "sayHello");
- msg.getSOAPBody().addChildElement(soapFac.createElement(sayHi));
- AttachmentPart ap1 = msg.createAttachmentPart();
-
- char[] content = new char[16 * 1024];
- Arrays.fill(content, 'A');
-
- ap1.setContent(new String(content), "text/plain");
- msg.addAttachmentPart(ap1);
-
- AttachmentPart ap2 = msg.createAttachmentPart();
- ap2.setContent("Attachment content - Part 2", "text/plain");
- msg.addAttachmentPart(ap2);
- msg.saveChanges();
-
- SOAPConnection con = conFac.createConnection();
-
- final String serviceURL = "http://" + getServerHost() + ":8080/saaj-soap-connection";
-
- URL endpoint = new URL(serviceURL);
- SOAPMessage response = con.call(msg, endpoint);
- QName sayHiResp = new QName("http://www.jboss.org/jbossws/saaj", "sayHelloResponse");
-
- Iterator<?> sayHiRespIterator = response.getSOAPBody().getChildElements(sayHiResp);
- SOAPElement soapElement = (SOAPElement) sayHiRespIterator.next();
- assertNotNull(soapElement);
-
- assertEquals(2, response.countAttachments());
-
- String[] values = response.getMimeHeaders().getHeader("Transfer-Encoding-Disabled");
- if (disableChunking)
- {
- // this means that the ServiceImpl executed the code branch verifying
- // that chunking was disabled
- assertNotNull(values);
- assertTrue(values.length == 1);
- }
- else
- {
- assertNull(values);
- }
- }
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java 2010-11-09 09:33:00 UTC (rev 13244)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java 2010-11-09 09:48:24 UTC (rev 13245)
@@ -28,8 +28,5 @@
public interface ServiceIface
{
@WebMethod
- String sayHello();
-
- @WebMethod
String greetMe();
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2010-11-09 09:33:00 UTC (rev 13244)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2010-11-09 09:48:24 UTC (rev 13245)
@@ -44,71 +44,6 @@
private WebServiceContext context;
@SuppressWarnings("unchecked")
- public String sayHello()
- {
- Map<String, List<String>> reqHeaders = (Map<String, List<String>>) context.getMessageContext().get(
- MessageContext.HTTP_REQUEST_HEADERS);
-
- boolean chunkedEncodingDisabled = reqHeaders.get("transfer-encoding-disabled") != null;
-
- List<String> transferEncHeader = reqHeaders.get("transfer-encoding");
-
- if (!chunkedEncodingDisabled)
- {
- if (transferEncHeader == null || transferEncHeader.size() != 1)
- {
- throw new RuntimeException("Transfer-Encoding is missing");
- }
- if (!"chunked".equals(transferEncHeader.get(0)))
- {
- throw new RuntimeException("Wrong Transfer-Encoding value");
- }
- }
- else
- {
- if (transferEncHeader != null)
- {
- throw new RuntimeException("Unexpected Transfer-Encoding header");
- }
- Map<String, List<String>> respHeaders = (Map<String, List<String>>) context.getMessageContext().get(
- MessageContext.HTTP_RESPONSE_HEADERS);
- if (respHeaders == null)
- {
- respHeaders = new HashMap<String, List<String>>();
- context.getMessageContext().put(MessageContext.HTTP_RESPONSE_HEADERS, respHeaders);
- }
- respHeaders.put("Transfer-Encoding-Disabled", Arrays.asList("true"));
- }
-
- Map<String, DataHandler> dataHandlers = (Map<String, DataHandler>) context.getMessageContext().get(
- MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
-
- Map<String, DataHandler> outDataHandlers = (Map<String, DataHandler>) context.getMessageContext().get(
- MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
-
- int index = 0;
- try
- {
- for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
- {
- InputStream is = entry.getValue().getInputStream();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copyStream(baos, is);
- String name = Integer.toString(index++);
- DataHandler handler = new DataHandler(new InputStreamDataSource(
- new ByteArrayInputStream(baos.toByteArray()), "text/plain", name));
- outDataHandlers.put(name, handler);
- }
- }
- catch (Exception ex)
- {
- throw new RuntimeException(ex);
- }
-
- return "Hello World!";
- }
-
- @SuppressWarnings("unchecked")
public String greetMe()
{
try
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl 2010-11-09 09:33:00 UTC (rev 13244)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl 2010-11-09 09:48:24 UTC (rev 13245)
@@ -1,76 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="SaajService" targetNamespace="http://www.jboss.org/jbossws/saaj" xmlns:tns="http://www.jboss.org/jbossws/saaj" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.jboss.org/jbossws/saaj" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://www.jboss.org/jbossws/saaj">
-<xsd:element name="sayHello" type="tns:sayHello"/>
-<xsd:complexType name="sayHello">
-<xsd:sequence/>
-</xsd:complexType>
-<xsd:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
-<xsd:complexType name="sayHelloResponse">
-<xsd:sequence>
-<xsd:element minOccurs="0" name="return" type="xsd:string"/>
-</xsd:sequence>
-</xsd:complexType>
-<xsd:element name="greetMe" type="tns:greetMe"/>
-<xsd:complexType name="greetMe">
-<xsd:sequence/>
-</xsd:complexType>
-<xsd:element name="greetMeResponse" type="tns:greetMeResponse"/>
-<xsd:complexType name="greetMeResponse">
-<xsd:sequence>
-<xsd:element minOccurs="0" name="return" type="xsd:string"/>
-</xsd:sequence>
-</xsd:complexType>
-
-</xsd:schema>
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.jboss.org/jbossws/saaj" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://www.jboss.org/jbossws/saaj">
+ <xsd:element name="greetMe" type="tns:greetMe"/>
+ <xsd:complexType name="greetMe">
+ <xsd:sequence/>
+ </xsd:complexType>
+ <xsd:element name="greetMeResponse" type="tns:greetMeResponse"/>
+ <xsd:complexType name="greetMeResponse">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="return" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
</wsdl:types>
- <wsdl:message name="sayHelloResponse">
- <wsdl:part name="parameters" element="tns:sayHelloResponse">
- </wsdl:part>
- </wsdl:message>
- <wsdl:message name="sayHello">
- <wsdl:part name="parameters" element="tns:sayHello">
- </wsdl:part>
- </wsdl:message>
<wsdl:message name="greetMeResponse">
- <wsdl:part name="parameters" element="tns:greetMeResponse">
- </wsdl:part>
+ <wsdl:part name="parameters" element="tns:greetMeResponse"/>
</wsdl:message>
+
<wsdl:message name="greetMe">
- <wsdl:part name="parameters" element="tns:greetMe">
- </wsdl:part>
+ <wsdl:part name="parameters" element="tns:greetMe"/>
</wsdl:message>
<wsdl:portType name="ServiceIface">
- <wsdl:operation name="sayHello">
- <wsdl:input name="sayHello" message="tns:sayHello">
- </wsdl:input>
- <wsdl:output name="sayHelloResponse" message="tns:sayHelloResponse">
- </wsdl:output>
- </wsdl:operation>
-
<wsdl:operation name="greetMe">
- <wsdl:input name="greetMe" message="tns:greetMe">
- </wsdl:input>
- <wsdl:output name="greetMeResponse" message="tns:greetMeResponse">
- </wsdl:output>
+ <wsdl:input name="greetMe" message="tns:greetMe"/>
+ <wsdl:output name="greetMeResponse" message="tns:greetMeResponse"/>
</wsdl:operation>
-
</wsdl:portType>
+
<wsdl:binding name="SaajServiceSoapBinding" type="tns:ServiceIface">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/wsdl/http/"/>
- <wsdl:operation name="sayHello">
- <soap:operation soapAction="" style="document"/>
- <wsdl:input name="sayHello">
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="sayHelloResponse">
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
<wsdl:operation name="greetMe">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="greetMe">
@@ -81,9 +43,11 @@
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
+
<wsdl:service name="SaajService">
<wsdl:port name="SaajServicePort" binding="tns:SaajServiceSoapBinding">
<soap:address location="http://localhost:8080/SaajService"/>
</wsdl:port>
</wsdl:service>
+
</wsdl:definitions>
13 years, 6 months
JBossWS SVN: r13244 - in framework/trunk/testsuite/test: java/org/jboss/test/ws and 7 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-09 04:33:00 -0500 (Tue, 09 Nov 2010)
New Revision: 13244
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/
framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/
framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
framework/trunk/testsuite/test/resources/saaj/
framework/trunk/testsuite/test/resources/saaj/jbws3084/
framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/
framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/web.xml
framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/
framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
Modified:
framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-3084] refactoring common part of the test to framework
Modified: framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2010-11-08 11:45:28 UTC (rev 13243)
+++ framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2010-11-09 09:33:00 UTC (rev 13244)
@@ -1053,6 +1053,20 @@
</classes>
</war>
+ <!-- saaj-jbws3084 -->
+ <war
+ warfile="${tests.output.dir}/test-libs/saaj-soap-connection.war"
+ webxml="${tests.output.dir}/test-resources/saaj/jbws3084/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/saaj/jbws3084/ServiceImpl.class"/>
+ <include name="org/jboss/test/ws/saaj/jbws3084/ServiceIface.class"/>
+ <include name="org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.class"/>
+ </classes>
+ <zipfileset
+ dir="${tests.output.dir}/test-resources/saaj/jbws3084/WEB-INF/wsdl"
+ prefix="WEB-INF/wsdl"/>
+ </war>
+
<!-- Please add alphabetically -->
</target>
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java 2010-11-09 09:33:00 UTC (rev 13244)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.saaj.jbws3084;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+public class InputStreamDataSource implements DataSource
+{
+ private InputStream is;
+
+ private String contentType;
+
+ private String name;
+
+ public InputStreamDataSource(InputStream is, String contentType, String name)
+ {
+ this.is = is;
+ this.contentType = contentType;
+ this.name = name;
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException
+ {
+ return is;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public OutputStream getOutputStream() throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java 2010-11-09 09:33:00 UTC (rev 13244)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.saaj.jbws3084;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPMessage;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBWS-3084] Enable control of chunked encoding when using SOAPConnection.
+ *
+ * @author sberyozk(a)redhat.com
+ */
+public class JBWS3084TestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS3084TestCase.class, "saaj-soap-connection.war");
+ }
+
+ public void testSoapConnectionPostWithoutChunkedEncoding() throws Exception
+ {
+ doTestSoapConnection(true);
+ }
+
+ public void testSoapConnectionPostWithChunkedEncoding() throws Exception
+ {
+ doTestSoapConnection(false);
+ }
+
+ private void doTestSoapConnection(boolean disableChunking) throws Exception
+ {
+ SOAPFactory soapFac = SOAPFactory.newInstance();
+ MessageFactory msgFac = MessageFactory.newInstance();
+ SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
+ SOAPMessage msg = msgFac.createMessage();
+
+ if (disableChunking)
+ {
+ // this is the custom header checked by ServiceImpl
+ msg.getMimeHeaders().addHeader("Transfer-Encoding-Disabled", "true");
+ // this is a hint to SOAPConnection that the chunked encoding is not needed
+ msg.getMimeHeaders().addHeader("Transfer-Encoding", "disabled");
+ }
+
+ QName sayHi = new QName("http://www.jboss.org/jbossws/saaj", "sayHello");
+ msg.getSOAPBody().addChildElement(soapFac.createElement(sayHi));
+ AttachmentPart ap1 = msg.createAttachmentPart();
+
+ char[] content = new char[16 * 1024];
+ Arrays.fill(content, 'A');
+
+ ap1.setContent(new String(content), "text/plain");
+ msg.addAttachmentPart(ap1);
+
+ AttachmentPart ap2 = msg.createAttachmentPart();
+ ap2.setContent("Attachment content - Part 2", "text/plain");
+ msg.addAttachmentPart(ap2);
+ msg.saveChanges();
+
+ SOAPConnection con = conFac.createConnection();
+
+ final String serviceURL = "http://" + getServerHost() + ":8080/saaj-soap-connection";
+
+ URL endpoint = new URL(serviceURL);
+ SOAPMessage response = con.call(msg, endpoint);
+ QName sayHiResp = new QName("http://www.jboss.org/jbossws/saaj", "sayHelloResponse");
+
+ Iterator<?> sayHiRespIterator = response.getSOAPBody().getChildElements(sayHiResp);
+ SOAPElement soapElement = (SOAPElement) sayHiRespIterator.next();
+ assertNotNull(soapElement);
+
+ assertEquals(2, response.countAttachments());
+
+ String[] values = response.getMimeHeaders().getHeader("Transfer-Encoding-Disabled");
+ if (disableChunking)
+ {
+ // this means that the ServiceImpl executed the code branch verifying
+ // that chunking was disabled
+ assertNotNull(values);
+ assertTrue(values.length == 1);
+ }
+ else
+ {
+ assertNull(values);
+ }
+ }
+}
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java 2010-11-09 09:33:00 UTC (rev 13244)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.saaj.jbws3084;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://www.jboss.org/jbossws/saaj")
+public interface ServiceIface
+{
+ @WebMethod
+ String sayHello();
+}
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2010-11-09 09:33:00 UTC (rev 13244)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.saaj.jbws3084;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.wsf.common.IOUtils;
+
+@WebService(portName = "SaajServicePort", serviceName = "SaajService", wsdlLocation = "WEB-INF/wsdl/SaajService.wsdl", targetNamespace = "http://www.jboss.org/jbossws/saaj", endpointInterface = "org.jboss.test.ws.saaj.jbws3084.ServiceIface")
+public class ServiceImpl implements ServiceIface
+{
+ @Resource
+ private WebServiceContext context;
+
+ @SuppressWarnings("unchecked")
+ public String sayHello()
+ {
+ Map<String, List<String>> reqHeaders = (Map<String, List<String>>) context.getMessageContext().get(
+ MessageContext.HTTP_REQUEST_HEADERS);
+
+ boolean chunkedEncodingDisabled = reqHeaders.get("transfer-encoding-disabled") != null;
+
+ List<String> transferEncHeader = reqHeaders.get("transfer-encoding");
+
+ if (!chunkedEncodingDisabled)
+ {
+ if (transferEncHeader == null || transferEncHeader.size() != 1)
+ {
+ throw new RuntimeException("Transfer-Encoding is missing");
+ }
+ if (!"chunked".equals(transferEncHeader.get(0)))
+ {
+ throw new RuntimeException("Wrong Transfer-Encoding value");
+ }
+ }
+ else
+ {
+ if (transferEncHeader != null)
+ {
+ throw new RuntimeException("Unexpected Transfer-Encoding header");
+ }
+ Map<String, List<String>> respHeaders = (Map<String, List<String>>) context.getMessageContext().get(
+ MessageContext.HTTP_RESPONSE_HEADERS);
+ if (respHeaders == null)
+ {
+ respHeaders = new HashMap<String, List<String>>();
+ context.getMessageContext().put(MessageContext.HTTP_RESPONSE_HEADERS, respHeaders);
+ }
+ respHeaders.put("Transfer-Encoding-Disabled", Arrays.asList("true"));
+ }
+
+ Map<String, DataHandler> dataHandlers = (Map<String, DataHandler>) context.getMessageContext().get(
+ MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
+
+ Map<String, DataHandler> outDataHandlers = (Map<String, DataHandler>) context.getMessageContext().get(
+ MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+
+ int index = 0;
+ try
+ {
+ for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
+ {
+ InputStream is = entry.getValue().getInputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ IOUtils.copyStream(baos, is);
+ String name = Integer.toString(index++);
+ DataHandler handler = new DataHandler(new InputStreamDataSource(
+ new ByteArrayInputStream(baos.toByteArray()), "text/plain", name));
+ outDataHandlers.put(name, handler);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ return "Hello World!";
+ }
+}
Added: framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/web.xml
===================================================================
--- framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/web.xml (rev 0)
+++ framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/web.xml 2010-11-09 09:33:00 UTC (rev 13244)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
+ version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <servlet>
+ <servlet-name>SaajService</servlet-name>
+ <servlet-class>org.jboss.test.ws.saaj.jbws3084.ServiceImpl</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>SaajService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
===================================================================
--- framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl (rev 0)
+++ framework/trunk/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl 2010-11-09 09:33:00 UTC (rev 13244)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="SaajService" targetNamespace="http://www.jboss.org/jbossws/saaj" xmlns:tns="http://www.jboss.org/jbossws/saaj" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.jboss.org/jbossws/saaj" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://www.jboss.org/jbossws/saaj">
+ <xsd:element name="sayHello" type="tns:sayHello"/>
+ <xsd:complexType name="sayHello">
+ <xsd:sequence/>
+ </xsd:complexType>
+ <xsd:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
+ <xsd:complexType name="sayHelloResponse">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="return" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+
+ </wsdl:types>
+
+ <wsdl:message name="sayHelloResponse">
+ <wsdl:part name="parameters" element="tns:sayHelloResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="sayHello">
+ <wsdl:part name="parameters" element="tns:sayHello">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:portType name="ServiceIface">
+ <wsdl:operation name="sayHello">
+ <wsdl:input name="sayHello" message="tns:sayHello"/>
+ <wsdl:output name="sayHelloResponse" message="tns:sayHelloResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="SaajServiceSoapBinding" type="tns:ServiceIface">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/wsdl/http/"/>
+ <wsdl:operation name="sayHello">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHello">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHelloResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="SaajService">
+ <wsdl:port name="SaajServicePort" binding="tns:SaajServiceSoapBinding">
+ <soap:address location="http://localhost:8080/SaajService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
13 years, 6 months
JBossWS SVN: r13243 - stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-08 06:45:28 -0500 (Mon, 08 Nov 2010)
New Revision: 13243
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
Log:
[JBWS-3084] refactoring - removing dependencies on Apache CXF proprietary API
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2010-11-08 11:34:20 UTC (rev 13242)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2010-11-08 11:45:28 UTC (rev 13243)
@@ -22,6 +22,7 @@
package org.jboss.test.ws.saaj.jbws3084;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
@@ -34,9 +35,7 @@
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
+import org.jboss.wsf.common.IOUtils;
@WebService(portName = "SaajServicePort", serviceName = "SaajService", wsdlLocation = "WEB-INF/wsdl/SaajService.wsdl", targetNamespace = "http://www.jboss.org/jbossws/saaj", endpointInterface = "org.jboss.test.ws.saaj.jbws3084.ServiceIface")
public class ServiceImpl implements ServiceIface
@@ -44,10 +43,11 @@
@Resource
private WebServiceContext context;
+ @SuppressWarnings("unchecked")
public String sayHello()
{
- Map<String, List<String>> reqHeaders = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
- MessageContext.HTTP_REQUEST_HEADERS));
+ Map<String, List<String>> reqHeaders = (Map<String, List<String>>) context.getMessageContext().get(
+ MessageContext.HTTP_REQUEST_HEADERS);
boolean chunkedEncodingDisabled = reqHeaders.get("transfer-encoding-disabled") != null;
@@ -70,8 +70,8 @@
{
throw new RuntimeException("Unexpected Transfer-Encoding header");
}
- Map<String, List<String>> respHeaders = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
- MessageContext.HTTP_RESPONSE_HEADERS));
+ Map<String, List<String>> respHeaders = (Map<String, List<String>>) context.getMessageContext().get(
+ MessageContext.HTTP_RESPONSE_HEADERS);
if (respHeaders == null)
{
respHeaders = new HashMap<String, List<String>>();
@@ -80,11 +80,11 @@
respHeaders.put("Transfer-Encoding-Disabled", Arrays.asList("true"));
}
- Map<String, DataHandler> dataHandlers = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
- MessageContext.INBOUND_MESSAGE_ATTACHMENTS));
+ Map<String, DataHandler> dataHandlers = (Map<String, DataHandler>) context.getMessageContext().get(
+ MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
- Map<String, DataHandler> outDataHandlers = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
- MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
+ Map<String, DataHandler> outDataHandlers = (Map<String, DataHandler>) context.getMessageContext().get(
+ MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
int index = 0;
try
@@ -92,11 +92,11 @@
for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
{
InputStream is = entry.getValue().getInputStream();
- LoadingByteArrayOutputStream bous = new LoadingByteArrayOutputStream();
- IOUtils.copy(is, bous);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ IOUtils.copyStream(baos, is);
String name = Integer.toString(index++);
- DataHandler handler = new DataHandler(new InputStreamDataSource(bous.createInputStream(), "text/plain",
- name));
+ DataHandler handler = new DataHandler(new InputStreamDataSource(
+ new ByteArrayInputStream(baos.toByteArray()), "text/plain", name));
outDataHandlers.put(name, handler);
}
}
@@ -108,12 +108,13 @@
return "Hello World!";
}
+ @SuppressWarnings("unchecked")
public String greetMe()
{
try
{
- Map<String, DataHandler> outDataHandlers = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
- MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
+ Map<String, DataHandler> outDataHandlers = (Map<String, DataHandler>) context.getMessageContext().get(
+ MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
final char[] content = new char[16 * 1024];
Arrays.fill(content, 'A');
13 years, 6 months
JBossWS SVN: r13242 - in stack/cxf/trunk/modules/testsuite/cxf-tests: src/test/java/org/jboss/test/ws/saaj and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-08 06:34:20 -0500 (Mon, 08 Nov 2010)
New Revision: 13242
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/web.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
Removed:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/InputStreamDataSource.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/SOAPConnectionTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/ServiceIface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/ServiceImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/cxf/
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
Log:
[JBWS-3084] refactoring test case
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2010-11-08 04:34:47 UTC (rev 13241)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2010-11-08 11:34:20 UTC (rev 13242)
@@ -51,7 +51,7 @@
<include name="org/jboss/test/ws/jaxws/cxf/endorse/Helper.class"/>
</classes>
</war>
-
+
<!-- jaxws-cxf-gzip -->
<jar destfile="${tests.output.dir}/test-libs/jaxws-cxf-gzip.jar">
<fileset dir="${tests.output.dir}/test-classes">
@@ -70,7 +70,7 @@
<include name="**/*" />
</metainf>
</jar>
-
+
<!-- jaxws-cxf-jbws3060 -->
<jar destfile="${tests.output.dir}/test-libs/jaxws-cxf-jbws3060.jar">
<fileset dir="${tests.output.dir}/test-classes">
@@ -98,11 +98,11 @@
<!-- jaxws-cxf-management -->
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-management.war" webxml="${tests.output.dir}/test-resources/jaxws/cxf/management/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/cxf/management/HelloWorldImpl.class" />
- <include name="org/jboss/test/ws/jaxws/cxf/management/HelloWorld.class"/>
- </classes>
+ <include name="org/jboss/test/ws/jaxws/cxf/management/HelloWorldImpl.class" />
+ <include name="org/jboss/test/ws/jaxws/cxf/management/HelloWorld.class"/>
+ </classes>
</war>
-
+
<!-- jaxws-samples-mtom -->
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-mtom.war"
@@ -115,7 +115,7 @@
dir="${tests.output.dir}/test-resources/jaxws/samples/mtom/WEB-INF/wsdl"
prefix="WEB-INF/wsdl"/>
</war>
-
+
<!-- jaxws-samples-wsa -->
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-wsa.war"
@@ -137,25 +137,23 @@
dir="${tests.output.dir}/test-resources/jaxws/samples/wsrm/WEB-INF/wsdl"
prefix="WEB-INF/wsdl"/>
</war>
-
+
<!-- saaj-soap-connection -->
<war
warfile="${tests.output.dir}/test-libs/saaj-soap-connection.war"
- webxml="${tests.output.dir}/test-resources/saaj/cxf/WEB-INF/web.xml">
+ webxml="${tests.output.dir}/test-resources/saaj/jbws3084/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/saaj/ServiceImpl.class"/>
- <include name="org/jboss/test/ws/saaj/ServiceIface.class"/>
- <include name="org/jboss/test/ws/saaj/InputStreamDataSource.class"/>
+ <include name="org/jboss/test/ws/saaj/jbws3084/ServiceImpl.class"/>
+ <include name="org/jboss/test/ws/saaj/jbws3084/ServiceIface.class"/>
+ <include name="org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.class"/>
</classes>
<zipfileset
- dir="${tests.output.dir}/test-resources/saaj/cxf/WEB-INF/wsdl"
+ dir="${tests.output.dir}/test-resources/saaj/jbws3084/WEB-INF/wsdl"
prefix="WEB-INF/wsdl"/>
</war>
-
<!-- Please add alphabetically -->
-
</target>
</project>
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/InputStreamDataSource.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/InputStreamDataSource.java 2010-11-08 04:34:47 UTC (rev 13241)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/InputStreamDataSource.java 2010-11-08 11:34:20 UTC (rev 13242)
@@ -1,44 +0,0 @@
-package org.jboss.test.ws.saaj;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.activation.DataSource;
-
-public class InputStreamDataSource implements DataSource
-{
-
- private InputStream is;
- private String contentType;
- private String name;
-
- public InputStreamDataSource(InputStream is, String contentType, String name)
- {
- this.is = is;
- this.contentType = contentType;
- this.name = name;
- }
- @Override
- public String getContentType()
- {
- return contentType;
- }
-
- @Override
- public InputStream getInputStream() throws IOException
- {
- return is;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public OutputStream getOutputStream() throws IOException {
- throw new UnsupportedOperationException();
- }
-
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/SOAPConnectionTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/SOAPConnectionTestCase.java 2010-11-08 04:34:47 UTC (rev 13241)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/SOAPConnectionTestCase.java 2010-11-08 11:34:20 UTC (rev 13242)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.test.ws.saaj;
-
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPFactory;
-import javax.xml.soap.SOAPMessage;
-
-import junit.framework.Test;
-
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-
-/**
- *
- * @author sberyozk(a)redhat.com
- *
- */
-public class SOAPConnectionTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(SOAPConnectionTestCase.class, "saaj-soap-connection.war");
- }
-
- public void testSoapConnectionPostWithoutChunkedEncoding() throws Exception
- {
- doTestSoapConnection(true);
- }
-
- public void testSoapConnectionPostWithChunkedEncoding() throws Exception
- {
- doTestSoapConnection(false);
- }
-
- public void testSoapConnectionGet() throws Exception
- {
- final String serviceURL = "http://" + getServerHost() + ":8080/saaj-soap-connection/greetMe";
- SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
-
- SOAPConnection con = conFac.createConnection();
- URL endpoint = new URL(serviceURL);
- SOAPMessage response = con.get(endpoint);
- QName greetMeResp = new QName("http://www.jboss.org/jbossws/saaj", "greetMeResponse");
-
- Iterator<?> sayHiRespIterator = response.getSOAPBody().getChildElements(greetMeResp);
- SOAPElement soapElement = (SOAPElement)sayHiRespIterator.next();
- assertNotNull(soapElement);
-
- assertEquals(1, response.countAttachments());
- }
-
- private void doTestSoapConnection(boolean disableChunking) throws Exception
- {
- SOAPFactory soapFac = SOAPFactory.newInstance();
- MessageFactory msgFac = MessageFactory.newInstance();
- SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
- SOAPMessage msg = msgFac.createMessage();
-
- if (disableChunking)
- {
- // this is the custom header checked by ServiceImpl
- msg.getMimeHeaders().addHeader("Transfer-Encoding-Disabled", "true");
- // this is a hint to SOAPConnection that the chunked encoding is not needed
- msg.getMimeHeaders().addHeader("Transfer-Encoding", "disabled");
- }
-
- QName sayHi = new QName("http://www.jboss.org/jbossws/saaj", "sayHello");
- msg.getSOAPBody().addChildElement(soapFac.createElement(sayHi));
- AttachmentPart ap1 = msg.createAttachmentPart();
-
- char[] content = new char[16 * 1024];
- Arrays.fill(content, 'A');
-
- ap1.setContent(new String(content), "text/plain");
- msg.addAttachmentPart(ap1);
-
- AttachmentPart ap2 = msg.createAttachmentPart();
- ap2.setContent("Attachment content - Part 2", "text/plain");
- msg.addAttachmentPart(ap2);
- msg.saveChanges();
-
- SOAPConnection con = conFac.createConnection();
-
- final String serviceURL = "http://" + getServerHost() + ":8080/saaj-soap-connection";
-
- URL endpoint = new URL(serviceURL);
- SOAPMessage response = con.call(msg, endpoint);
- QName sayHiResp = new QName("http://www.jboss.org/jbossws/saaj", "sayHelloResponse");
-
- Iterator<?> sayHiRespIterator = response.getSOAPBody().getChildElements(sayHiResp);
- SOAPElement soapElement = (SOAPElement)sayHiRespIterator.next();
- assertNotNull(soapElement);
-
- assertEquals(2, response.countAttachments());
-
- String[] values = response.getMimeHeaders().getHeader("Transfer-Encoding-Disabled");
- if (disableChunking)
- {
- // this means that the ServiceImpl executed the code branch verifying
- // that chunking was disabled
- assertNotNull(values);
- assertTrue(values.length == 1);
- }
- else
- {
- assertNull(values);
- }
- }
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/ServiceIface.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/ServiceIface.java 2010-11-08 04:34:47 UTC (rev 13241)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/ServiceIface.java 2010-11-08 11:34:20 UTC (rev 13242)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.test.ws.saaj;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-
-@WebService
-(
- targetNamespace = "http://www.jboss.org/jbossws/saaj"
-)
-public interface ServiceIface
-{
- @WebMethod
- String sayHello();
-
- @WebMethod
- String greetMe();
-}
Deleted: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/ServiceImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/ServiceImpl.java 2010-11-08 04:34:47 UTC (rev 13241)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/ServiceImpl.java 2010-11-08 11:34:20 UTC (rev 13242)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.test.ws.saaj;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.activation.DataHandler;
-import javax.annotation.Resource;
-import javax.jws.WebService;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
-
-@WebService
-(
- portName = "SaajServicePort",
- serviceName = "SaajService",
- wsdlLocation = "WEB-INF/wsdl/SaajService.wsdl",
- targetNamespace = "http://www.jboss.org/jbossws/saaj",
- endpointInterface = "org.jboss.test.ws.saaj.ServiceIface"
-)
-public class ServiceImpl implements ServiceIface
-{
- @Resource
- private WebServiceContext context;
-
- public String sayHello()
- {
- Map<String, List<String>> reqHeaders = CastUtils.cast(
- (Map<?, ?>)context.getMessageContext().get(MessageContext.HTTP_REQUEST_HEADERS));
-
- boolean chunkedEncodingDisabled = reqHeaders.get("transfer-encoding-disabled") != null;
-
- List<String> transferEncHeader = reqHeaders.get("transfer-encoding");
-
- if (!chunkedEncodingDisabled)
- {
- if (transferEncHeader == null || transferEncHeader.size() != 1)
- {
- throw new RuntimeException("Transfer-Encoding is missing");
- }
- if (!"chunked".equals(transferEncHeader.get(0)))
- {
- throw new RuntimeException("Wrong Transfer-Encoding value");
- }
- }
- else
- {
- if (transferEncHeader != null)
- {
- throw new RuntimeException("Unexpected Transfer-Encoding header");
- }
- Map<String, List<String>> respHeaders = CastUtils.cast(
- (Map<?, ?>)context.getMessageContext().get(MessageContext.HTTP_RESPONSE_HEADERS));
- if (respHeaders == null) {
- respHeaders = new HashMap<String, List<String>>();
- context.getMessageContext().put(MessageContext.HTTP_RESPONSE_HEADERS, respHeaders);
- }
- respHeaders.put("Transfer-Encoding-Disabled", Arrays.asList("true"));
- }
-
- Map<String, DataHandler> dataHandlers = CastUtils.cast(
- (Map<?, ?>)context.getMessageContext().get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS));
-
- Map<String, DataHandler> outDataHandlers = CastUtils.cast(
- (Map<?, ?>)context.getMessageContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
-
- int index = 0;
- try
- {
- for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
- {
- InputStream is = entry.getValue().getInputStream();
- LoadingByteArrayOutputStream bous = new LoadingByteArrayOutputStream();
- IOUtils.copy(is, bous);
- String name = Integer.toString(index++);
- DataHandler handler = new DataHandler(
- new InputStreamDataSource(bous.createInputStream(), "text/plain", name));
- outDataHandlers.put(name, handler);
- }
- }
- catch (Exception ex)
- {
- throw new RuntimeException(ex);
- }
-
- return "Hello World!";
- }
-
- public String greetMe()
- {
- try
- {
- Map<String, DataHandler> outDataHandlers = CastUtils.cast(
- (Map<?, ?>)context.getMessageContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
-
- final char[] content = new char[16 * 1024];
- Arrays.fill(content, 'A');
-
- DataHandler handler = new DataHandler(
- new InputStreamDataSource(new ByteArrayInputStream(new String(content).getBytes()),
- "text/plain", "1"));
- outDataHandlers.put("1", handler);
-
- }
- catch (Exception ex)
- {
- throw new RuntimeException(ex);
- }
-
- return "Greetings";
- }
-
-}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java 2010-11-08 11:34:20 UTC (rev 13242)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.saaj.jbws3084;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+public class InputStreamDataSource implements DataSource
+{
+ private InputStream is;
+
+ private String contentType;
+
+ private String name;
+
+ public InputStreamDataSource(InputStream is, String contentType, String name)
+ {
+ this.is = is;
+ this.contentType = contentType;
+ this.name = name;
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException
+ {
+ return is;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public OutputStream getOutputStream() throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java 2010-11-08 11:34:20 UTC (rev 13242)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.saaj.jbws3084;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPMessage;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+
+/**
+ * [JBWS-3084] Enable control of chunked encoding when using SOAPConnection.
+ *
+ * @author sberyozk(a)redhat.com
+ */
+public class JBWS3084TestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSCXFTestSetup(JBWS3084TestCase.class, "saaj-soap-connection.war");
+ }
+
+ public void testSoapConnectionPostWithoutChunkedEncoding() throws Exception
+ {
+ doTestSoapConnection(true);
+ }
+
+ public void testSoapConnectionPostWithChunkedEncoding() throws Exception
+ {
+ doTestSoapConnection(false);
+ }
+
+ public void testSoapConnectionGet() throws Exception
+ {
+ final String serviceURL = "http://" + getServerHost() + ":8080/saaj-soap-connection/greetMe";
+ SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
+
+ SOAPConnection con = conFac.createConnection();
+ URL endpoint = new URL(serviceURL);
+ SOAPMessage response = con.get(endpoint);
+ QName greetMeResp = new QName("http://www.jboss.org/jbossws/saaj", "greetMeResponse");
+
+ Iterator<?> sayHiRespIterator = response.getSOAPBody().getChildElements(greetMeResp);
+ SOAPElement soapElement = (SOAPElement) sayHiRespIterator.next();
+ assertNotNull(soapElement);
+
+ assertEquals(1, response.countAttachments());
+ }
+
+ private void doTestSoapConnection(boolean disableChunking) throws Exception
+ {
+ SOAPFactory soapFac = SOAPFactory.newInstance();
+ MessageFactory msgFac = MessageFactory.newInstance();
+ SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
+ SOAPMessage msg = msgFac.createMessage();
+
+ if (disableChunking)
+ {
+ // this is the custom header checked by ServiceImpl
+ msg.getMimeHeaders().addHeader("Transfer-Encoding-Disabled", "true");
+ // this is a hint to SOAPConnection that the chunked encoding is not needed
+ msg.getMimeHeaders().addHeader("Transfer-Encoding", "disabled");
+ }
+
+ QName sayHi = new QName("http://www.jboss.org/jbossws/saaj", "sayHello");
+ msg.getSOAPBody().addChildElement(soapFac.createElement(sayHi));
+ AttachmentPart ap1 = msg.createAttachmentPart();
+
+ char[] content = new char[16 * 1024];
+ Arrays.fill(content, 'A');
+
+ ap1.setContent(new String(content), "text/plain");
+ msg.addAttachmentPart(ap1);
+
+ AttachmentPart ap2 = msg.createAttachmentPart();
+ ap2.setContent("Attachment content - Part 2", "text/plain");
+ msg.addAttachmentPart(ap2);
+ msg.saveChanges();
+
+ SOAPConnection con = conFac.createConnection();
+
+ final String serviceURL = "http://" + getServerHost() + ":8080/saaj-soap-connection";
+
+ URL endpoint = new URL(serviceURL);
+ SOAPMessage response = con.call(msg, endpoint);
+ QName sayHiResp = new QName("http://www.jboss.org/jbossws/saaj", "sayHelloResponse");
+
+ Iterator<?> sayHiRespIterator = response.getSOAPBody().getChildElements(sayHiResp);
+ SOAPElement soapElement = (SOAPElement) sayHiRespIterator.next();
+ assertNotNull(soapElement);
+
+ assertEquals(2, response.countAttachments());
+
+ String[] values = response.getMimeHeaders().getHeader("Transfer-Encoding-Disabled");
+ if (disableChunking)
+ {
+ // this means that the ServiceImpl executed the code branch verifying
+ // that chunking was disabled
+ assertNotNull(values);
+ assertTrue(values.length == 1);
+ }
+ else
+ {
+ assertNull(values);
+ }
+ }
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java 2010-11-08 11:34:20 UTC (rev 13242)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.saaj.jbws3084;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://www.jboss.org/jbossws/saaj")
+public interface ServiceIface
+{
+ @WebMethod
+ String sayHello();
+
+ @WebMethod
+ String greetMe();
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2010-11-08 11:34:20 UTC (rev 13242)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.test.ws.saaj.jbws3084;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
+
+@WebService(portName = "SaajServicePort", serviceName = "SaajService", wsdlLocation = "WEB-INF/wsdl/SaajService.wsdl", targetNamespace = "http://www.jboss.org/jbossws/saaj", endpointInterface = "org.jboss.test.ws.saaj.jbws3084.ServiceIface")
+public class ServiceImpl implements ServiceIface
+{
+ @Resource
+ private WebServiceContext context;
+
+ public String sayHello()
+ {
+ Map<String, List<String>> reqHeaders = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
+ MessageContext.HTTP_REQUEST_HEADERS));
+
+ boolean chunkedEncodingDisabled = reqHeaders.get("transfer-encoding-disabled") != null;
+
+ List<String> transferEncHeader = reqHeaders.get("transfer-encoding");
+
+ if (!chunkedEncodingDisabled)
+ {
+ if (transferEncHeader == null || transferEncHeader.size() != 1)
+ {
+ throw new RuntimeException("Transfer-Encoding is missing");
+ }
+ if (!"chunked".equals(transferEncHeader.get(0)))
+ {
+ throw new RuntimeException("Wrong Transfer-Encoding value");
+ }
+ }
+ else
+ {
+ if (transferEncHeader != null)
+ {
+ throw new RuntimeException("Unexpected Transfer-Encoding header");
+ }
+ Map<String, List<String>> respHeaders = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
+ MessageContext.HTTP_RESPONSE_HEADERS));
+ if (respHeaders == null)
+ {
+ respHeaders = new HashMap<String, List<String>>();
+ context.getMessageContext().put(MessageContext.HTTP_RESPONSE_HEADERS, respHeaders);
+ }
+ respHeaders.put("Transfer-Encoding-Disabled", Arrays.asList("true"));
+ }
+
+ Map<String, DataHandler> dataHandlers = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
+ MessageContext.INBOUND_MESSAGE_ATTACHMENTS));
+
+ Map<String, DataHandler> outDataHandlers = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
+ MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
+
+ int index = 0;
+ try
+ {
+ for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
+ {
+ InputStream is = entry.getValue().getInputStream();
+ LoadingByteArrayOutputStream bous = new LoadingByteArrayOutputStream();
+ IOUtils.copy(is, bous);
+ String name = Integer.toString(index++);
+ DataHandler handler = new DataHandler(new InputStreamDataSource(bous.createInputStream(), "text/plain",
+ name));
+ outDataHandlers.put(name, handler);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ return "Hello World!";
+ }
+
+ public String greetMe()
+ {
+ try
+ {
+ Map<String, DataHandler> outDataHandlers = CastUtils.cast((Map<?, ?>) context.getMessageContext().get(
+ MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
+
+ final char[] content = new char[16 * 1024];
+ Arrays.fill(content, 'A');
+
+ DataHandler handler = new DataHandler(new InputStreamDataSource(new ByteArrayInputStream(
+ new String(content).getBytes()), "text/plain", "1"));
+ outDataHandlers.put("1", handler);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ return "Greetings";
+ }
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/web.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/web.xml (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/web.xml 2010-11-08 11:34:20 UTC (rev 13242)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
+ version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <servlet>
+ <servlet-name>SaajService</servlet-name>
+ <servlet-class>org.jboss.test.ws.saaj.jbws3084.ServiceImpl</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>SaajService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl 2010-11-08 11:34:20 UTC (rev 13242)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="SaajService" targetNamespace="http://www.jboss.org/jbossws/saaj" xmlns:tns="http://www.jboss.org/jbossws/saaj" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.jboss.org/jbossws/saaj" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://www.jboss.org/jbossws/saaj">
+<xsd:element name="sayHello" type="tns:sayHello"/>
+<xsd:complexType name="sayHello">
+<xsd:sequence/>
+</xsd:complexType>
+<xsd:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
+<xsd:complexType name="sayHelloResponse">
+<xsd:sequence>
+<xsd:element minOccurs="0" name="return" type="xsd:string"/>
+</xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="greetMe" type="tns:greetMe"/>
+<xsd:complexType name="greetMe">
+<xsd:sequence/>
+</xsd:complexType>
+<xsd:element name="greetMeResponse" type="tns:greetMeResponse"/>
+<xsd:complexType name="greetMeResponse">
+<xsd:sequence>
+<xsd:element minOccurs="0" name="return" type="xsd:string"/>
+</xsd:sequence>
+</xsd:complexType>
+
+</xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="sayHelloResponse">
+ <wsdl:part name="parameters" element="tns:sayHelloResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="sayHello">
+ <wsdl:part name="parameters" element="tns:sayHello">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part name="parameters" element="tns:greetMeResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="greetMe">
+ <wsdl:part name="parameters" element="tns:greetMe">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:portType name="ServiceIface">
+ <wsdl:operation name="sayHello">
+ <wsdl:input name="sayHello" message="tns:sayHello">
+ </wsdl:input>
+ <wsdl:output name="sayHelloResponse" message="tns:sayHelloResponse">
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input name="greetMe" message="tns:greetMe">
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse" message="tns:greetMeResponse">
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:binding name="SaajServiceSoapBinding" type="tns:ServiceIface">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/wsdl/http/"/>
+ <wsdl:operation name="sayHello">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHello">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHelloResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMe">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SaajService">
+ <wsdl:port name="SaajServicePort" binding="tns:SaajServiceSoapBinding">
+ <soap:address location="http://localhost:8080/SaajService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
13 years, 6 months
JBossWS SVN: r13241 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2010-11-07 23:34:47 -0500 (Sun, 07 Nov 2010)
New Revision: 13241
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java
Log:
[JBWS-3154]:Added wsa:MessageId in response message
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2010-11-04 16:10:41 UTC (rev 13240)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.java 2010-11-08 04:34:47 UTC (rev 13241)
@@ -54,6 +54,7 @@
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.wsf.common.addressing.AddressingConstants;
import org.jboss.wsf.common.handler.GenericSOAPHandler;
+import org.jboss.wsf.common.utils.UUIDGenerator;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -227,6 +228,18 @@
outProps.setAction(this.newURI(faultAction));
}
+
+ if (outProps.getMessageID() == null)
+ {
+ try
+ {
+ outProps.setMessageID(ADDR_BUILDER.newURI("urn:uuid:" + UUIDGenerator.generateRandomUUIDString()));
+ }
+ catch (URISyntaxException e)
+ {
+ log.error("Error setting response messageId", e);
+ }
+ }
outProps.writeHeaders(soapMessage);
}
13 years, 6 months
JBossWS SVN: r13240 - stack/native/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2010-11-04 12:10:41 -0400 (Thu, 04 Nov 2010)
New Revision: 13240
Modified:
stack/native/trunk/modules/testsuite/test-excludes-jboss600.txt
Log:
temporarily disabling tests for AS 600M5. They will be enabled once AS 600CR1 is out
Modified: stack/native/trunk/modules/testsuite/test-excludes-jboss600.txt
===================================================================
--- stack/native/trunk/modules/testsuite/test-excludes-jboss600.txt 2010-11-04 15:36:15 UTC (rev 13239)
+++ stack/native/trunk/modules/testsuite/test-excludes-jboss600.txt 2010-11-04 16:10:41 UTC (rev 13240)
@@ -12,3 +12,18 @@
# [JBWS-3150] This test causes hudson to freeze
org/jboss/test/ws/common/soap/SOAPConnectionTestCase.*
+
+# TODO: remove these excludes once AS 600 RC1 is out
+**/jaxrpc/**/*TestCase.*
+**/serviceref/**
+**/webserviceref/**
+org/jboss/test/ws/jaxws/smoke/tools/WSRunClientTestCase.*
+org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.*
+org/jboss/test/ws/jaxws/samples/advanced/retail/RetailSampleTestCase.*
+org/jboss/test/ws/jaxws/jbws2307/JBWS2307MTOMTestCase.*
+org/jboss/test/ws/jaxws/jbws1581/JBWS1581WarTestCase.*
+org/jboss/test/ws/jaxws/samples/webservicerefsec/WebServiceRefSecTestCase.*
+org/jboss/test/ws/jaxws/jbws2307/JBWS2307TestCase.*
+org/jboss/test/ws/jaxws/jbws2527/JBWS2527TestCase.*
+org/jboss/test/ws/jaxws/jbws1581/JBWS1581EarTestCase.*
+org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.*
13 years, 7 months