Thanks Dan

I've just tried uploading a image of more than 5gb size with local
transport.
This is just an example program having server and client in a same file .
The reason behind this is local transport is within a same jvm. If possible
can you verify this.
Also please confirm whether webservice.wsdl file is really needed for this
local transport or not.

package com.java.testupload;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.xml.ws.Endpoint;
import javax.xml.ws.soap.SOAPBinding;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import com.sun.xml.internal.ws.developer.JAXWSProperties;

public class ServicePublisher {

        private static final String FILENAME = "winserver";
        private static final String FILETYPE = "vdi";
        private static final String FILEPATH =
"D:\\Windowsserver_VirtualDrive\\winserver.vdi";

        /**
         * @param args
         */
        public static void main(String[] args) {
                // Endpoint ep = Endpoint
                // .publish(
                //
"http://localhost:8080/TestUploadServer/services/TestUploadServerImplPort";,
                // new TestUploadServerImpl());
                Endpoint ep = 
Endpoint.publish("local://TestUploadServerImplPort",
                                new TestUploadServerImpl());
                SOAPBinding binding = (SOAPBinding) ep.getBinding();
                binding.setMTOMEnabled(true);
                
                consumeServiceFromClient();
        }

        private static void consumeServiceFromClient() {
                JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
                Map<String, Object> props = new HashMap<String, Object>();
                props.put("mtom-enabled", Boolean.TRUE);
//              props.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 
8192);
                factory.setProperties(props);
                factory.setServiceClass(TestUploadServer.class);
                factory.setAddress("local://TestUploadServerImplPort");
                TestUploadServer uploadWebservice = (TestUploadServer) 
factory.create();

                FileUploader file = new FileUploader();

                file.setName(FILENAME);
                file.setFileType(FILETYPE);

                DataSource source = new FileDataSource(new File(FILEPATH));
                file.setDfile(new DataHandler(source));
                uploadWebservice.uploadFile(file);
                System.out.println("Finished copying....");
        }
}

Thanks,
Shriram



--
View this message in context: 
http://cxf.547215.n5.nabble.com/RE-Outofmemory-error-in-datahandler-tp5745554p5745732.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to