WebService response to XML

Hi all,

I’ve invoked a Rest web service (Accepting application/xml) using HTTPConnector. Now I just want to manipulate some fields from this response XML to a new XML file. The web service response XML looks like the one below,


<?xml version='1.0' encoding='UTF-8'?>
<product>
	<code>100191</code>
	<categories>
		<category>
			<code>snow</code>
			<url>/Collections/Snow/c/snow</url>
		</category>
		<category>
			<code>Armada</code>
			<url>/Brands/Armada/c/Armada</url>
		</category>
	</categories>
</product>

The new XML which is to be created out of the above will have the following structure,


    <Products>
        <Product>
            <ExternalId>100191</ExternalId>
            <Categories>
				<Category>snow</Category>
				<Category>Armada</Category>
			</Categories>
        </Product>
    </Products>

Any help to achieve this? Please let me know if you need more information.

Hi kmsrihari,

I expect you have prepared HttpConnector which produces record on output edge. Record’s metadata contains field “content” of string type which contains downloaded XML.

Then use one of our XML components:
[*] http://doc.cloveretl.com/documentation/ … eader.html
[*] http://doc.cloveretl.com/documentation/ … eader.html
[*] http://doc.cloveretl.com/documentation/ … tract.html

Set “File URL” to “port:$0.content:discrete”. See http://doc.cloveretl.com/documentation/ … aders.html section “Reading from Input Port” for details.

I hope this helps.