Hi Andreas, Have you tested this with Axis2 deployed as a webapp? MTOM seems to work fine with the SimpleAxisServer but not when Axis2 is deployed as a webapp. Below is what I observed on TCPMon (first response is from the SimpleAxisServer).
------------------------------------------------------------------------ HTTP/1.1 200 OK Date: Mon, 21 Sep 2009 19:03:14 GMT Server: Simple-Server/1.1 Transfer-Encoding: chunked Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_9645FCE52FDC6F4D931253559793956; type="application/xop+xml"; start="< 0.urn:uuid:[email protected]<0.urn%3auuid%[email protected]>>"; start-info="text/xml" 202 --MIMEBoundaryurn_uuid_9645FCE52FDC6F4D931253559793956 Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <0.urn:uuid:[email protected]<0.urn%3auuid%[email protected]>> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:AttachmentResponse xmlns:ns2="http://ws.apache.org/axis2/mtomsample/">File saved succesfully.</ns2:AttachmentResponse></soapenv:Body></soapenv:Envelope> 3c --MIMEBoundaryurn_uuid_9645FCE52FDC6F4D931253559793956-- 0 ------------------------------------------------------------------------ HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_9E87539EB4CACBEB921253619434971; type="application/xop+xml"; start="< 0.urn:uuid:[email protected]<0.urn%3auuid%[email protected]>>"; start-info="text/xml" Transfer-Encoding: chunked Date: Tue, 22 Sep 2009 11:37:15 GMT 202 --MIMEBoundaryurn_uuid_9E87539EB4CACBEB921253619434971 Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <0.urn:uuid:[email protected]<0.urn%3auuid%[email protected]>> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:AttachmentResponse xmlns:ns2="http://ws.apache.org/axis2/mtomsample/">File saved succesfully.</ns2:AttachmentResponse></soapenv:Body></soapenv:Envelope> 0 ----------------------------------------------------------------------- Thanks, Senaka. On Thu, Sep 3, 2009 at 1:05 PM, Andreas Veithen <[email protected]>wrote: > On Thu, Sep 3, 2009 at 05:51, Amila > Suriarachchi<[email protected]> wrote: > > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen > > <[email protected]>wrote: > > > >> Hi Amila, > >> > >> I implemented a service and a client according to your description, > >> but I'm unable to reproduce the issue. Any idea if this is a problem > >> at client side or in the server? > >> > > > > you mean you get exactly the same file size after being transfered by > MTOM? > > Hope you have tested > > with few binary files with different file sizes. > > Yes, I tested with different files with sizes ranging from a couple of > KB to several MB. They all got transferred correctly. > > > since there is no exception I have no idea about where could be the > problem > > is. Can the os be a problem? > > I am using Ubuntu linux. > > It could be some subtle problem depending on the OS (I tested on Mac > OS X), the JRE (I tested on Apple/Sun Java 1.5) or the JARs in the > classpath (On the client side, I tested with activation and javamail > from Geronimo and Sun, but there is no difference). > > > thanks, > > Amila. > > > > > >> Andreas > >> > >> On Tue, Sep 1, 2009 at 14:27, Amila > >> Suriarachchi<[email protected]> wrote: > >> > hi, > >> > I tested the MTOM with the Axis2 trunk with the following service > >> > > >> > public String sendFile(DataHandler dataHandler){ > >> > try { > >> > FileOutputStream fileOutputStream = new > >> > FileOutputStream("/home/amila/ec2-bak.tgz"); > >> > dataHandler.writeTo(fileOutputStream); > >> > fileOutputStream.flush(); > >> > fileOutputStream.close(); > >> > System.out.println("finish writting"); > >> > } catch (FileNotFoundException e) { > >> > e.printStackTrace(); > >> > } catch (IOException e) { > >> > e.printStackTrace(); > >> > } > >> > return "ok"; > >> > } > >> > > >> > with the service.xml to deploy > >> > > >> > <service name="MTOMService"> > >> > <schema schemaNamespace="http://org.apache.axis2/xsd" > >> > elementFormDefaultQualified="false"/> > >> > <messageReceivers> > >> > <messageReceiver mep=" > http://www.w3.org/2004/08/wsdl/in-only" > >> > > >> > class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/> > >> > <messageReceiver mep=" > http://www.w3.org/2004/08/wsdl/in-out" > >> > > >> > class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> > >> > </messageReceivers> > >> > <parameter > >> > name="ServiceClass">test.lockhead.service.MTOMService</parameter> > >> > </service> > >> > > >> > Then I generate the code for this service with ADB and access it with > the > >> > following client > >> > > >> > private void testMTOM(){ > >> > try { > >> > MTOMServiceStub mtomServiceStub = new MTOMServiceStub(" > >> > > >> > http://localhost:8080/axis2/services/MTOMService.MTOMServiceHttpSoap12Endpoint/ > >> " > >> > ); > >> > > >> > > >> > > >> > mtomServiceStub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, > >> > Constants.VALUE_TRUE); > >> > DataSource dataSource = new > >> > FileDataSource("/home/amila/ec2.tgz"); > >> > DataHandler dataHandler = new DataHandler(dataSource); > >> > > >> > mtomServiceStub.sendFile(dataHandler); > >> > } catch (AxisFault axisFault) { > >> > axisFault.printStackTrace(); > >> > } catch (java.rmi.RemoteException e) { > >> > e.printStackTrace(); > >> > } > >> > } > >> > > >> > every thing worked fine. Then I went the command prompt and compare > the > >> > sizes of the files > >> > > >> > am...@amila:~$ ls -all ec2-bak.tgz ec2.tgz > >> > -rw-r--r-- 1 amila amila 1990 2009-09-01 17:39 ec2-bak.tgz > >> > -rw-r--r-- 1 amila amila 2864 2009-09-01 17:28 ec2.tgz > >> > am...@amila:~$ tar -xvf ec2-bak.tgz > >> > > >> > gzip: stdin: invalid compressed data--format violated > >> > tar: Child returned status 1 > >> > tar: Error exit delayed from previous errors > >> > > >> > so file has not transfered correctly. > >> > > >> > Now if I switch off the MTOM by commenting that line > >> > > >> > am...@amila:~$ ls -all ec2-bak.tgz ec2.tgz > >> > -rw-r--r-- 1 amila amila 2864 2009-09-01 17:53 ec2-bak.tgz > >> > -rw-r--r-- 1 amila amila 2864 2009-09-01 17:28 ec2.tgz > >> > am...@amila:~$ tar -xvf ec2-bak.tgz > >> > .ec2/ > >> > .ec2/accno > >> > .ec2/cert-76TWWMUYTIAS5B7JK73C2FNCQ5R52CBO.pem > >> > .ec2/debian_public_debian_etch_15Sep07-keypair > >> > .ec2/pk-76TWWMUYTIAS5B7JK73C2FNCQ5R52CBO.pem > >> > > >> > it works fine. > >> > > >> > thanks, > >> > Amila. > >> > > >> > > >> > > >> > -- > >> > Amila Suriarachchi > >> > WSO2 Inc. > >> > blog: http://amilachinthaka.blogspot.com/ > >> > > >> > > > > > > > > -- > > Amila Suriarachchi > > WSO2 Inc. > > blog: http://amilachinthaka.blogspot.com/ > > >
