Author: dkulp
Date: Mon Oct 29 08:43:23 2007
New Revision: 589691
URL: http://svn.apache.org/viewvc?rev=589691&view=rev
Log:
Merged revisions 589072 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r589072 | gmazza | 2007-10-27 06:49:07 -0400 (Sat, 27 Oct 2007) | 1 line
Improved MTOM sample.
........
Added:
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomPortTypeImpl.java
- copied unchanged from r589072,
incubator/cxf/trunk/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomPortTypeImpl.java
Removed:
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/TestMtomImpl.java
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/README.txt
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/README.txt
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/README.txt?rev=589691&r1=589690&r2=589691&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/README.txt
(original)
+++
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/README.txt
Mon Oct 29 08:43:23 2007
@@ -116,17 +116,14 @@
Build the war file with the command:
ant war
-
+
The war file will be included in the directory
samples/mtom/build/war. Simply copy the war file into
the servlet container's deployment directory. For example,
with Tomcat copy the war file into the directory
-<installationDirectory>/webapps. The servlet container will
+$CATALINA_HOME/webapps. The servlet container will
extract the war and deploy the application.
-
-Make sure already copy all jars from CXF_HOME/lib to
-<TomcatInstallationDirectory>/shared/lib
Using ant, run the client application with the command:
Modified:
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java?rev=589691&r1=589690&r2=589691&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/client/Client.java
Mon Oct 29 08:43:23 2007
@@ -35,7 +35,7 @@
import javax.xml.ws.Holder;
import javax.xml.ws.soap.SOAPBinding;
-import org.apache.cxf.mime.TestMtom;
+import org.apache.cxf.mime.TestMtomPortType;
import org.apache.cxf.mime.TestMtomService;
public final class Client {
@@ -66,7 +66,8 @@
System.out.println(wsdlURL);
TestMtomService tms = new TestMtomService(wsdlURL, SERVICE_NAME);
- TestMtom port = (TestMtom) tms.getPort(PORT_NAME, TestMtom.class);
+ TestMtomPortType port = (TestMtomPortType) tms.getPort(PORT_NAME,
+ TestMtomPortType.class);
Binding binding = ((BindingProvider)port).getBinding();
((SOAPBinding)binding).setMTOMEnabled(true);
@@ -75,38 +76,52 @@
for (int i = pre.read(); i != -1; i = pre.read()) {
fileSize++;
}
+ System.out.println("Filesize of me.bmp image is: " + fileSize);
+
Holder<byte[]> param = new Holder<byte[]>();
param.value = new byte[(int) fileSize];
- System.out.println("Start test without MTOM enabled:");
- System.out.println("Sending out the me.bmp image content to server,
data size is " + fileSize);
+ System.out.println("\nStarting MTOM Test using basic byte array:");
+ Holder<String> name = new Holder<String>("Sam");
InputStream in = client.getClass().getResourceAsStream("me.bmp");
in.read(param.value);
- Holder<String> name = new Holder<String>("call detail");
- port.testXop(name, param);
- System.out.println("Received byte[] back from server, returned size is
" + param.value.length);
+ System.out.println("--Sending the me.bmp image to server");
+ System.out.println("--Sending a name value of " + name.value);
+
+ port.testByteArray(name, param);
+
+ System.out.println("--Received byte[] back from server, returned size
is "
+ + param.value.length);
+ System.out.println("--Returned string value is " + name.value);
Image image = ImageIO.read(new ByteArrayInputStream(param.value));
- System.out.println("Build image with the returned byte[] back from
server successfully, hashCode="
- + image.hashCode());
- System.out.println("Successfully ran demo without MTOM enabled");
+ System.out.println("--Loaded image from byte[] successfully,
hashCode=" +
+ image.hashCode());
+ System.out.println("Successfully ran MTOM/byte array demo");
- System.out.println("Start test with MTOM enabled:");
- System.out.println("Sending out the me.bmp Image content to server,
data size is " + fileSize);
+ System.out.println("\nStarting MTOM test with DataHandler:");
+ name.value = "Bob";
Holder<DataHandler> handler = new Holder<DataHandler>();
byte[] data = new byte[(int) fileSize];
client.getClass().getResourceAsStream("me.bmp").read(data);
- handler.value = new DataHandler(new ByteArrayDataSource(data,
"application/octet-stream"));
- port.testMtom(name, handler);
+ handler.value = new DataHandler(new ByteArrayDataSource(data,
+ "application/octet-stream"));
+ System.out.println("--Sending the me.bmp image to server");
+ System.out.println("--Sending a name value of " + name.value);
+
+ port.testDataHandler(name, handler);
+
InputStream mtomIn = handler.value.getInputStream();
fileSize = 0;
-
for (int i = mtomIn.read(); i != -1; i = mtomIn.read()) {
fileSize++;
}
- System.out.println("Received DataHandler back from server, returned
size is " + fileSize);
- System.out.println("Successfully ran demo with MTOM enabled");
+ System.out.println("--Received DataHandler back from server, " +
+ "returned size is " + fileSize);
+ System.out.println("--Returned string value is " + name.value);
+
+ System.out.println("Successfully ran MTOM/DataHandler demo");
System.exit(0);
}
Modified:
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java?rev=589691&r1=589690&r2=589691&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/src/demo/mtom/server/Server.java
Mon Oct 29 08:43:23 2007
@@ -27,7 +27,7 @@
protected Server() throws Exception {
System.out.println("Starting Server");
- Object implementor = new TestMtomImpl();
+ Object implementor = new TestMtomPortTypeImpl();
String address = "http://localhost:9000/mime-test";
Endpoint ep = Endpoint.publish(address, implementor);
Binding binding = ep.getBinding();
Modified:
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml?rev=589691&r1=589690&r2=589691&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml
(original)
+++
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/cxf-servlet.xml
Mon Oct 29 08:43:23 2007
@@ -29,7 +29,7 @@
<jaxws:endpoint
id="mtom"
- implementor="demo.mtom.server.TestMtomImpl"
+ implementor="demo.mtom.server.TestMtomPortTypeImpl"
wsdlLocation="WEB-INF/wsdl/mtom_xop.wsdl"
address="/mtom" />
Modified:
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl?rev=589691&r1=589690&r2=589691&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl
(original)
+++
incubator/cxf/branches/2.0.x-fixes/distribution/src/main/release/samples/mtom/wsdl/mtom_xop.wsdl
Mon Oct 29 08:43:23 2007
@@ -29,63 +29,63 @@
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://cxf.apache.org/mime/types"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
elementFormDefault="qualified">
- <complexType name="XopType">
+ <complexType name="ByteArrayType">
<sequence>
<element name="name" type="xsd:string" />
<element name="attachinfo" type="xsd:base64Binary"/>
</sequence>
</complexType>
- <element name="testXop" type="types:XopType" />
- <element name="testXopResponse" type="types:XopType" />
+ <element name="testByteArray" type="types:ByteArrayType" />
+ <element name="testByteArrayResponse" type="types:ByteArrayType" />
- <complexType name="MtomType">
+ <complexType name="DataHandlerType">
<sequence>
<element name="name" type="xsd:string" />
- <element name="attachinfo" type="xsd:base64Binary"
xmime:expectedContentTypes="application/octet-stream"/>
+ <element name="attachinfo" type="xsd:base64Binary"
+
xmime:expectedContentTypes="application/octet-stream"/>
</sequence>
</complexType>
- <element name="testMtom" type="types:MtomType" />
- <element name="testMtomResponse" type="types:MtomType" />
+ <element name="testDataHandler" type="types:DataHandlerType" />
+ <element name="testDataHandlerResponse"
type="types:DataHandlerType" />
</schema>
</wsdl:types>
- <wsdl:message name="testXopIn">
- <wsdl:part name="data" element="types:testXop" />
+ <wsdl:message name="testByteArrayIn">
+ <wsdl:part name="data" element="types:testByteArray" />
</wsdl:message>
- <wsdl:message name="testXopOut">
- <wsdl:part name="data" element="types:testXopResponse" />
+ <wsdl:message name="testByteArrayOut">
+ <wsdl:part name="data" element="types:testByteArrayResponse" />
</wsdl:message>
- <wsdl:message name="testMtomIn">
- <wsdl:part name="data" element="types:testMtom" />
+ <wsdl:message name="testDataHandlerIn">
+ <wsdl:part name="data" element="types:testDataHandler" />
</wsdl:message>
- <wsdl:message name="testMtomOut">
- <wsdl:part name="data" element="types:testMtomResponse" />
+ <wsdl:message name="testDataHandlerOut">
+ <wsdl:part name="data" element="types:testDataHandlerResponse" />
</wsdl:message>
- <wsdl:portType name="TestMtom">
-
- <wsdl:operation name="testXop">
- <wsdl:input message="tns:testXopIn" />
- <wsdl:output message="tns:testXopOut" />
+ <wsdl:portType name="TestMtomPortType">
+ <wsdl:operation name="testByteArray">
+ <wsdl:input message="tns:testByteArrayIn" />
+ <wsdl:output message="tns:testByteArrayOut" />
</wsdl:operation>
- <wsdl:operation name="testMtom">
- <wsdl:input message="tns:testMtomIn" />
- <wsdl:output message="tns:testMtomOut" />
+ <wsdl:operation name="testDataHandler">
+ <wsdl:input message="tns:testDataHandlerIn" />
+ <wsdl:output message="tns:testDataHandlerOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="TestMtomBinding" type="tns:TestMtom">
+ <wsdl:binding name="TestMtomBinding" type="tns:TestMtomPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="testXop">
+ <wsdl:operation name="testByteArray">
<soap:operation soapAction="" />
<wsdl:input>
<soap:body use="literal" />
@@ -95,7 +95,7 @@
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="testMtom">
+ <wsdl:operation name="testDataHandler">
<soap:operation soapAction="" />
<wsdl:input>
<soap:body use="literal" />