webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Have to send an attachment through a webService

  • 1.  Have to send an attachment through a webService

    Posted Wed February 04, 2015 02:31 AM

    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,


    #soa
    #API-Management
    #webMethods


  • 2.  RE: Have to send an attachment through a webService

    Posted Wed February 04, 2015 04:53 PM

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


    #soa
    #webMethods
    #API-Management


  • 3.  RE: Have to send an attachment through a webService

    Posted Sat April 04, 2015 05:28 AM

    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,


    #soa
    #webMethods
    #API-Management