File Upload using File Input AND File Item components


I want to realize a very basic File upload to my Database through CAF.
MWS version IS: 7.0 SP2
IS version : 6.5

I am trying to use the File Input component combined with a File Item Data to simply upload a file to IS.

To use my File Item, I have copied, from myWebMethods Sample, the File Input sample. So for the moment, I can only chose my file (cliking browse button) but still I have some troubles to bind it with my upload service.

Here is how my File Item is instanced in the CAF (according to the sample I copied in MWS sample library):

private FileItem fileAttachment = new FileItem() {
protected String m_fieldName;
public void delete() {}
public byte get() { return getString().getBytes(); }
public String getContentType() { return “”; }
public String getFieldName() { return m_fieldName; }
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(get());
public String getName() { return “”; }
public OutputStream getOutputStream() throws IOException {
return new ByteArrayOutputStream();
public long getSize() { return getString().length(); }
public String getString() { return “”; }
public String getString(String charset) throws UnsupportedEncodingException {
return getString();
public boolean isFormField() { return false; }
public boolean isInMemory() { return true; }
public void setFieldName(String name) { m_fieldName = name; }
public void setFormField(boolean isFormField) {}
public void write(File file) throws Exception {
FileOutputStream out = new FileOutputStream(file);

Which Object should I use to bind my Service Input with: InputStream, String or byte (using the fileItem.get() method) ?

From Is view, My Upload Service has an object as Input to receive the binding value from MWS.
Whatever I have tried to bind the object value with (byte, InputStream or String) I can never get the proper byte in IS.

What is the transformation to do on the Input Object value received in my IS ?
I have alerady tried the service “stringToBytes” with different encodings, but the format I get is never good.

I have searched the forum for hours, posted SR, but none of these were really successful…Please Help !

Many Thanks !

any up ?