Hi all,

I have a CXF server and generate automatically a XFire client. 
I used mtom sample from CXF distribution and testMtom function that
marshall/unmarshall a DataHandler INOUT parameter. The client will send OK a
file as an attachment through DataHandler parameter to server , but it seems
the server cannot send another file back to client. 
In example below, the file <server.zip> from testMtom server function does
not arrive on client side.

1. I activated in client and server optiopns for MTOM ( <mtom.enabled >) 
    In client ->  client.setProperty("mtom-enabled", "true"); 
    In server -> <jaxws:properties> <entry key="mtom-enabled" value="true"/>
.....

2. Alocate an instance of DataHandler on client :

        Holder<DataHandler> handler = new Holder<DataHandler>();
        byte[] data = new byte[(int) fileSize];
        new FileInputStream("c:\\temp\\client.zip").read(data);
        handler.value = new DataHandler(new ByteArrayDataSource(data,
"application/octet-stream"));

        MtomType xpMtom = new MtomType();
        xpMtom.setAttachinfo( handler.value );
        service.testMtom( xpMtom );

3.  On server :
      void testMtom( Holder<DataHandler> attachinfo)  { 
            InputStream mtomIn = attachinfo.value.getInputStream();
            long fileSize = 0;            
            for (int i = mtomIn.read(); i != -1; i = mtomIn.read()) {
                fileSize++;
            }            
            System.out.println("The image holder data length is " +
mtomIn.available());

            attachinfo.value = new DataHandler( new
FileDataSource("c:\\temp\\server.zip") );
     }
   
Where is the mistake ? 

Can anybody give me an advice

Any help is appreciated,
Petrica   
-- 
View this message in context: 
http://www.nabble.com/CXF-server-with-XFire-generated-client---problem-with-returning-a-type-DataHandler-with-MTOM-tf4222406.html#a12011445
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to