Hi,

I have created a Axis2 (1.4.1) web service that has two functions upload content ad get content. UploadContent method takes DataHandler and fileName as parameter. In WSDL DataHandler is showing as xsd:base64Binary. When I call this method to upload a file it is only uploading 6KB of data. So if the file is less that 6KB it is uploaded properly and if file size is more that it uploads only 6KB. It is deployed on Apache Tomcat 6.0.28. Please see the code and WSDL:

==========================================================

Service Code:

package com.test.service;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;

/**
 * @author vermaa
 *
 */
public class DataHandlerContent {

    public DataHandler getContent(String fileName) {
        FileDataSource dataSource = new FileDataSource(fileName);
        DataHandler contentDataHandler = new DataHandler(dataSource);
        return contentDataHandler;
    }

    public DataHandler uploadContent(DataHandler contentDataHandler, String fileName) {
        
        System.out.println("Content Type: " + contentDataHandler.getContentType());
        System.out.println("Name: " + contentDataHandler.getName());
        try {
            OutputStream outStream = new FileOutputStream("c:\\temp
" + fileName);
            contentDataHandler.writeTo(outStream);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return contentDataHandler;
    }
}

===========================================================

WSDL:



   
        Please Type your service description here
    
   
       
           
               
                   
                       
                   
               
           
           
               
                   
                       
                   
               
           
           
               
                   
                       
                       
                   
               
           
           
               
                   
                       
                   
               
           
       
   
   
       
   
   
       
   
   
       
   
   
       
   
   
       
           
           
       
       
           
           
       
   
   
       
       
           
           
               
           
           
               
           
       
       
           
           
               
           
           
               
           
       
   
   
       
       
           
           
               
           
           
               
           
       
       
           
           
               
           
           
               
           
       
   
   
       
       
           
           
               
           
           
               
           
       
       
           
           
               
           
           
               
           
       
   
   
       
           
       
       
           
       
       
           
       
   

=================================================

Client Code:

    void uploadContent() {
        try {
            DataHandlerContentStub dhcs = new DataHandlerContentStub();
            UploadContent uploadContent = new UploadContent ();
            String fileName = "c:
web.zip";
            //File file = new File(fileName);
            //DataSource ds = new ByteArrayDataSource(new File(fileName), null);
            FileDataSource dataSource = new FileDataSource("c:
web.zip");
            
            DataHandler contentDataHandler = new DataHandler(dataSource);
            uploadContent.setContentDataHandler(contentDataHandler);
            uploadContent.setFileName("abc.zip");
            dhcs.uploadContent(uploadContent);
            
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
    }