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
Expand all | Collapse all

Read file as stream, set response and close stream does not work

  • 1.  Read file as stream, set response and close stream does not work

    Posted 07/15/18 04:52 PM

    Hello,

    In a REST API, I have created a Java service to read file as InputStream. I set InputStream as output variable of Java service.
    Now I map InputStream to responseStream of pub.flow:setResponse2.
    After this I use pub.io:close to close the InputStream.

    When I call this REST API from browser I get stream closed error. Even though I am closing the stream after calling setResponse2.
    Removing pub.io:close works fine but it leaves the file locked.

    Thanks,
    Kalpshekhar


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Read file as stream, set response and close stream does not work

    Posted 02/28/20 07:04 AM

    Hi Kalpshekhar,
    in Java, nothing will be read from the open stream unless you tell Java to do so. You will find plenty of information regarding this topic in the Internet (e.g. How to Read a File in Java | Baeldung).

    Best regards,
    Marcus


    #Integration-Server-and-ESB
    #webMethods