Flow Example

Hi All,
I am new to wM, I went thro the documents provided by wM. Now, I want to do a sample on wM developer.
I created an xml file and the following is the content of the xml file
?xml version=“1.0” encoding=“ISO-8859-1” ?
Root
operation>Add56</num2
/Root

I have created the flow by invoking getFile(so as to load the xml file into wM environment and parse the same), I want the result as per the operation tag(I mean if it is Add then the two values r added and if it is Multiplication then the two values are multiplied).
Can anyone explain the flow, how I should proceed to get the result.
Thanks in advance

Regards
Ragz

Your flow should do the following:

getFile (as bytes)
bytesToString
stringToDocument
DocumentToRecord

You will then have something meaningful for flow logic. Assuming an XML structure of /root/operation, you should end up with a boundNode (record structure) containing a record called root containing a string called operation.

Add a Branch operation (switch variable /boundnode/root/operation) and then set up operations under the branch for add, multiple, divide, etc. The labels of these operations (set on the properties tab for each operation) should equal the value you want Branch to find. So, your final flow should look something like:

getFile
bytesToString
stringToDocument
documentToRecord
BRANCH on /boundnode/root/operation

  • add: addFloats
  • multiple: multiplyFloats
  • subtract: subtractFloats

and so on.

Ragz,

webMethods gives you flow services to handle XML docs. They also check if your xml is well-formed or not. These can be found in WmPublic package under xml subfolder. Your flow could be like this:

  • In your flow service, have fileName as an input variable
  • the first flow step would be a pub.file:getFile (set loadAs to bytes)
  • then add flow step pub.string:bytesToString
  • pub.xml:xmlStringToNode
  • pub.xml:xmlNodeToDocument

The output of the last service will give you an IS doucment type. The value of each tag is available here. Check the value and do appropriate branches.

Thanks,
Rajesh

sorry, i never saw the date of the original message. Ragz must be an expert by now. :slight_smile: