Cort,
The problem you’re running into is that it can be tricky to retrieve elements from the lastError/pipeline document, ESPECIALLY when dealing with objects.
I, for one, try to avoid retrieving elements from the lastError/pipeline as much as possible. The way I accomplish this is by initializing every variable I may have to use in the catch block BEFORE the try block. In your case, however, you’re dealing with an InputStream object so it’s NOT as easy as setting a string to an empty value with a simple MAP step in the beginning of the service.
My suggestion to you then is to get the file before you jump into the try block. You could, however, get an exception when simply trying to open the file, so you’re going to need two sets of try-catch blocks. Here’s what your code should end up looking like:
main: SEQUENCE (Exit on SUCCESS)
— try: SEQUENCE (Exit on FAILURE)
------ getFile (this initializes the stream object)
— catch: SEQUENCE (Exit on DONE)
------ getLastError
------ Handle error (ex. send notification, signal failure, etc.)
main: SEQUENCE (Exit on SUCCESS)
— try: SEQUENCE (Exit on FAILURE)
------ Code that is throwing the exception
— catch: SEQUENCE (Exit on DONE)
------ getLastError
------ closeFile using the stream object initialized via getFile
------ Handle error (ex. send notification, signal failure, etc.)
Let me know if I can help further.
#Flow-and-Java-services#webMethods#Integration-Server-and-ESB