Currently we are implementing the 2C8 pip which is a BOM pip and it has a recursive structure. Our webmethods will be receiving inbound xml info from a matrix-one system which is providing all the BOM info.
I was given a xsd schema from our Matrix-One vendor and a sample xml file to try out.
I managed to import the xsd as a xml scheme which has a recursive structure. My questions is how do you guys built your loop as it is infinite since I have to build the loop structure before hand without knowing how many sublevel ?
Your help is greatly appreciated.
Remember that while the Integration Server is built on Java, the abstraction level of Flow removes much of the power (and complexity) of lower level languages in an effort to implement a “visual data transformation” development environment.
While there is nothing that prevents a Flow service from invoking itself, there is a fundamental problem with doing recursion in flow:
In 3gls like Java, when you enter a method/procedure, you get a new stack frame that allows you to create temporary variables that exist for only the lifetime of the method/procedure call and have no visibility outside it.
There is no such capability with the pipeline, because everything added to it has global visibility. So in your situation, a recursively invoked flow service has no way to create a new Assembly object that contains one of the subassemblies of the BOM that is “private” to one invocation of the service.
If your problem really requires a recursive solution, I think you will want to write a Java service.
I think recursive service in webMethods is a bad idea. Neverless, you could do it by placing the service itself in the transformer where all the pipeline will be private to the service itself. Remember from your university “formal method”, all recursive functions can be normalized.
By the way, if you are looking for a infinit loop and, you could use the flow step “REPEAT” and set the “Repeat On” to “Success” and “Count” to “-1”. Give this REPEAT a “Lable” and use the “EXIT” to break the loop.
Thanks folks for the reply.
But the problem is the structure is different in the looping statement.
This is how the xml data looks like before i do the mapping.
- MainTree 1
- MainTree 2
sub sub tree
sub sub + 1 …etc
Maybe I should call it infinite length in the looping rather recursive looping. So in my looping statement I will need to know the structure beforehand eg loop /maintree1/subtree/subsubtree/.
But in this case i do not how many child object is there - as long as there is a data I will need to map.
Am i doing things differently !
I thought of using a custom java also but make this a last resort.
This still looks like a Java service situation. This may not be as bad as it sounds. Remember that you can call Flow services from Java services. So the amount of Java code you have to write may not be that much.
That is a clever approach.
Why did you go this way instead of using Java?
Couple of reason for taking this approach.
We had very very short implementation time.We did think of using Java when we encountered performance issues but It was too late.
Client didn’t had stringent performance requirements.
We were doing recursive mapping for the first time on 6.1 as webMethods 4.6 never supported recursive structure.I am surprised how Gary managed to load the recursive XSD.May be its carefully designed.I clearly remember that webMethod support had responded that the webMethod 4.6 do not support recursive structures.
We asked webMethods support and they sent a not so useful sample using flow services.
I am not sure If these are legitimate reasons for using flow service.I am sure there are better ways.
As counter-intuitive as it may seem, I think that doing this one in Java will probably be easier, especially if you call out to Flow services where the recursive “scope control” is not needed.
But I’d be interested to hear how you do if you decide to try Gary’s approach.
Thanks Puneet for your doc - I am still digesting your doc. It’s a small world here - to meet you in the forum. I am still considering on the migration proposal that you guy has given to us
Anyway the XSD that I first imported pop up an error and when I proceed further it request me to select the root and the records created alright. According to Wm Support, there are 3 type of namespace in XML. The homogenuous, heterogenuous and the chameleon favour. The first one I uploaded probably is a homogenuous namespace. The other 2 is not supported by Wm. But I am not sure how you can tell whether it is one or the other as the xsd was provided by my vendor.
Your point taken.
This is not rocket sciences any way.I’ll try and see If I can do it java way and share with all of you.I myself have encountered this problem many times so It think time spent on this will be worth.
Hope to work with you soon and then we can resolve this as well.