Handling xml

What are the flow services one can use to convert from one xml format into another?

Thanks,
mow

There are many predefined services existing in wmPublic package like…

In IS4.6 and earlier

pub.web:stringToDocument (entry for XML document)
pub.web:DocumentToRecord (Idata record structure)

Once you have got the appropriate record structure loaded in pipe ,next you need to map with any convertion formats like(internal Defined Canonnical XML,EDI,IDOC…)

In IS6.0 release (changes in naming convention but behaves same way like in earlier versions)

pub.xml:XMLStringToNode (entry for XML document)
pub.xml:XMLNodeToDocument (Idata record structure)

HTH.

I am using webMethods 6.0 on unix. My problem is that there is an xml file that can hold differetn transaction types in the same file. I want to extract each of these different transaction types into different document types.Can someone guide me as to how I should use the getxmlNodeiterator and getnextxmlnode to achieve this. Does getnextxmlnode iterate through every child element in the xml?

yes, getnextxmlnode will iterate child elements(must contain root element in your case transaction type root) in your receving xml and before this we need to specify Critera( Param in getxmlNodeIterator).Hope you followed this convention.

Sorry if i am missing some thing.

Thanks, RMG. I am try to find the best way to map an xml document that contains different transactions in the same xml document to differetn target xml types.

Should I first convert it first into a document and then map it to target xml structures

OR

Iterate through the source xml and somehow convert invidual nodes to the target format.

Any help would be appreciated.

How does one specify criteria for the getxmlNodeIterator?

your First option should work fine that to convert it first into a document and then map it to target xml structures.

Regarding filling criteria (StringList) param (place a map step before getXMLNodeIterator and do a set value to Criteria (pass the child root elements of your xml in your case different transaction types) and map this criteria to NodeIterator (inputParam).

hope i am not confusing…

We have a similar situation where I need to get Child element’s NAME & VALUE.

for eg:
<reqdoc>
<orderreq>1111</orderreq>
</reqdoc>

As in the above example, the <orderreq> can also be <creditreq> or other requests. What I would like to get is the element NAME(OrderReq or CreditReq) and call the corresponding services…

Can you describe how the criteria work in the above case.

Thanks

Is there any probability that you might get both (OrderReq and CreditReq)?

For option 1, where i convert the xml node to a document, what should be the label in the inarray statement for a loop step if the document created off the xml structure looks like :

TransactionContainer
Transaction
Transaction[0]
Transaction[1]
Transaction[2]




Transaction[10]
BatchTotal

what should be the label for the loop statement
( in array) to go through this?

Hi adb,

Pls download this Package and hope this is what your expecting using criteria of NodeIterator,

just i put some skeleton logic and try testing this if it clicks your requirement.

HTH.

TestIterator
TestIterator.zip (3.0 k)

RMG, what are the ndf and xml files? How can this beimported into wm?

mow,

I thought there might be any element in your Trasaction list sounds like eg:<transaction[0]>,<transaction[1]>…so that you can fill label of loop as Transaction and each trasaction iteration will branch on "Type== “Order” or “Sales”…

Is it what your xml transaction list looks like?

Every flow service will be internally saved as ndf.node ,flow.xml format, you can find in yourpackage/ns/folder/servicename file folders.

Hope you are refering this.

But i am not sure,why you want to import those ndf files to wM.

sorry i am a novice here. i didnt know how to view the code from the files you sent me. I assumed they had to be imported into wm. Yes, my xml file has a root element called the transactioncontainer and within that there are multiple instances of transaction[0], transaction[1] …etc. The structures of transaction[0] may be diff from transaction[1]. however there is a type attribute on each of these transaction elements which specifies what transaction it is.

how can i build the loop and the branch for each iteration to call diff serv for diff transactions

can you please tell me the exact expression i need to put in the loop statement.

should it be
%document/TransactionContainer/Transaction/@xsi:type%

or
%document/TransactionContainer/Transaction[0]/@xsi:type% with a variable index

earlier I uploaded the package,just you need to load this TestIterator.zip in webMethods server.

your loop in array label should be
/document/TransactionContainer/Transaction
under Transaction loop place a Branch step on each transaction type
%document/TransactionContainer/Transaction/@xsi:type% == ‘Order’…

FMG,

Really appreciate your help

mow

Thanks,Hope its worked out for you.

RMG, I got stuck on one point. Since the incoming xml is dynamic, it can have any number of transactions in any order ( and diff trans types),I cannot create a variable of document type to store this xml string in ( after doing a stringtonode and nodetodocument).

How can I access transaction[i] from this document once I hit it on a branch statement… discussed above.

Thanks,
mow