How to parse an XML and tranform another XML

Hello friends , How do i parse an XML and transform it into another XML using web methods.

For example i have to PARSE following XML , EXTRACT VALUES OF NODES AND PUT INTO BELOW xml




First, the services that you need to use are described in the Built-In Services Guide found in your wm_home\Developer\doc folder.

Assuming your XML is already in a string, you would use pub.xml:xmlStringToNode to convert it to a IS node. Nodes are objects representing parsed XML documents.

Map your string to the xmlstring parameter and be sure to set the isXML parameter to “true”.

If your service was invoked by posting an XML document to Integration Server, there will already be a node object in the pipeline created by the XML content handler.

The XML content handler processes the xml document before your service is invoked, checks for well-formedness and parses the XML into a node and inserts it into the pipeline.

To work with a node in IS, you need to use the pub.xml:xmlNodeToDocument service or the pub.xml:queryXMLNode service. The former is simpler, but lacks the ability to query a large XML document for the one section that you might need to process.

To use pub.xml:xmlNodeToDocument in its simplest form, just map your node to that service’s node input parameter.

You will now have a document (called “document”) in the pipeline and can use a map step to map it to another document type with the desired field names.

Use pub.xml:documentToXMLString to convert this target document to an xml string.

These steps represent transformation of a simple XML document like the example you gave. Documents with namespaces, repeating elements (arrays) or requiring you to operate on only a portion of the incoming document will make use of the other parameters for these xml handling services.

Spend some time with the services in the pub.xml folder and the sample code in the WmSamples package. If you plan on doing much integration with webMethods tools, you’ll need to become very, very proficient with the IS XML handling services.

Think of it as like learning algebra before you can move on to calculus.



ok thanks,going thru it

Hi ,
I do have doubts on the same issue. Now If I do have repeating elements (arrays) as in the input XML & some database processing to generate the output xml , then how do I parse it & generate output xml?


you can use various built-in-services like xmlStringToXMLNode, xmlNodeToDocument for building xml document

queryXMLString can solve your XML parsing problem.

these services are located in pub.xml folder in WmPublic package


There are three ways to use pub.xml:xmlNodetoDocument to deal with repeating elements in an incoming document:

  • use the makeArrays parameter to have the service automatically collect repeating elements into a document list
  • use the arrays parameter to enter a list of the names of elements that should be collected into a document list
  • supply a valid, fully qualified document type name in the documentTypeName parameter

As for performing other processing, that would just involve more steps in your Flow service to invoke one or more adapter services to perform the necessary database processing.

If you are just learning Flow, you would probably benefit from completing the Developer 4.6 Tutorial. While it was originally written for the IS 4.6 release, most of the Flow concepts are directly applicable to later versions. You can get this tutorial on Advantage.


Hi Mark,
Thanks for the immediate reply.
I still have doubts as how to deal with repeating elements with map.
I am picking the input xml into a reference document (input XML structure) & want to map it to output XML structure . Now the reference document which is received has multiple child nodes. Now I am not able to map the input reference document to output reference document.

Can you please tell me how to do it?


Amit, I am not sure I understand your problem, Please check if running a loop over the input document list and using appendToDocumentList to map to output document can solve your purpose.



I’m guessing that you are a webMethods Integration Server novice. That’s OK, we were all there once.

Please spend some time with the Developer User’s Guide to learn the basics of the Flow langauge (especially Appendix A - Flow Steps). One way to do this is to complete the Developer Tutorial 4.6 available on Advantage. If you do not have an Advantage account, your employer or customer can get the tutorial PDF for you.

You can only use a MAP statement to map a single element of a documentList or stringList at a time. If you place the MAP inside a LOOP statement you can map each element in turn. If you are attempting to create a new documentList from the source list with different field names, you will need to use the pub.list:appendToDocumentList service. It is described in the Built-In Services Guide.