Been trying get a web service provider working with mtom and am not getting far.
I current have a provider in which I receive a file via a base64 encode string. We are reaching over 4mb files and want to convert the providers to use MTOM as we are expecting files up to 10mb big. We run our web services through datapower and therefore been instructed that cause of the large files we must utilise MTOM. I can recieve Base64binary files easly enough in my service but as soon as I enable MTOM on SoapUI or SOAPSonar i get the following error -
<faultstring>org.xml.sax.SAXParseException: Content is not allowed in prolog.</faultstring>
I am presuming its because the header has other information in the request sent to the web service.
Here is my sample code I am running in my provider:
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.*;
import java.io.File;
import java.io.IOException;
import javax.activation.DataHandler;
import javax.imageio.ImageIO;
import javax.xml.ws.soap.MTOM;
import lotus.domino.types.Base64Binary;
import lotus.domino.axis.encoding.Base64;
//Service Implementation Bean
@MTOM
public class ImageServerImpl {
public String uploadImage(Base64Binary data) {
if(data!=null){
File someFile = new File("c:/Output_File.pdf");
try{
FileOutputStream fos = new FileOutputStream(someFile);
fos.write(data.getBytes());
fos.flush();
fos.close();
}catch(Exception e){
}
}
return "Upload Successful";
}
}
Any help will be much appreciated.
thanks