webMethods step by step flow service sequence
TASK: Creation of Flow Services - SEQUENCE
Platform: webMethods 7.1.2
In this blog we will create business logic for a Try/Catch using sequence in a Flow service.
We will create a service that will return an exception and then embed that service in a Try/Catch sequence.
Ã¨ In the â¦work folder mentioned below, create a flow service called exceptionSample. Set the input to be a String called filename and the output to be a string called result.
A Add the service pub.file:getFile to your service
Ã¨ Map fileName to filename.
aaAdd the service pub.string:bytesToString to your service exceptionSample
Ã¨ Map body/bytes to bytes and string to result.
Ã¨ Drop all other variables from the Pipeline Out.
Ã¨ Now save and run the service. Provide It with a filename of some location(C:/sample.txt) or any other file which does not exist, what result do you receive check it.
Now create another service in the folderâ¦work called sequenceTest. We will use this service to allow us to catch the exception that exceptionSample raises if the file name is not correct. Define a single input string for the service called fileName and a single output String called result.
Ã¨ In the sequenceTest service add three SEQUENCE steps to create a Flow try/catch block, as follows:
a. SEQUENCE set to Exit on Success
i) SEQUENCE set to Exit on Failure(be sure it is indented under the first SEQ)
ii) SEQUENCE set to Exit on Done(be sure it is indented under the first SEQ)
Ã¨ In the SEQUENCE Exit on Failure, add the service
â¦work exceptionSample(be sure it is indented under the SEQUENCE Exit on Failure). On the Pipeline tab, map as follows:
a. fileName to fileName
b. result to result
Ã¨ In the SEQUENCE Exit on Done, add the service pub.flow:getLastError(be sure it is indented under the SEQUENCE Exit on Done). On the Pipeline tab, map as follows:
a. lastError/error to result
Ã¨ Add a pub.flow:debugLog below the pub.flow:getLastError and map lastError/error to message
Ã¨ Save and run your service. Check the results tab and the server log.
a. To fail, provide c:/sample.txt file.
b. To succeed provide some other file which really exsists(success will show bytes in the Results tab, but with no entry in the server log. Try using Step or Trace to see the decision path.