JBossWS SVN: r13657 - stack/native/tags/jbossws-native-3.1.2.SP3_JBPAPP-5830/modules/core/src/main/java/org/jboss/ws/core/client.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-01-31 12:58:25 -0500 (Mon, 31 Jan 2011)
New Revision: 13657
Modified:
stack/native/tags/jbossws-native-3.1.2.SP3_JBPAPP-5830/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
Log:
[JBPAPP-5830] JBossWS - Configure remoting to reuse SSL sessions
Modified: stack/native/tags/jbossws-native-3.1.2.SP3_JBPAPP-5830/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/tags/jbossws-native-3.1.2.SP3_JBPAPP-5830/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2011-01-31 16:09:03 UTC (rev 13656)
+++ stack/native/tags/jbossws-native-3.1.2.SP3_JBPAPP-5830/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2011-01-31 17:58:25 UTC (rev 13657)
@@ -73,6 +73,8 @@
{
// provide logging
private static Logger log = Logger.getLogger(HTTPRemotingConnection.class);
+ private static final String REMOTING_DESTRUCTION_DELAY =
+ System.getProperty("org.jboss.ws.client.remoting.destruction.delay", "5000");
private Map<String, Object> clientConfig = new HashMap<String, Object>();
@@ -200,6 +202,7 @@
}
locator = new InvokerLocator(targetAddress);
+ locator.getParameters().put(Client.INVOKER_DESTRUCTION_DELAY, REMOTING_DESTRUCTION_DELAY); // [JBPAPP-5826] reuse SSL sessions
}
catch (MalformedURLException e)
{
13 years, 10 months
JBossWS SVN: r13656 - thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-01-31 11:09:03 -0500 (Mon, 31 Jan 2011)
New Revision: 13656
Modified:
thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Log:
[JBPAPP-4564][JBWS-3084][CXF-3065] back porting CXF-3065
Modified: thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
===================================================================
--- thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java 2011-01-31 16:06:24 UTC (rev 13655)
+++ thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java 2011-01-31 16:09:03 UTC (rev 13656)
@@ -1701,7 +1701,9 @@
}
message.put(KEY_HTTP_CONNECTION, connection);
- connection.setFixedLengthStreamingMode(stream.size());
+ if (stream != null) {
+ connection.setFixedLengthStreamingMode(stream.size());
+ }
// Need to set the headers before the trust decision
// because they are set before the connect().
@@ -1978,8 +1980,10 @@
if (!cachingForRetransmission) {
super.close();
} else {
- cachedStream.getOut().close();
- cachedStream.closeFlowthroughStream();
+ if (cachedStream != null) {
+ cachedStream.getOut().close();
+ cachedStream.closeFlowthroughStream();
+ }
}
try {
handleResponse();
@@ -2025,9 +2029,10 @@
*/
protected void handleRetransmits() throws IOException {
// If we have a cachedStream, we are caching the request.
- if (cachedStream != null) {
+ if (cachedStream != null
+ || ("GET".equals(connection.getRequestMethod()) && getClient().isAutoRedirect())) {
- if (LOG.isLoggable(Level.FINE)) {
+ if (LOG.isLoggable(Level.FINE) && cachedStream != null) {
LOG.fine("Conduit \""
+ getConduitName()
+ "\" Transmit cached message to: "
@@ -2157,7 +2162,7 @@
//not going to be resending or anything, clear out the stuff in the out message
//to free memory
outMessage.removeContent(OutputStream.class);
- if (cachingForRetransmission) {
+ if (cachingForRetransmission && cachedStream != null) {
cachedStream.close();
}
cachedStream = null;
13 years, 10 months
JBossWS SVN: r13655 - thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-01-31 11:06:24 -0500 (Mon, 31 Jan 2011)
New Revision: 13655
Modified:
thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
Log:
[JBPAPP-4564][JBWS-3084] back porting CXF fix http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/o...
Modified: thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
===================================================================
--- thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java 2011-01-31 15:37:34 UTC (rev 13654)
+++ thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java 2011-01-31 16:06:24 UTC (rev 13655)
@@ -99,7 +99,12 @@
}
protected String getBasePath(String contextPath) throws IOException {
- return contextPath + getAddress().getAddress().getValue();
+ String address = getAddress().getAddress().getValue();
+ if (address.startsWith("http")) {
+ return java.net.URI.create(address).getPath();
+ }
+
+ return contextPath + address;
}
@Override
13 years, 10 months
JBossWS SVN: r13654 - in stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws: jaxws and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-01-31 10:37:34 -0500 (Mon, 31 Jan 2011)
New Revision: 13654
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
Removed:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/
Log:
[JBPAPP-4564] refactoring test wrong package
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java 2011-01-31 15:37:34 UTC (rev 13654)
@@ -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/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java 2011-01-31 15:37:34 UTC (rev 13654)
@@ -0,0 +1,70 @@
+/*
+ * 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 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());
+ }
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java 2011-01-31 15:37:34 UTC (rev 13654)
@@ -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 greetMe();
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2011-01-31 15:37:34 UTC (rev 13654)
@@ -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.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 greetMe()
+ {
+ try
+ {
+ 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');
+
+ 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";
+ }
+}
13 years, 10 months
JBossWS SVN: r13653 - stack/native/tags.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-01-31 10:19:39 -0500 (Mon, 31 Jan 2011)
New Revision: 13653
Added:
stack/native/tags/jbossws-native-3.1.2.SP3_JBPAPP-5830/
Log:
[JBPAPP-5830] Branch for one off patch
Copied: stack/native/tags/jbossws-native-3.1.2.SP3_JBPAPP-5830 (from rev 13652, stack/native/tags/jbossws-native-3.1.2.SP3)
13 years, 10 months
JBossWS SVN: r13652 - in stack/cxf/branches/jbossws-cxf-3.1.2/modules: client/src/main/java/org/jboss/wsf/stack/cxf/saaj and 10 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-01-31 08:35:09 -0500 (Mon, 31 Jan 2011)
New Revision: 13652
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionFactoryImpl.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/resources/META-INF/services/javax.xml.soap.SOAPConnectionFactory
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/InputStreamDataSource.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/JBWS3084TestCase.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/ServiceIface.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/ServiceImpl.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/web.xml
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
Log:
[JBPAPP-4564][JBWS-3084] back porting chunked encoding control in SAAJ
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionFactoryImpl.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionFactoryImpl.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionFactoryImpl.java 2011-01-31 13:35:09 UTC (rev 13652)
@@ -0,0 +1,37 @@
+/*
+ * 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.wsf.stack.cxf.saaj;
+
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPException;
+
+public class SOAPConnectionFactoryImpl extends SOAPConnectionFactory
+{
+
+ @Override
+ public SOAPConnection createConnection() throws SOAPException
+ {
+ return new SOAPConnectionImpl();
+ }
+
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java 2011-01-31 13:35:09 UTC (rev 13652)
@@ -0,0 +1,311 @@
+/*
+ * 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.wsf.stack.cxf.saaj;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.http.HTTPConduit;
+
+public class SOAPConnectionImpl extends SOAPConnection
+{
+ private boolean closed = false;
+
+ @Override
+ public SOAPMessage call(SOAPMessage msgOut, Object addressObject) throws SOAPException
+ {
+ checkClosed();
+
+ String address = getAddress(addressObject);
+ ConduitInitiator ci = getConduitInitiator(address);
+
+
+ // create a new Message and Exchange
+ EndpointInfo info = new EndpointInfo();
+ info.setAddress(address);
+ Message outMessage = new MessageImpl();
+ Exchange exch = new ExchangeImpl();
+ outMessage.setExchange(exch);
+
+ // sent SOAPMessage
+ try
+ {
+ final Conduit c = ci.getConduit(info);
+
+
+ Map<String, List<String>> outHeaders = new HashMap<String, List<String>>();
+ for (Iterator<?> it = msgOut.getMimeHeaders().getAllHeaders(); it.hasNext();)
+ {
+ MimeHeader mimeHeader = (MimeHeader)it.next();
+ if ("Content-Type".equals(mimeHeader.getName()))
+ {
+ outMessage.put(Message.CONTENT_TYPE, mimeHeader.getValue());
+ }
+
+ // disable the chunked encoding if requested
+ if ("Transfer-Encoding".equals(mimeHeader.getName())
+ && "disabled".equals(mimeHeader.getValue())
+ && c instanceof HTTPConduit)
+ {
+ ((HTTPConduit)c).getClient().setAllowChunking(false);
+ continue;
+ }
+
+ List<String> values = outHeaders.get(mimeHeader.getName());
+ if (values == null)
+ {
+ values = new ArrayList<String>();
+ outHeaders.put(mimeHeader.getName(), values);
+ }
+ values.add(mimeHeader.getValue());
+ }
+ outMessage.put(Message.HTTP_REQUEST_METHOD, "POST");
+ outMessage.put(Message.PROTOCOL_HEADERS, outHeaders);
+ c.prepare(outMessage);
+
+ OutputStream outs = outMessage.getContent(OutputStream.class);
+ msgOut.writeTo(outs);
+
+ c.setMessageObserver(createMessageObserver(c));
+
+ c.close(outMessage);
+ }
+ catch (Exception ex)
+ {
+ throw new SOAPException("SOAPMessage can not be sent", ex);
+ }
+
+ // read SOAPMessage
+ return readSoapMessage(exch);
+ }
+
+ @Override
+ public SOAPMessage get(Object addressObject) throws SOAPException
+ {
+ checkClosed();
+
+ String address = getAddress(addressObject);
+ ConduitInitiator ci = getConduitInitiator(address);
+
+
+ // create a new Message and Exchange
+ EndpointInfo info = new EndpointInfo();
+ info.setAddress(address);
+ Message outMessage = new MessageImpl();
+ Exchange exch = new ExchangeImpl();
+ outMessage.setExchange(exch);
+
+ // sent GET request
+ try
+ {
+ final Conduit c = ci.getConduit(info);
+
+ if (c instanceof HTTPConduit)
+ {
+ ((HTTPConduit)c).getClient().setAutoRedirect(true);
+ }
+
+ outMessage.put(Message.HTTP_REQUEST_METHOD, "GET");
+ c.prepare(outMessage);
+
+ c.setMessageObserver(createMessageObserver(c));
+
+ c.close(outMessage);
+ }
+ catch (Exception ex)
+ {
+ throw new SOAPException("GET request can not be sent", ex);
+ }
+
+ // read SOAPMessage
+ return readSoapMessage(exch);
+ }
+
+ @Override
+ public void close() throws SOAPException
+ {
+ if (this.closed)
+ {
+ throw new SOAPException("Connection already closed!");
+ }
+ this.closed = true;
+ }
+
+ private String getAddress(Object addressObject) throws SOAPException
+ {
+ if (addressObject instanceof URL || addressObject instanceof String)
+ {
+ return addressObject.toString();
+ }
+ throw new SOAPException("Address object of type " + addressObject.getClass().getName()
+ + " is not supported");
+ }
+
+ private ConduitInitiator getConduitInitiator(String address) throws SOAPException
+ {
+ ConduitInitiator ci = null;
+ try
+ {
+ //do not use getThreadDefaultBus(true) in order to avoid getting the default bus
+ Bus bus = BusFactory.getThreadDefaultBus(false);
+ if (bus == null)
+ {
+ bus = BusFactory.newInstance().createBus();
+ }
+ ConduitInitiatorManager mgr = bus.getExtension(ConduitInitiatorManager.class);
+
+ if (address.startsWith("http"))
+ {
+ ci = mgr.getConduitInitiator("http://cxf.apache.org/transports/http/configuration");
+ }
+ if (ci == null)
+ {
+ ci = mgr.getConduitInitiatorForUri(address);
+ }
+
+ }
+ catch (Exception ex)
+ {
+ throw new SOAPException("No ConduitInitiator is available for " + address, ex);
+ }
+
+ if (ci == null)
+ {
+ throw new SOAPException("No ConduitInitiator is available for " + address);
+ }
+ return ci;
+ }
+
+ @SuppressWarnings("unchecked")
+ private MessageObserver createMessageObserver(final Conduit c)
+ {
+ return new MessageObserver()
+ {
+ public void onMessage(Message inMessage)
+ {
+ LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream();
+ try
+ {
+ IOUtils.copy(inMessage.getContent(InputStream.class), bout);
+ inMessage.getExchange().put(InputStream.class, bout.createInputStream());
+
+ Map<String, List<String>> inHeaders =
+ (Map<String, List<String>>)inMessage.get(Message.PROTOCOL_HEADERS);
+
+ inMessage.getExchange().put(Message.PROTOCOL_HEADERS, inHeaders);
+ c.close(inMessage);
+ }
+ catch (IOException e)
+ {
+ //ignore
+ }
+ }
+ };
+ }
+
+ @SuppressWarnings("unchecked")
+ private SOAPMessage readSoapMessage(Exchange exch) throws SOAPException
+ {
+ // read SOAPMessage
+ try
+ {
+ InputStream ins = exch.get(InputStream.class);
+
+ Map<String, List<String>> inHeaders =
+ (Map<String, List<String>>)exch.get(Message.PROTOCOL_HEADERS);
+
+ MimeHeaders mimeHeaders = new MimeHeaders();
+ if (inHeaders != null)
+ {
+ for (Map.Entry<String, List<String>> entry : inHeaders.entrySet())
+ {
+ if (entry.getValue() != null)
+ {
+ for (String value : entry.getValue())
+ {
+ mimeHeaders.addHeader(entry.getKey(), value);
+ }
+ }
+ }
+ }
+
+ //if inputstream is empty, no need to build
+ if (ins.markSupported())
+ {
+ ins.mark(1);
+ final int bytesRead = ins.read(new byte[1]);
+ ins.reset();
+ if (bytesRead == -1)
+ {
+ return null;
+ }
+ }
+ else if (ins.available() == 0)
+ {
+ return null;
+ }
+
+ MessageFactory msgFac = MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL);
+ return msgFac.createMessage(mimeHeaders, ins);
+ }
+ catch (Exception ex)
+ {
+ throw new SOAPException("SOAPMessage can not be read", ex);
+ }
+ }
+
+ private void checkClosed() throws SOAPException
+ {
+ if (closed) {
+ throw new SOAPException("Cannot send messages using a previously closed connection!");
+ }
+ }
+
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/resources/META-INF/services/javax.xml.soap.SOAPConnectionFactory
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/resources/META-INF/services/javax.xml.soap.SOAPConnectionFactory (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/client/src/main/resources/META-INF/services/javax.xml.soap.SOAPConnectionFactory 2011-01-31 13:35:09 UTC (rev 13652)
@@ -0,0 +1 @@
+org.jboss.wsf.stack.cxf.saaj.SOAPConnectionFactoryImpl
Modified: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-01-31 11:57:58 UTC (rev 13651)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-01-31 13:35:09 UTC (rev 13652)
@@ -72,6 +72,20 @@
</metainf>
</jar>
+ <!-- saaj-soap-connection -->
+ <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: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/InputStreamDataSource.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/InputStreamDataSource.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/InputStreamDataSource.java 2011-01-31 13:35:09 UTC (rev 13652)
@@ -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/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/JBWS3084TestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/JBWS3084TestCase.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/JBWS3084TestCase.java 2011-01-31 13:35:09 UTC (rev 13652)
@@ -0,0 +1,70 @@
+/*
+ * 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 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());
+ }
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/ServiceIface.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/ServiceIface.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/ServiceIface.java 2011-01-31 13:35:09 UTC (rev 13652)
@@ -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 greetMe();
+}
Added: stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/ServiceImpl.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/jbws3084/ServiceImpl.java 2011-01-31 13:35:09 UTC (rev 13652)
@@ -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.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 greetMe()
+ {
+ try
+ {
+ 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');
+
+ 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/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/web.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/web.xml (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/web.xml 2011-01-31 13:35:09 UTC (rev 13652)
@@ -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/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl (rev 0)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl 2011-01-31 13:35:09 UTC (rev 13652)
@@ -0,0 +1,53 @@
+<?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="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="greetMeResponse">
+ <wsdl:part name="parameters" element="tns:greetMeResponse"/>
+ </wsdl:message>
+
+ <wsdl:message name="greetMe">
+ <wsdl:part name="parameters" element="tns:greetMe"/>
+ </wsdl:message>
+
+ <wsdl:portType name="ServiceIface">
+ <wsdl:operation name="greetMe">
+ <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="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, 10 months
JBossWS SVN: r13651 - stack/native/branches/jbossws-native-3.1.2/src/main/scripts.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-01-31 06:57:58 -0500 (Mon, 31 Jan 2011)
New Revision: 13651
Modified:
stack/native/branches/jbossws-native-3.1.2/src/main/scripts/assembly-bin-dist.xml
Log:
[JBPAPP-4564][JBWS-3084] fixing binary distribution to include jbws3084 test as well
Modified: stack/native/branches/jbossws-native-3.1.2/src/main/scripts/assembly-bin-dist.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/src/main/scripts/assembly-bin-dist.xml 2011-01-31 11:35:15 UTC (rev 13650)
+++ stack/native/branches/jbossws-native-3.1.2/src/main/scripts/assembly-bin-dist.xml 2011-01-31 11:57:58 UTC (rev 13651)
@@ -101,11 +101,13 @@
<include>java/org/jboss/test/ws/jaxws/smoke/**</include>
<include>java/org/jboss/test/ws/management/**</include>
<include>java/org/jboss/test/ws/projectGenerator/**</include>
+ <include>java/org/jboss/test/ws/saaj/**</include>
<include>resources/console/**</include>
<include>resources/jaxws/samples/**</include>
<include>resources/jaxws/smoke/**</include>
<include>resources/management/**</include>
<include>resources/projectGenerator/**</include>
+ <include>resources/saaj/**</include>
</includes>
</unpackOptions>
</dependencySet>
13 years, 10 months
JBossWS SVN: r13650 - in stack/native/branches/jbossws-native-3.1.2/modules: testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws167 and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-01-31 06:35:15 -0500 (Mon, 31 Jan 2011)
New Revision: 13650
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws167/HelloJavaBean.java
Log:
[JBPAPP-4564][JBWS-3084] back porting native fix - enabling chunked encoding control for SAAJ
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2011-01-31 11:33:23 UTC (rev 13649)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2011-01-31 11:35:15 UTC (rev 13650)
@@ -175,6 +175,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");
+ }
// setup remoting client
Map<String, Object> metadata = createRemotingMetaData(reqMessage, callProps);
Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws167/HelloJavaBean.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws167/HelloJavaBean.java 2011-01-31 11:33:23 UTC (rev 13649)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws167/HelloJavaBean.java 2011-01-31 11:35:15 UTC (rev 13650)
@@ -48,7 +48,7 @@
log.info("soapAction: " + Arrays.asList(soapAction));
String retStr;
- if (soapAction != null && soapAction.length == 1 && soapAction[0].equals("/foo/bar"))
+ if (soapAction != null && soapAction.length == 1 && soapAction[0].indexOf("/foo/bar") != -1)
{
retStr = "[pass]";
}
13 years, 10 months
JBossWS SVN: r13649 - in stack/native/branches/jbossws-native-3.1.2/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: 2011-01-31 06:33:23 -0500 (Mon, 31 Jan 2011)
New Revision: 13649
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
Log:
[JBPAPP-4564][JBWS-3155] back porting anonymous attachments fix
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2011-01-31 11:07:19 UTC (rev 13648)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPBinding.java 2011-01-31 11:33:23 UTC (rev 13649)
@@ -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;
@@ -328,14 +330,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
{
@@ -374,6 +368,9 @@
}
}
+ // Add all attachments to the standard property
+ this.propagateAttachmentsToJAXWSMessageContext(reqMessage, msgContext);
+
return epInv;
}
catch (Exception e)
@@ -439,6 +436,8 @@
}
}
+ this.propagateAttachmentsFromJAXWSMessageContext(resMessage, msgContext);
+
// Add the return to the message
ParameterMetaData retMetaData = opMetaData.getReturnParameter();
if (retMetaData != null)
@@ -503,7 +502,7 @@
}
}
}
-
+
return resMessage;
}
catch (Exception e)
@@ -512,7 +511,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
@@ -599,14 +623,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
{
@@ -622,14 +638,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
{
@@ -638,13 +646,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);
@@ -724,6 +759,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/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2011-01-31 11:07:19 UTC (rev 13648)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2011-01-31 11:33:23 UTC (rev 13649)
@@ -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;
@@ -423,8 +424,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/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2011-01-31 11:07:19 UTC (rev 13648)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2011-01-31 11:33:23 UTC (rev 13649)
@@ -251,6 +251,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, 10 months
JBossWS SVN: r13648 - in framework/branches/jbossws-framework-3.1.2/testsuite/test: java/org/jboss/test/ws and 7 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-01-31 06:07:19 -0500 (Mon, 31 Jan 2011)
New Revision: 13648
Added:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/web.xml
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
Modified:
framework/branches/jbossws-framework-3.1.2/testsuite/test/ant-import/build-samples-jaxws.xml
Log:
[JBPAPP-4564][JBWS-3084] backporting test case
Modified: framework/branches/jbossws-framework-3.1.2/testsuite/test/ant-import/build-samples-jaxws.xml
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/ant-import/build-samples-jaxws.xml 2011-01-31 11:00:23 UTC (rev 13647)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/ant-import/build-samples-jaxws.xml 2011-01-31 11:07:19 UTC (rev 13648)
@@ -455,6 +455,20 @@
</fileset>
</jar>
+ <!-- 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/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java (rev 0)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java 2011-01-31 11:07:19 UTC (rev 13648)
@@ -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/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java (rev 0)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java 2011-01-31 11:07:19 UTC (rev 13648)
@@ -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/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java (rev 0)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java 2011-01-31 11:07:19 UTC (rev 13648)
@@ -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/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java (rev 0)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2011-01-31 11:07:19 UTC (rev 13648)
@@ -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/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/web.xml
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/web.xml (rev 0)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/web.xml 2011-01-31 11:07:19 UTC (rev 13648)
@@ -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/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl (rev 0)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/saaj/jbws3084/WEB-INF/wsdl/SaajService.wsdl 2011-01-31 11:07:19 UTC (rev 13648)
@@ -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://@jboss.bind.address@:8080/SaajService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
13 years, 10 months