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?

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/
>

Reply via email to