webMethods step by step flow service sequence
Jun 19, 2012 10:33 0 Comments Development Hawk


           

 TASK: Creation of Flow Services - SEQUENCE

OS: WindowsOS

Platform: webMethods 7.1.2 

 

Overview

 

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.

 

alt

 

A Add the service pub.file:getFile to your service

è Map fileName to filename.

 

alt

 

alt

 

alt

 

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.

 

alt

 

è 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.

 

alt

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.

alt

 

alt

 

alt


è 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.

 

alt

 

alt

 

 

Similar Blogs: 

webMethods step by step creating Packages and...

webMethods step by step creating sample docum...

webMethods step by step flow services branchi...

                Creating a sample flow service at webmethods ...

               webMethods step by step creation of Indices

Prev Next
About the Author
Topic Replies (0)
Leave a Reply
Guest User

You might also like

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect