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/confi...;
+ }
+ 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>