reverse of a string in web methods?

1.5k views Asked by At

I want Reverse of a string in web methods development . If i give input string,i want reverse of that input string in web methods flow steps.

  ex:  input is            :  web methods
       expecting output as :  sdohtem bew
2

There are 2 answers

0
Henning Waack On

Simplest and most performant way is writting a small and simple Java service. Don't try writting this in Flow, way too complex.

1
Saaji On

WebMethods is used for far more important stuffs than these. I am not saying they are not possible, what i am telling is that flow service is not used for this purpose. There is a REASON why webMethods has given us an option to use "JAVA SERVICE" . Tasks like the one which you have mentioned can be performed efficiently with a simple JAVA service.

Anyways, if you want to do it using flowservice, do as below

  1. Get the length of incoming String and map it to a variable called strLen and lastIndex

  2. reduce the value of strlen by 1. [This will be used as a REPEAT COUNT]

3.Initialize a string called "finalString" , startIndex to Zero.

4.Insert a repeat step, repeat on success, using strlen as COUNT

INSIDE THE REPEAT STEP:

5.Insert a map step, insert a transformer pub.math:subtractInts . map the lastIndex to input1, "1" to input2 and the result to "startIndex"

6.Invoke the service ,pub.string:substring map the inputString to inString, beginIndex = startindex, endIndex=lastIndex, value = tempString

7.Concat finalString+tempString =finalString using the concat service. Drop the tempString

8.Reduce lastIndex by 1

Sample Image of the flow

As said, stuffs like these are not intended to be done by FLOW SERVICE