Have to send an attachment through a webService

Hi All,
Could you please help me in providing some rough code for below need.

My requirement is to get the list of records from the DB, prepare a file (till here I can do it) and send it to the caller through a webService as an attachment. I have gone through some topics in tech forms and came to know we can achieve it with MTOM but I am not clear with this. If some one has some rough code or WmSoapSamples.zip file kindly share

Thanks,

pls read “Web Services Developer’s Guide”, it has details about how to do MTOM

Create a flow service namely sendFileAttachment and insert the below services in it.
pub.file.getFile
In the get file service pipeline add the file location and loadAs bytes.
Convert the loded file into base 64 encoding format.
pub.string.base64 encode
In the base 64 encode pipeline set useNewLine field as false.
Create a xop object for encoded string.
pub.soap.utils.createXop Object
In the createXop service pipeline provice the contentType as text/plain for plain text and application/pdf for pdf file.

Create a webService provider namely sendFileAttachmentProviderWS for sendFileAttachment and while selecting soap action opt SOAP1.2 and also in the properties of this service please select attachmentEnabled to true

Kindly implement the above and let us know if you see any weird errors.

Thanks,