You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Senaka Fernando <se...@wso2.com> on 2009/10/04 06:58:12 UTC

Re: MTOM is not working with Axis2 trunk

Folks,

We need to get this fixed on Axis2. Andreas, do you have any idea to what
could be causing this issue?

Thanks,
Senaka.

On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com> wrote:

> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>>";
> 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....@apache.org>>
>
>
> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>>";
> 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....@apache.org>>
>
>
> <?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 <andreas.veithen@gmail.com
> > wrote:
>
>> On Thu, Sep 3, 2009 at 05:51, Amila
>> Suriarachchi<am...@gmail.com> wrote:
>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
>> > <an...@gmail.com>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<am...@gmail.com> 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
>> >> >
>> >> > amila@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
>> >> > amila@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
>> >> >
>> >> > amila@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
>> >> > amila@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/
>> >
>>
>
>

Re: MTOM is not working with Axis2 trunk

Posted by Senaka Fernando <se...@wso2.com>.
Hi Andreas,

On Sun, Oct 11, 2009 at 3:33 AM, Andreas Veithen
<an...@gmail.com>wrote:

> Senaka,
>
> The issue with the servlet transport is now fixed. See r823960 for
> details.


I too tested this and it works fine. Many thanks for the fix.


> Not sure though how this relates to the issue with truncated
> files mentioned by Amila (which is different from the empty base64
> issue).
>

Well, this seems to be another issue rather. So, this answers the question
we had earlier to whether they were related.

Thanks,
Senaka.


>
> Andreas
>
> On Sat, Oct 10, 2009 at 15:37, Senaka Fernando <se...@wso2.com> wrote:
> > Hi Andreas,
> >
> > On Sat, Oct 10, 2009 at 6:40 PM, Andreas Veithen
> > <an...@gmail.com>wrote:
> >
> >> Hi Senaka,
> >>
> >> I've just completed the work on the MTOM/ADB issue discovered by Amila
> >> earlier this week. To summarize, this issue is triggered if the
> >> message is MTOM but contains unoptimized base64 data with length zero,
> >> i.e. empty elements of type base64 (in contrast to xop:Include
> >> elements pointing to empty attachments).
> >>
> >
> > I'll have a look at this. I simply ran the MTOM sample in Axis2, so I
> don't
> > think that the attachment was empty.
> >
> >>
> >> Do we now if the issue discussed here is also caused by this, or if it
> >> is a different problem?
> >>
> >
> > Not sure about this as yet.
> >
> >>
> >> Andreas
> >>
> >> PS: Just to rule out any obvious explanations: the Axiom snapshots on
> >> people.apache.org are outdated; are you sure that you built Axiom
> >> snapshots from the latest sources?
> >>
> >
> > Yes I have an svn checkout which I update at regular intervals. My local
> > maven repo therefore has a new snapshot.
> >
> > Thanks,
> > Senaka.
> >
> >>
> >> On Sat, Oct 10, 2009 at 10:03, Senaka Fernando <se...@wso2.com> wrote:
> >> > Hi Andreas,
> >> >
> >> > Any update on this? I have had no luck so far with figuring out what
> >> could
> >> > be exact cause to this and do a neat fix. While we can introduce a
> >> > workaround and fix this, I don't think that it would be the best thing
> to
> >> > do. I will have another go at this during this weekend and see if I
> can
> >> find
> >> > a breakthrough.
> >> >
> >> > Thanks,
> >> > Senaka.
> >> >
> >> > On Mon, Oct 5, 2009 at 1:04 PM, Andreas Veithen
> >> > <an...@gmail.com>wrote:
> >> >
> >> >> I will try to free up some time tonight to do a debugging session.
> >> >>
> >> >> Andreas
> >> >>
> >> >> On Sun, Oct 4, 2009 at 06:58, Senaka Fernando <se...@wso2.com>
> wrote:
> >> >> > Folks,
> >> >> >
> >> >> > We need to get this fixed on Axis2. Andreas, do you have any idea
> to
> >> what
> >> >> > could be causing this issue?
> >> >> >
> >> >> > Thanks,
> >> >> > Senaka.
> >> >> >
> >> >> > On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com>
> >> >> wrote:
> >> >> >
> >> >> >> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >
> >> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >
> >> >> >>";
> >> >> >> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >
> >> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >
> >> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >
> >> >> >>";
> >> >> >> 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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >
> >> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> <?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 <
> >> >> andreas.veithen@gmail.com
> >> >> >> > wrote:
> >> >> >>
> >> >> >>> On Thu, Sep 3, 2009 at 05:51, Amila
> >> >> >>> Suriarachchi<am...@gmail.com> wrote:
> >> >> >>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
> >> >> >>> > <an...@gmail.com>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<am...@gmail.com> 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
> >> >> >>> >> >
> >> >> >>> >> > amila@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
> >> >> >>> >> > amila@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
> >> >> >>> >> >
> >> >> >>> >> > amila@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
> >> >> >>> >> > amila@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/
> >> >> >>> >
> >> >> >>>
> >> >> >>
> >> >> >>
> >> >> >
> >> >>
> >> >
> >>
> >
>

Re: MTOM is not working with Axis2 trunk

Posted by Andreas Veithen <an...@gmail.com>.
Senaka,

The issue with the servlet transport is now fixed. See r823960 for
details. Not sure though how this relates to the issue with truncated
files mentioned by Amila (which is different from the empty base64
issue).

Andreas

On Sat, Oct 10, 2009 at 15:37, Senaka Fernando <se...@wso2.com> wrote:
> Hi Andreas,
>
> On Sat, Oct 10, 2009 at 6:40 PM, Andreas Veithen
> <an...@gmail.com>wrote:
>
>> Hi Senaka,
>>
>> I've just completed the work on the MTOM/ADB issue discovered by Amila
>> earlier this week. To summarize, this issue is triggered if the
>> message is MTOM but contains unoptimized base64 data with length zero,
>> i.e. empty elements of type base64 (in contrast to xop:Include
>> elements pointing to empty attachments).
>>
>
> I'll have a look at this. I simply ran the MTOM sample in Axis2, so I don't
> think that the attachment was empty.
>
>>
>> Do we now if the issue discussed here is also caused by this, or if it
>> is a different problem?
>>
>
> Not sure about this as yet.
>
>>
>> Andreas
>>
>> PS: Just to rule out any obvious explanations: the Axiom snapshots on
>> people.apache.org are outdated; are you sure that you built Axiom
>> snapshots from the latest sources?
>>
>
> Yes I have an svn checkout which I update at regular intervals. My local
> maven repo therefore has a new snapshot.
>
> Thanks,
> Senaka.
>
>>
>> On Sat, Oct 10, 2009 at 10:03, Senaka Fernando <se...@wso2.com> wrote:
>> > Hi Andreas,
>> >
>> > Any update on this? I have had no luck so far with figuring out what
>> could
>> > be exact cause to this and do a neat fix. While we can introduce a
>> > workaround and fix this, I don't think that it would be the best thing to
>> > do. I will have another go at this during this weekend and see if I can
>> find
>> > a breakthrough.
>> >
>> > Thanks,
>> > Senaka.
>> >
>> > On Mon, Oct 5, 2009 at 1:04 PM, Andreas Veithen
>> > <an...@gmail.com>wrote:
>> >
>> >> I will try to free up some time tonight to do a debugging session.
>> >>
>> >> Andreas
>> >>
>> >> On Sun, Oct 4, 2009 at 06:58, Senaka Fernando <se...@wso2.com> wrote:
>> >> > Folks,
>> >> >
>> >> > We need to get this fixed on Axis2. Andreas, do you have any idea to
>> what
>> >> > could be causing this issue?
>> >> >
>> >> > Thanks,
>> >> > Senaka.
>> >> >
>> >> > On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com>
>> >> wrote:
>> >> >
>> >> >> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>
>> <0....@apache.org>
>> >
>> >> <0....@apache.org>
>> <0....@apache.org>
>> >
>> >> >>";
>> >> >> 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....@apache.org>
>> <0....@apache.org>
>> >
>> >> <0....@apache.org>
>> <0....@apache.org>
>> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>
>> <0....@apache.org>
>> >
>> >> <0....@apache.org>
>> <0....@apache.org>
>> >
>> >> >>";
>> >> >> 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....@apache.org>
>> <0....@apache.org>
>> >
>> >> <0....@apache.org>
>> <0....@apache.org>
>> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> <?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 <
>> >> andreas.veithen@gmail.com
>> >> >> > wrote:
>> >> >>
>> >> >>> On Thu, Sep 3, 2009 at 05:51, Amila
>> >> >>> Suriarachchi<am...@gmail.com> wrote:
>> >> >>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
>> >> >>> > <an...@gmail.com>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<am...@gmail.com> 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
>> >> >>> >> >
>> >> >>> >> > amila@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
>> >> >>> >> > amila@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
>> >> >>> >> >
>> >> >>> >> > amila@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
>> >> >>> >> > amila@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/
>> >> >>> >
>> >> >>>
>> >> >>
>> >> >>
>> >> >
>> >>
>> >
>>
>

Re: MTOM is not working with Axis2 trunk

Posted by Senaka Fernando <se...@wso2.com>.
Hi Andreas,

On Sat, Oct 10, 2009 at 6:40 PM, Andreas Veithen
<an...@gmail.com>wrote:

> Hi Senaka,
>
> I've just completed the work on the MTOM/ADB issue discovered by Amila
> earlier this week. To summarize, this issue is triggered if the
> message is MTOM but contains unoptimized base64 data with length zero,
> i.e. empty elements of type base64 (in contrast to xop:Include
> elements pointing to empty attachments).
>

I'll have a look at this. I simply ran the MTOM sample in Axis2, so I don't
think that the attachment was empty.

>
> Do we now if the issue discussed here is also caused by this, or if it
> is a different problem?
>

Not sure about this as yet.

>
> Andreas
>
> PS: Just to rule out any obvious explanations: the Axiom snapshots on
> people.apache.org are outdated; are you sure that you built Axiom
> snapshots from the latest sources?
>

Yes I have an svn checkout which I update at regular intervals. My local
maven repo therefore has a new snapshot.

Thanks,
Senaka.

>
> On Sat, Oct 10, 2009 at 10:03, Senaka Fernando <se...@wso2.com> wrote:
> > Hi Andreas,
> >
> > Any update on this? I have had no luck so far with figuring out what
> could
> > be exact cause to this and do a neat fix. While we can introduce a
> > workaround and fix this, I don't think that it would be the best thing to
> > do. I will have another go at this during this weekend and see if I can
> find
> > a breakthrough.
> >
> > Thanks,
> > Senaka.
> >
> > On Mon, Oct 5, 2009 at 1:04 PM, Andreas Veithen
> > <an...@gmail.com>wrote:
> >
> >> I will try to free up some time tonight to do a debugging session.
> >>
> >> Andreas
> >>
> >> On Sun, Oct 4, 2009 at 06:58, Senaka Fernando <se...@wso2.com> wrote:
> >> > Folks,
> >> >
> >> > We need to get this fixed on Axis2. Andreas, do you have any idea to
> what
> >> > could be causing this issue?
> >> >
> >> > Thanks,
> >> > Senaka.
> >> >
> >> > On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com>
> >> wrote:
> >> >
> >> >> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >>";
> >> >> 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....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >>
> >> >>
> >> >>
> >> >> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >>";
> >> >> 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....@apache.org>
> <0....@apache.org>
> >
> >> <0....@apache.org>
> <0....@apache.org>
> >
> >> >>
> >> >>
> >> >>
> >> >> <?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 <
> >> andreas.veithen@gmail.com
> >> >> > wrote:
> >> >>
> >> >>> On Thu, Sep 3, 2009 at 05:51, Amila
> >> >>> Suriarachchi<am...@gmail.com> wrote:
> >> >>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
> >> >>> > <an...@gmail.com>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<am...@gmail.com> 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
> >> >>> >> >
> >> >>> >> > amila@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
> >> >>> >> > amila@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
> >> >>> >> >
> >> >>> >> > amila@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
> >> >>> >> > amila@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/
> >> >>> >
> >> >>>
> >> >>
> >> >>
> >> >
> >>
> >
>

Re: MTOM is not working with Axis2 trunk

Posted by Andreas Veithen <an...@gmail.com>.
Hi Senaka,

I've just completed the work on the MTOM/ADB issue discovered by Amila
earlier this week. To summarize, this issue is triggered if the
message is MTOM but contains unoptimized base64 data with length zero,
i.e. empty elements of type base64 (in contrast to xop:Include
elements pointing to empty attachments).

Do we now if the issue discussed here is also caused by this, or if it
is a different problem?

Andreas

PS: Just to rule out any obvious explanations: the Axiom snapshots on
people.apache.org are outdated; are you sure that you built Axiom
snapshots from the latest sources?

On Sat, Oct 10, 2009 at 10:03, Senaka Fernando <se...@wso2.com> wrote:
> Hi Andreas,
>
> Any update on this? I have had no luck so far with figuring out what could
> be exact cause to this and do a neat fix. While we can introduce a
> workaround and fix this, I don't think that it would be the best thing to
> do. I will have another go at this during this weekend and see if I can find
> a breakthrough.
>
> Thanks,
> Senaka.
>
> On Mon, Oct 5, 2009 at 1:04 PM, Andreas Veithen
> <an...@gmail.com>wrote:
>
>> I will try to free up some time tonight to do a debugging session.
>>
>> Andreas
>>
>> On Sun, Oct 4, 2009 at 06:58, Senaka Fernando <se...@wso2.com> wrote:
>> > Folks,
>> >
>> > We need to get this fixed on Axis2. Andreas, do you have any idea to what
>> > could be causing this issue?
>> >
>> > Thanks,
>> > Senaka.
>> >
>> > On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com>
>> wrote:
>> >
>> >> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>
>> <0....@apache.org>
>> >>";
>> >> 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....@apache.org>
>> <0....@apache.org>
>> >>
>> >>
>> >>
>> >> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>
>> <0....@apache.org>
>> >>";
>> >> 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....@apache.org>
>> <0....@apache.org>
>> >>
>> >>
>> >>
>> >> <?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 <
>> andreas.veithen@gmail.com
>> >> > wrote:
>> >>
>> >>> On Thu, Sep 3, 2009 at 05:51, Amila
>> >>> Suriarachchi<am...@gmail.com> wrote:
>> >>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
>> >>> > <an...@gmail.com>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<am...@gmail.com> 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
>> >>> >> >
>> >>> >> > amila@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
>> >>> >> > amila@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
>> >>> >> >
>> >>> >> > amila@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
>> >>> >> > amila@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/
>> >>> >
>> >>>
>> >>
>> >>
>> >
>>
>

Re: MTOM is not working with Axis2 trunk

Posted by Senaka Fernando <se...@wso2.com>.
Hi Andreas,

Any update on this? I have had no luck so far with figuring out what could
be exact cause to this and do a neat fix. While we can introduce a
workaround and fix this, I don't think that it would be the best thing to
do. I will have another go at this during this weekend and see if I can find
a breakthrough.

Thanks,
Senaka.

On Mon, Oct 5, 2009 at 1:04 PM, Andreas Veithen
<an...@gmail.com>wrote:

> I will try to free up some time tonight to do a debugging session.
>
> Andreas
>
> On Sun, Oct 4, 2009 at 06:58, Senaka Fernando <se...@wso2.com> wrote:
> > Folks,
> >
> > We need to get this fixed on Axis2. Andreas, do you have any idea to what
> > could be causing this issue?
> >
> > Thanks,
> > Senaka.
> >
> > On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com>
> wrote:
> >
> >> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>
> <0....@apache.org>
> >>";
> >> 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....@apache.org>
> <0....@apache.org>
> >>
> >>
> >>
> >> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>
> <0....@apache.org>
> >>";
> >> 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....@apache.org>
> <0....@apache.org>
> >>
> >>
> >>
> >> <?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 <
> andreas.veithen@gmail.com
> >> > wrote:
> >>
> >>> On Thu, Sep 3, 2009 at 05:51, Amila
> >>> Suriarachchi<am...@gmail.com> wrote:
> >>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
> >>> > <an...@gmail.com>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<am...@gmail.com> 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
> >>> >> >
> >>> >> > amila@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
> >>> >> > amila@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
> >>> >> >
> >>> >> > amila@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
> >>> >> > amila@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/
> >>> >
> >>>
> >>
> >>
> >
>

Re: MTOM is not working with Axis2 trunk

Posted by Senaka Fernando <se...@wso2.com>.
Hi Andreas,

Any update on this? I have had no luck so far with figuring out what could
be exact cause to this and do a neat fix. While we can introduce a
workaround and fix this, I don't think that it would be the best thing to
do. I will have another go at this during this weekend and see if I can find
a breakthrough.

Thanks,
Senaka.

On Mon, Oct 5, 2009 at 1:04 PM, Andreas Veithen
<an...@gmail.com>wrote:

> I will try to free up some time tonight to do a debugging session.
>
> Andreas
>
> On Sun, Oct 4, 2009 at 06:58, Senaka Fernando <se...@wso2.com> wrote:
> > Folks,
> >
> > We need to get this fixed on Axis2. Andreas, do you have any idea to what
> > could be causing this issue?
> >
> > Thanks,
> > Senaka.
> >
> > On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com>
> wrote:
> >
> >> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>
> <0....@apache.org>
> >>";
> >> 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....@apache.org>
> <0....@apache.org>
> >>
> >>
> >>
> >> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>
> <0....@apache.org>
> >>";
> >> 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....@apache.org>
> <0....@apache.org>
> >>
> >>
> >>
> >> <?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 <
> andreas.veithen@gmail.com
> >> > wrote:
> >>
> >>> On Thu, Sep 3, 2009 at 05:51, Amila
> >>> Suriarachchi<am...@gmail.com> wrote:
> >>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
> >>> > <an...@gmail.com>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<am...@gmail.com> 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
> >>> >> >
> >>> >> > amila@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
> >>> >> > amila@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
> >>> >> >
> >>> >> > amila@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
> >>> >> > amila@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/
> >>> >
> >>>
> >>
> >>
> >
>

Re: MTOM is not working with Axis2 trunk

Posted by Andreas Veithen <an...@gmail.com>.
I will try to free up some time tonight to do a debugging session.

Andreas

On Sun, Oct 4, 2009 at 06:58, Senaka Fernando <se...@wso2.com> wrote:
> Folks,
>
> We need to get this fixed on Axis2. Andreas, do you have any idea to what
> could be causing this issue?
>
> Thanks,
> Senaka.
>
> On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com> wrote:
>
>> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>>";
>> 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....@apache.org>>
>>
>>
>> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>>";
>> 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....@apache.org>>
>>
>>
>> <?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 <andreas.veithen@gmail.com
>> > wrote:
>>
>>> On Thu, Sep 3, 2009 at 05:51, Amila
>>> Suriarachchi<am...@gmail.com> wrote:
>>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
>>> > <an...@gmail.com>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<am...@gmail.com> 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
>>> >> >
>>> >> > amila@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
>>> >> > amila@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
>>> >> >
>>> >> > amila@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
>>> >> > amila@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/
>>> >
>>>
>>
>>
>

Re: MTOM is not working with Axis2 trunk

Posted by Andreas Veithen <an...@gmail.com>.
I will try to free up some time tonight to do a debugging session.

Andreas

On Sun, Oct 4, 2009 at 06:58, Senaka Fernando <se...@wso2.com> wrote:
> Folks,
>
> We need to get this fixed on Axis2. Andreas, do you have any idea to what
> could be causing this issue?
>
> Thanks,
> Senaka.
>
> On Tue, Sep 22, 2009 at 5:19 PM, Senaka Fernando <se...@wso2.com> wrote:
>
>> 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:9645FCE52FDC6F4D931253559793957@apache.org<0....@apache.org>>";
>> 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....@apache.org>>
>>
>>
>> <?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:9E87539EB4CACBEB921253619434972@apache.org<0....@apache.org>>";
>> 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....@apache.org>>
>>
>>
>> <?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 <andreas.veithen@gmail.com
>> > wrote:
>>
>>> On Thu, Sep 3, 2009 at 05:51, Amila
>>> Suriarachchi<am...@gmail.com> wrote:
>>> > On Thu, Sep 3, 2009 at 3:16 AM, Andreas Veithen
>>> > <an...@gmail.com>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<am...@gmail.com> 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
>>> >> >
>>> >> > amila@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
>>> >> > amila@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
>>> >> >
>>> >> > amila@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
>>> >> > amila@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/
>>> >
>>>
>>
>>
>