Author: heiko.braun(a)jboss.com
Date: 2007-05-22 15:17:16 -0400 (Tue, 22 May 2007)
New Revision: 3194
Added:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayload.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java
Modified:
branches/jbossws-2.0/jbossws-tests/ant-import/build-samples-jaxws.xml
Log:
JAX-WS SwaRef examples, first cut
Modified: branches/jbossws-2.0/jbossws-tests/ant-import/build-samples-jaxws.xml
===================================================================
--- branches/jbossws-2.0/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-05-22
19:16:54 UTC (rev 3193)
+++ branches/jbossws-2.0/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-05-22
19:17:16 UTC (rev 3194)
@@ -175,7 +175,14 @@
<include
name="org/jboss/test/ws/jaxws/samples/oneway/PingEndpointImpl.class"/>
</classes>
</war>
-
+
+ <!-- jaxws-samples-swaref -->
+ <jar jarfile="${tests.output.dir}/libs/jaxws-samples-swaref.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/swaref/Doc*.class"/>
+ </fileset>
+ </jar>
+
<!-- jaxws-samples-provider -->
<war warfile="${tests.output.dir}/libs/jaxws-samples-provider-jaxb.war"
webxml="${tests.output.dir}/resources/jaxws/samples/provider/jaxb/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
Added:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java 2007-05-22
19:17:16 UTC (rev 3194)
@@ -0,0 +1,18 @@
+package org.jboss.test.ws.jaxws.samples.swaref;
+
+import javax.jws.WebService;
+import javax.jws.WebMethod;
+import javax.jws.soap.SOAPBinding;
+import javax.ejb.Remote;
+
+@WebService(name="DocLitEndpoint")
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle =
SOAPBinding.ParameterStyle.BARE)
+@Remote
+public interface DocLitEndpoint
+{
+ @WebMethod
+ void submitAttachment(DocumentPayload payload);
+
+ @WebMethod
+ DocumentPayload retrieveAttachment();
+}
Property changes on:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java 2007-05-22
19:17:16 UTC (rev 3194)
@@ -0,0 +1,22 @@
+package org.jboss.test.ws.jaxws.samples.swaref;
+
+import javax.jws.WebService;
+import javax.ejb.Stateless;
+import javax.activation.DataHandler;
+
+@Stateless
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.samples.swaref.DocLitEndpoint")
+public class DocLitEndpointImpl implements DocLitEndpoint
+{
+
+ public void submitAttachment(DocumentPayload payload)
+ {
+ System.out.println("Retrieved " + payload.getData().getContentType());
+ }
+
+ public DocumentPayload retrieveAttachment()
+ {
+ DataHandler data = new DataHandler("Plain text attachment",
"text/plain");
+ return new DocumentPayload(data);
+ }
+}
Property changes on:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayload.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayload.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayload.java 2007-05-22
19:17:16 UTC (rev 3194)
@@ -0,0 +1,33 @@
+package org.jboss.test.ws.jaxws.samples.swaref;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlAttachmentRef;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class DocumentPayload
+{
+ private DataHandler data;
+
+ public DocumentPayload()
+ {
+ }
+
+ public DocumentPayload(DataHandler data)
+ {
+ this.data = data;
+ }
+
+ @XmlElement
+ @XmlAttachmentRef
+ public DataHandler getData()
+ {
+ return data;
+ }
+
+ public void setData(DataHandler data)
+ {
+ this.data = data;
+ }
+}
Property changes on:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayload.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java 2007-05-22
19:17:16 UTC (rev 3194)
@@ -0,0 +1,50 @@
+package org.jboss.test.ws.jaxws.samples.swaref;
+
+import junit.framework.Test;
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.StubExt;
+
+import javax.xml.ws.Service;
+import javax.xml.ws.BindingProvider;
+import javax.xml.namespace.QName;
+import javax.activation.DataHandler;
+import java.net.URL;
+
+/**
+ * TODO: same test with doclit wrapped, currently the scanner fails on generated wrapper
+ */
+public class SWARefTestCase extends JBossWSTest
+{
+ private String endpointURL = "http://" + getServerHost() +
":9090/DocLitEndpointImplService/DocLitEndpointImpl";
+
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(SWARefTestCase.class,
"jaxws-samples-swaref.jar");
+ }
+
+ public void testSubmitAttachment() throws Exception {
+ DataHandler data = new DataHandler("Client data",
"text/plain");
+
+ System.out.println(endpointURL);
+
+ Service service = Service.create(new URL(endpointURL+"?wsdl"), new
QName("http://swaref.samples.jaxws.ws.test.jboss.org/","Do...);
+ DocLitEndpoint port = service.getPort(DocLitEndpoint.class);
+
+ // tweak endpoint URL
+ BindingProvider provider = (BindingProvider)port;
+ provider.getRequestContext().put(
+ BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ endpointURL
+ );
+
+ // disable chunked encoding
+ ((StubExt)port).setConfigName("HTTP 1.0 Client");
+
+ port.submitAttachment(new DocumentPayload(data));
+ }
+
+ public void testRetrieveAttachment() throws Exception {
+ // TODO: implement
+ }
+}
Property changes on:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF