IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  Upload service

    Posted 05/04/21 03:05 AM

    Hello
    I need to create a service, to be able to upload files to the server from an html or dsp page.
    Can you tell me how to do this?
    I am using version 10.5


    #webMethods


  • 2.  RE: Upload service

    Posted 05/04/21 04:18 AM

    Writing the service is the easy part, see here an example screenshot

    You can use javascript from within in DSP or HTML page as such

    <form enctype="multipart/form-data" action="/invoke/jc.demo/uploadFile" method="post">
    <input id="image-file" type="file" />
    </form>
    

    #webMethods


  • 3.  RE: Upload service

    Posted 05/04/21 03:02 PM

    @John_Carter4 provides a nice and simple example to illustrate, but I would strongly suggest that you not use streamToBytes – that will load the entire file into memory, which can be bad. Just pass the stream you get in the pipeline to the file writing service. The data will go right to disk without exhausting memory.


    #webMethods


  • 4.  RE: Upload service

    Posted 05/04/21 03:47 PM

    @reamon - good point, this is a copy paste for a use case where I know the file will be a simple text file.
    If you want to build something like this for public facing purposes, use a stream and also impose a file size limit too!.
    thnx,
    John.


    #webMethods