0

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
Lachlan Dowding
  • 4,356
  • 1
  • 15
  • 18
Ramnath Reddy
  • 21
  • 1
  • 1
  • 3

2 Answers2

3

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

Henning Waack
  • 410
  • 3
  • 10
1

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

Saaji
  • 11
  • 2
  • Please try to properly format the text after "INSIDE THE REPEAT STEP." It's a bit unclear what's going on there. – kkurian Oct 20 '16 at 06:03